|
1 |
| -from quart import Quart, request, send_file, Response, jsonify, url_for, redirect, abort, render_template_string |
| 1 | +from quart import Quart, request, send_file, Response, jsonify, url_for, redirect, abort, render_template |
2 | 2 | import quart
|
3 | 3 | import os
|
4 | 4 | import psycopg
|
|
28 | 28 | key = config["ssl_key"]
|
29 | 29 |
|
30 | 30 |
|
31 |
| -app = Quart(__name__) |
| 31 | +app = Quart(__name__, template_folder='api') |
32 | 32 | app = cors(app, allow_origin=["*"], allow_headers="*")
|
33 | 33 |
|
34 | 34 | accepted_pull_tags_from_team = ["id", "name", "ownerId", "profilePicture", "memberCount", "socialInfo", "homeBannerImageLg"]
|
@@ -136,131 +136,10 @@ async def not_found(_):
|
136 | 136 | page_url = request.path
|
137 | 137 | return {'message': f'Page {page_url} does not exist.'}, 401
|
138 | 138 |
|
139 |
| -@app.route('/', methods=['GET']) |
| 139 | +@app.route('/', methods=["GET"]) |
140 | 140 | @route_cors(allow_origin="*")
|
141 | 141 | async def index():
|
142 |
| - template = """ |
143 |
| - <html> |
144 |
| - <head> |
145 |
| - <title>API Documentation</title> |
146 |
| - <style> |
147 |
| - body { |
148 |
| - font-family: Arial, sans-serif; |
149 |
| - font-size: 16px; |
150 |
| - line-height: 1.5; |
151 |
| - background-color: #1C2841; |
152 |
| - color: #fff; |
153 |
| - margin: 15; |
154 |
| - padding: 0; |
155 |
| - } |
156 |
| -
|
157 |
| - h1 { |
158 |
| - font-size: 32px; |
159 |
| - margin-top: 15; |
160 |
| - padding: 20px; |
161 |
| - } |
162 |
| -
|
163 |
| - ul { |
164 |
| - list-style: none; |
165 |
| - margin: 10; |
166 |
| - padding: 0; |
167 |
| - } |
168 |
| -
|
169 |
| - li { |
170 |
| - margin: 10px 0; |
171 |
| - } |
172 |
| -
|
173 |
| - .section { |
174 |
| - margin-top: 20px; |
175 |
| - padding: 20px; |
176 |
| - border: 1px solid #ccc; |
177 |
| - background-color: #2A3B5F; |
178 |
| - color: #fff; |
179 |
| - position: relative; |
180 |
| - } |
181 |
| -
|
182 |
| - .section h2 { |
183 |
| - margin-top: 0; |
184 |
| - padding-bottom: 10px; |
185 |
| - border-bottom: 1px solid #fff; |
186 |
| - } |
187 |
| -
|
188 |
| - .section p { |
189 |
| - margin: 0; |
190 |
| - padding: 10px 0; |
191 |
| - } |
192 |
| -
|
193 |
| - .copy-btn { |
194 |
| - position: absolute; |
195 |
| - top: 10px; |
196 |
| - right: 10px; |
197 |
| - padding: 5px 10px; |
198 |
| - border-radius: 5px; |
199 |
| - background-color: #fff; |
200 |
| - color: #333; |
201 |
| - cursor: pointer; |
202 |
| - } |
203 |
| -
|
204 |
| - .code-block-stats { |
205 |
| - display: flex; |
206 |
| - align-items: center; |
207 |
| - margin-top: 10px; |
208 |
| - margin-bottom: 10px; |
209 |
| - background-color: #424949; |
210 |
| - border: 1px solid #ccc; |
211 |
| - border-radius: 5px; |
212 |
| - padding: 10px; |
213 |
| - overflow-x: auto; |
214 |
| - } |
215 |
| -
|
216 |
| - .code-block pre { |
217 |
| - margin: 0; |
218 |
| - } |
219 |
| -
|
220 |
| - .code-block-stats code { |
221 |
| - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; |
222 |
| - font-size: 14px; |
223 |
| - line-height: 1; |
224 |
| - color: #fff; |
225 |
| - } |
226 |
| - </style> |
227 |
| - </head> |
228 |
| - <body> |
229 |
| - <h1>API Documentation</h1> |
230 |
| - <section id="stats" class="section"> |
231 |
| - <h2>/stats · [GET] · Unprotected</h2> |
232 |
| - <p>Returns a number of servers Rayz is in, and a number of users Rayz can see.</p> |
233 |
| - <div class="code-block-stats"> |
234 |
| - <pre> |
235 |
| -<code class="language-http">curl --request GET https://api.rayzbot.xyz/stats </code></pre> |
236 |
| - </div> |
237 |
| - <button class="copy-btn" onclick="copyToClipboard('https://api.rayzbot.xyz/stats')">Copy</button> |
238 |
| - </section> |
239 |
| - <section id="server-info" class="section"> |
240 |
| - <h2>/server/SERVER_ID/info · [GET] · Unprotected</h2> |
241 |
| - <p>This returns all the data needed for a website to display. Such as: settings, staff member information, bots, server information.</p> |
242 |
| - <button class="copy-btn" onclick="copyToClipboard('https://api.rayzbot.xyz/server/SERVER_ID/info')">Copy</button> |
243 |
| - </section> |
244 |
| - <section id="generate-token" class="section"> |
245 |
| - <h2>/token/USER_ID/generate · [GET] · Unprotected</h2> |
246 |
| - <p>Generates a Token and Password for authentication.</p> |
247 |
| - <button class="copy-btn" onclick="copyToClipboard('https://api.rayzbot.xyz/token/USER_ID/generate)">Copy</button> |
248 |
| - </section> |
249 |
| - <script> |
250 |
| - function copyToClipboard(text) { |
251 |
| - var textarea = document.createElement("textarea"); |
252 |
| - textarea.value = text; |
253 |
| - document.body.appendChild(textarea); |
254 |
| - textarea.select(); |
255 |
| - document.execCommand("copy"); |
256 |
| - document.body.removeChild(textarea); |
257 |
| - } |
258 |
| - </script> |
259 |
| - </body> |
260 |
| - </html> |
261 |
| -
|
262 |
| - """ |
263 |
| - return await render_template_string(template) |
| 142 | + return await render_template('index.html') |
264 | 143 |
|
265 | 144 | @app.route("/capoo")
|
266 | 145 | @route_cors(allow_headers=["content-type"], allow_origin="*")
|
|
0 commit comments