| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>loading tuff page</title> |
| <style> |
| body { |
| margin: 0; |
| padding: 0; |
| font-family: system-ui, -apple-system, sans-serif; |
| background: #0f0f0f; |
| color: #fff; |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| justify-content: center; |
| height: 100vh; |
| overflow: hidden; |
| } |
| .container { |
| text-align: center; |
| max-width: 620px; |
| padding: 20px; |
| } |
| h1 { |
| font-size: 2rem; |
| margin-bottom: 30px; |
| } |
| .progress-container { |
| width: 100%; |
| height: 32px; |
| background: #222; |
| border-radius: 9999px; |
| overflow: hidden; |
| margin: 20px 0; |
| } |
| .progress-bar { |
| height: 100%; |
| width: 0%; |
| background: linear-gradient(90deg, #00ffcc, #00ccff); |
| transition: width 0.25s ease-out; |
| box-shadow: 0 0 20px #00ffcc; |
| } |
| .status { |
| margin-top: 15px; |
| font-size: 1.15rem; |
| opacity: 0.95; |
| } |
| .log { |
| margin-top: 30px; |
| font-family: monospace; |
| font-size: 0.9rem; |
| text-align: left; |
| background: #111; |
| padding: 15px; |
| border-radius: 8px; |
| max-height: 180px; |
| overflow-y: auto; |
| opacity: 0.75; |
| } |
| #openBtn { |
| margin-top: 30px; |
| padding: 18px 40px; |
| font-size: 1.3rem; |
| background: #00ffcc; |
| color: #000; |
| border: none; |
| border-radius: 12px; |
| cursor: pointer; |
| font-weight: bold; |
| box-shadow: 0 0 25px #00ffcc; |
| display: none; |
| } |
| #openBtn:hover { |
| background: #00ccaa; |
| transform: scale(1.05); |
| } |
| </style> |
| </head> |
| <body> |
| <div class="container"> |
| <h1>fetching the goods... hang tight :)</h1> |
| |
| <div class="progress-container"> |
| <div id="progress" class="progress-bar"></div> |
| </div> |
| |
| <div id="status" class="status">trying direct connection...</div> |
| <div id="log" class="log"></div> |
|
|
| <button id="openBtn">click me</button> |
| </div> |
|
|
| <script> |
| const proxies = [ |
| "", |
| "https://cors-anywhere.herokuapp.com/", |
| "https://api.allorigins.win/raw?url=", |
| "https://r.jina.ai/http/", |
| "https://cors.io/?", |
| "https://api.codetabs.com/v1/proxy/?quest=", |
| "https://cors-proxy.space.z.ai/api/proxy?url=" |
| ]; |
| |
| const targetUrl = "https://raw.githubusercontent.com/Eaglercraft-Archive/Resent-3.8_Patch-0-offline/refs/heads/main/Resent_3.8_Patch-0_Offline_US.html"; |
| |
| function buildUrl(proxy) { |
| const timestamp = "?t=" + Date.now(); |
| if (proxy === "") return targetUrl + timestamp; |
| if (proxy.startsWith("https://cors-anywhere.herokuapp.com/")) return proxy + targetUrl + timestamp; |
| if (proxy.startsWith("https://api.allorigins.win/raw?url=")) { |
| return proxy + encodeURIComponent(targetUrl + timestamp); |
| } |
| if (proxy.startsWith("https://r.jina.ai/http/")) return proxy + targetUrl + timestamp; |
| if (proxy.startsWith("https://cors.io/?")) return proxy + encodeURIComponent(targetUrl + timestamp); |
| return proxy + targetUrl + timestamp; |
| } |
| |
| function log(msg) { |
| const logEl = document.getElementById("log"); |
| logEl.innerHTML += "> " + msg + "<br>"; |
| logEl.scrollTop = logEl.scrollHeight; |
| } |
| |
| function updateProgress(percent) { |
| document.getElementById("progress").style.width = percent + "%"; |
| } |
| |
| function updateStatus(text) { |
| document.getElementById("status").textContent = text; |
| } |
| |
| let currentBlobUrl = null; |
| |
| async function attemptFetchWithProgress(url, useAllOriginsWrapper) { |
| const response = await fetch(url); |
| if (!response.ok) throw new Error(`HTTP ${response.status}`); |
| |
| const contentLength = response.headers.get("content-length"); |
| const total = contentLength ? parseInt(contentLength, 10) : 0; |
| |
| const reader = response.body.getReader(); |
| let received = 0; |
| const chunks = []; |
| |
| while (true) { |
| const { done, value } = await reader.read(); |
| if (done) break; |
| |
| chunks.push(value); |
| received += value.length; |
| |
| if (total > 0) { |
| const percent = Math.floor((received / total) * 95); |
| updateProgress(percent); |
| } else { |
| updateProgress(Math.min(90, 30 + Math.floor(received / 1500))); |
| } |
| } |
| |
| const blob = new Blob(chunks, { type: "text/html" }); |
| let html = await blob.text(); |
| |
| if (useAllOriginsWrapper) { |
| html = JSON.parse(html).contents; |
| } |
| |
| updateProgress(98); |
| return html; |
| } |
| |
| function loadWithProxies() { |
| let index = 0; |
| |
| function tryNext() { |
| if (index >= proxies.length) { |
| updateStatus("all proxies failed... rip :("); |
| log("all attempts failed"); |
| return; |
| } |
| |
| const proxy = proxies[index]; |
| const requestUrl = buildUrl(proxy); |
| const isAllOrigins = proxy.startsWith("https://api.allorigins.win/raw?url="); |
| const proxyName = proxy === "" ? "direct" : (new URL(proxy)).hostname; |
| |
| updateStatus(`trying ${proxyName}...`); |
| log(`attempting via ${proxyName}`); |
| |
| attemptFetchWithProgress(requestUrl, isAllOrigins) |
| .then(html => { |
| log("download complete :)"); |
| updateProgress(100); |
| updateStatus("ready to open!"); |
| |
| |
| const blob = new Blob([html], { type: "text/html" }); |
| currentBlobUrl = URL.createObjectURL(blob); |
| |
| |
| const btn = document.getElementById("openBtn"); |
| btn.style.display = "block"; |
| |
| btn.onclick = () => { |
| if (currentBlobUrl) { |
| window.open(currentBlobUrl, "_blank"); |
| } |
| }; |
| }) |
| .catch(err => { |
| log(`failed via ${proxyName}: ${err.message}`); |
| index++; |
| tryNext(); |
| }); |
| } |
| |
| tryNext(); |
| } |
| |
| window.onload = loadWithProxies; |
| </script> |
| </body> |
| </html> |
|
|