Skip to content

Commit 1925eba

Browse files
Change API to not load a bunch of extra resources
1 parent 48e7c7f commit 1925eba

File tree

4 files changed

+24
-39
lines changed

4 files changed

+24
-39
lines changed

assets/api.js

-29
This file was deleted.

assets/api/index.html

+19-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/png" href="/icon.png" />
66
<link rel="stylesheet" href="/index.css" />
7-
<link
8-
rel="stylesheet"
9-
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"
10-
/>
117
<meta name="viewport" content="width=device-width" />
128
<meta
139
property="og:title"
@@ -45,7 +41,19 @@ <h1>MCping API</h1>
4541
Bedrock API response is the same, with the caveat of never returning the
4642
icon. The bedrock player list may also be synthetic.
4743
</p>
48-
<pre><code id="examplePingResponse" class="language-json"></code></pre>
44+
<pre><code id="examplePingResponse">{
45+
"latency": 47,
46+
"players": {
47+
"online": 0,
48+
"maximum": 20,
49+
"sample": []
50+
},
51+
"motd": "Minecraft Support Discord Testing Server",
52+
"version": {
53+
"protocol": 765,
54+
"broadcast": "1.20.4"
55+
}
56+
}</code></pre>
4957
<p>
5058
There is also a Mojang Services API, at
5159
<a href="/api/services">/api/services</a>. This is useful for checking if
@@ -54,7 +62,11 @@ <h1>MCping API</h1>
5462
<code>DefiniteProblems</code>, <code>PossibleProblems</code>, and
5563
<code>Operational</code>.
5664
</p>
57-
<pre><code id="exampleServicesResponse" class="language-json"></code></pre>
58-
<script src="/api.js" type="module"></script>
65+
<pre><code class="language-json">{
66+
"Xbox services": "Operational",
67+
"SessionServer": "Operational",
68+
"Mojang API": "Operational",
69+
"Minecraft API": "Operational"
70+
}</code></pre>
5971
</body>
6072
</html>

assets/index.css

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ footer {
6464
pre > code {
6565
text-align: left;
6666
display: inline-block;
67+
border-style: inset;
68+
border-radius: 4px;
69+
padding: 1ch;
6770
}
6871

6972
.execute-ping-container {

src/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ static CSP_VALUE: HeaderValue = HeaderValue::from_static(
8888
"default-src 'self'; \
8989
img-src 'self' data:; \
9090
connect-src 'self' https://*.giveip.io; \
91-
script-src 'self' https://cdnjs.cloudflare.com/ajax/libs/highlight.js/ \
92-
https://static.cloudflareinsights.com; \
93-
style-src 'self' https://cdnjs.cloudflare.com/ajax/libs/highlight.js/; \
91+
script-src 'self' https://static.cloudflareinsights.com; \
92+
style-src 'self';\
9493
object-src 'none'; \
9594
base-uri 'none';",
9695
);

0 commit comments

Comments
 (0)