Skip to content

Commit 44233dc

Browse files
committed
Update to index page
1 parent cd155ac commit 44233dc

File tree

3 files changed

+138
-130
lines changed

3 files changed

+138
-130
lines changed

.gitignore

+2-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config/economy_settings.json
1010
# TODO -> PR to list valid reason here
1111
# Fonts, I have no idea why they were added in the first place
1212
fonts/*
13+
.vs/*
1314

1415
# Local log file
1516
guilded.log
@@ -21,8 +22,4 @@ modules/demo.py
2122
economy/bans.py
2223

2324
# Ignoring extra packages installed in venv
24-
env
25-
/.vs/slnx.sqlite
26-
/.vs/ProjectSettings.json
27-
/.vs/Rayz/v16/.suo
28-
/.vs/VSWorkspaceState.json
25+
env

API.py

+4-125
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
22
import quart
33
import os
44
import psycopg
@@ -28,7 +28,7 @@
2828
key = config["ssl_key"]
2929

3030

31-
app = Quart(__name__)
31+
app = Quart(__name__, template_folder='api')
3232
app = cors(app, allow_origin=["*"], allow_headers="*")
3333

3434
accepted_pull_tags_from_team = ["id", "name", "ownerId", "profilePicture", "memberCount", "socialInfo", "homeBannerImageLg"]
@@ -136,131 +136,10 @@ async def not_found(_):
136136
page_url = request.path
137137
return {'message': f'Page {page_url} does not exist.'}, 401
138138

139-
@app.route('/', methods=['GET'])
139+
@app.route('/', methods=["GET"])
140140
@route_cors(allow_origin="*")
141141
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 &#183; [GET] &#183; 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 &#183; [GET] &#183; 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 &#183; [GET] &#183; 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')
264143

265144
@app.route("/capoo")
266145
@route_cors(allow_headers=["content-type"], allow_origin="*")

api/index.html

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<html>
2+
<head>
3+
<title>API Documentation</title>
4+
<style>
5+
body {
6+
font-family: Arial, sans-serif;
7+
font-size: 16px;
8+
line-height: 1.5;
9+
background-color: #1C2841;
10+
color: #fff;
11+
margin: 15;
12+
padding: 0;
13+
}
14+
15+
h1 {
16+
font-size: 32px;
17+
margin-top: 15;
18+
padding: 20px;
19+
}
20+
21+
/* Add animation styles */
22+
.animate-colors {
23+
animation: color-change 5s infinite;
24+
}
25+
26+
/* Keyframe animation for the text color */
27+
@keyframes color-change {
28+
0% {
29+
color: #ff0000;
30+
}
31+
32+
25% {
33+
color: #00ff00;
34+
}
35+
36+
50% {
37+
color: #0000ff;
38+
}
39+
40+
75% {
41+
color: #ffff00;
42+
}
43+
44+
100% {
45+
color: #ff00ff;
46+
}
47+
}
48+
49+
ul {
50+
list-style: none;
51+
margin: 10;
52+
padding: 0;
53+
}
54+
55+
li {
56+
margin: 10px 0;
57+
}
58+
59+
.section {
60+
margin-top: 20px;
61+
padding: 20px;
62+
border: 1px solid #ccc;
63+
background-color: #2A3B5F;
64+
color: #fff;
65+
position: relative;
66+
}
67+
68+
.section h2 {
69+
margin-top: 0;
70+
padding-bottom: 10px;
71+
border-bottom: 1px solid #fff;
72+
}
73+
74+
.section p {
75+
margin: 0;
76+
padding: 10px 0;
77+
}
78+
79+
.copy-btn {
80+
position: absolute;
81+
top: 10px;
82+
right: 10px;
83+
padding: 5px 10px;
84+
border-radius: 5px;
85+
background-color: #fff;
86+
color: #333;
87+
cursor: pointer;
88+
}
89+
90+
.code-block-stats {
91+
display: flex;
92+
align-items: center;
93+
margin-top: 10px;
94+
margin-bottom: 10px;
95+
background-color: #424949;
96+
border: 1px solid #ccc;
97+
border-radius: 5px;
98+
padding: 10px;
99+
overflow-x: auto;
100+
}
101+
102+
.code-block pre {
103+
margin: 0;
104+
}
105+
106+
.code-block-stats code {
107+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
108+
font-size: 14px;
109+
line-height: 1;
110+
color: #fff;
111+
}
112+
</style>
113+
</head>
114+
<body>
115+
<h1 class="animate-colors">API Documentation</h1>
116+
<section id="stats" class="section">
117+
<h2>/stats &#183; [GET] &#183; Unprotected</h2>
118+
<p>Returns a number of servers Rayz is in, and a number of users Rayz can see.</p>
119+
<div class="code-block-stats">
120+
<pre><code class="language-http">curl --request GET https://api.rayzbot.xyz/stats </code></pre>
121+
</div>
122+
</section>
123+
<section id="server-info" class="section">
124+
<h2>/server/SERVER_ID/info &#183; [GET] &#183; Unprotected</h2>
125+
<p>This returns all the data needed for a website to display. Such as: settings, staff member information, bots, server information.</p>
126+
</section>
127+
<section id="generate-token" class="section">
128+
<h2>/token/USER_ID/generate &#183; [GET] &#183; Unprotected</h2>
129+
<p>Generates a Token and Password for authentication.</p>
130+
</section>
131+
</body>
132+
</html>

0 commit comments

Comments
 (0)