melonsoda 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>melonsoda</title>
6
+ <script>
7
+ // have a list of cdns on hold
8
+ (async function() {
9
+ const axiosCDNs = [
10
+ "https://file.garden/ZtNXqbPCZ1cAh6MT/axios.min.js",
11
+ "https://cdn.jsdelivr.net/npm/axios@1.14.0/dist/axios.min.js",
12
+ "https://cdn.jsdelivr.net/gh/linuxfandudeguy/cdn-4xe3@axios/axios.min.js",
13
+ "https://unpkg.com/axios@1.14.0/dist/axios.min.js",
14
+ "https://cdnjs.cloudflare.com/ajax/libs/axios/1.3.0/axios.min.js",
15
+ "https://esm.sh/axios@1.14.0",
16
+ "https://cdn.skypack.dev/pin/axios@v1.14.0-M6MvqYWpz43BoC8jznR8/mode=imports,min/optimized/axios.js",
17
+ "https://ga.jspm.io/npm:axios@1.14.0/index.js",
18
+ "https://rawcdn.githack.com/linuxfandudeguy/cdn-4xe3/864214fee4be01061108a9210846113a1decb7bd/axios.min.js",
19
+ "https://raw.githubusercontent.com/linuxfandudeguy/cdn-4xe3/refs/heads/main/axios.min.js",
20
+ "https://cdn.statically.io/gh/linuxfandudeguy/cdn-4xe3@864214fee4be01061108a9210846113a1decb7bd/axios.min.js",
21
+ "https://files.catbox.moe/08cks8.js"
22
+ ];
23
+
24
+ async function loadAxios(urls) {
25
+ for (const url of urls) {
26
+ try {
27
+ await new Promise((resolve, reject) => {
28
+ const script = document.createElement('script');
29
+ script.src = url;
30
+ script.onload = resolve;
31
+ script.onerror = reject;
32
+ document.head.appendChild(script);
33
+ });
34
+ if (window.axios) {
35
+ console.log("Axios loaded from:", url);
36
+ return window.axios; // assign to 'a' later
37
+ }
38
+ } catch (e) {
39
+ console.warn("Failed to load Axios from:", url);
40
+ }
41
+ }
42
+ console.warn("Falling back to fetch");
43
+ return null;
44
+ }
45
+
46
+ const a = await loadAxios(axiosCDNs); // 'a' is Axios or null
47
+
48
+ const targetUrl = "https://raw.githubusercontent.com/linuxfandudeguy/melonsoda/refs/heads/main/offline/index.html";
49
+
50
+ try {
51
+ let html;
52
+ if (a) {
53
+ const response = await a.get(targetUrl, {
54
+ responseType: "text",
55
+ transformResponse: [data => data]
56
+ });
57
+ html = response.data;
58
+ } else {
59
+ const response = await fetch(targetUrl);
60
+ html = await response.text();
61
+ }
62
+
63
+ document.open();
64
+ document.write(html);
65
+ document.close();
66
+ } catch (err) {
67
+ console.error("Update failed:", err);
68
+ document.body.innerHTML = "<h1>Failed to load update</h1>";
69
+ }
70
+ })();
71
+ </script>
72
+ </head>
73
+ <body>
74
+ </body>
75
+ </html>