Skip to content

Commit 9b59fa5

Browse files
authored
Add async function to process relay steps
1 parent f32c4f8 commit 9b59fa5

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

bypass/bypass.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1+
async function processStep(currentUrl, step) {
2+
const logBox = document.getElementById('log');
3+
logBox.innerHTML += `<div class="relay-status">[STEP ${step}] Querying Relay Engine...</div>`;
14

5+
// Switch to the updated Bypass.city endpoint which is currently the most reliable for PlatoRelay
6+
const apiEndpoint = `https://api.bypass.city/bypass?url=${encodeURIComponent(currentUrl)}`;
7+
8+
// Maintain your recommended CORS Proxy format
9+
const proxiedUrl = `https://corsproxy.io/?url=${encodeURIComponent(apiEndpoint)}`;
10+
11+
try {
12+
const response = await fetch(proxiedUrl, {
13+
method: 'GET',
14+
headers: {
15+
'Accept': 'application/json',
16+
// This header sometimes helps engines bypass the 'Bot' check
17+
'X-Requested-With': 'XMLHttpRequest'
18+
}
19+
});
20+
21+
// If the proxy returns a 404 or the API is down, response.ok will be false
22+
if (!response.ok) {
23+
throw new Error(`HTTP_${response.status}: Engine endpoint moved or offline.`);
24+
}
25+
26+
const data = await response.json();
27+
28+
// Bypass.city returns 'destination' or 'result'
29+
const finalUrl = data.destination || data.result || (data.query && data.query.destination);
30+
31+
if (finalUrl) {
32+
// PlatoRelay/Auth links often require 2-3 steps
33+
if (finalUrl.includes("auth.platorelay") || finalUrl.includes("checkpoint")) {
34+
logBox.innerHTML += `<div class="relay-status">[WAIT] Relay handshake in progress. Retrying step...</div>`;
35+
// 3 second delay to prevent 'Too Many Requests' errors
36+
setTimeout(() => processStep(finalUrl, step + 1), 3000);
37+
} else {
38+
logBox.innerHTML += `<div style="color:var(--success)">[DONE] Sequence complete. Link Decrypted.</div>`;
39+
logBox.innerHTML += `<a href="${finalUrl}" target="_blank" class="final-link">${finalUrl}</a>`;
40+
}
41+
} else {
42+
logBox.innerHTML += `<div style="color:#f85149">[ERR] Engine returned invalid data.</div>`;
43+
}
44+
} catch (e) {
45+
logBox.innerHTML += `<div style="color:#f85149">[FATAL] ${e.message}</div>`;
46+
logBox.innerHTML += `<div style="font-size:10px; color:#8b949e;">Try refreshing the original link before pasting.</div>`;
47+
}
48+
}

0 commit comments

Comments
 (0)