Skip to content

Commit

Permalink
Changed fallback.
Browse files Browse the repository at this point in the history
  • Loading branch information
bia-pain-bache committed Dec 8, 2024
1 parent c5f5a38 commit 657d674
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function handlePanel(request, env) {

export async function fallback(request) {
const url = new URL(request.url);
url.hostname = 'www.speedtest.net';
url.hostname = 'speed.cloudflare.com';
url.protocol = 'https:';
request = new Request(url, request);
return await fetch(request);
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ export function initializeParams(request, env) {
const proxyIPs = env.PROXYIP?.split(',').map(proxyIP => proxyIP.trim());
const url = new URL(request.url);
const searchParams = new URLSearchParams(url.search);
globalThis.panelVersion = '2.7.8';
globalThis.panelVersion = '2.7.9';
globalThis.defaultHttpPorts = ['80', '8080', '2052', '2082', '2086', '2095', '8880'];
globalThis.defaultHttpsPorts = ['443', '8443', '2053', '2083', '2087', '2096'];
globalThis.userID = env.UUID;
globalThis.trojanPassword = env.TROJAN_PASS;
globalThis.proxyIP = proxyIPs ? proxyIPs[Math.floor(Math.random() * proxyIPs.length)] : 'bpb.yousef.isegaro.com';
globalThis.proxyIP = proxyIPs ? proxyIPs[Math.floor(Math.random() * proxyIPs.length)] : atob('YnBiLnlvdXNlZi5pc2VnYXJvLmNvbQ==');
globalThis.hostName = request.headers.get('Host');
globalThis.pathName = url.pathname;
globalThis.client = searchParams.get('app');
globalThis.urlOrigin = url.origin;
globalThis.dohURL = env.DOH_URL || 'https://cloudflare-dns.com/dns-query';
if (pathName !== '/secrets') {
if (typeof env.bpb !== 'object') throw new Error('KV Dataset is not properly set! Please refer to tutorials.', { cause: "init"});
if (!userID || !trojanPassword) throw new Error(`Please set UUID and Trojan password first. Please go to 🟢 https://${hostName}/secrets 🟢 to generate them.`, { cause: "init"});
if (userID && !isValidUUID(userID)) throw new Error(`Invalid UUID: ${userID}`, { cause: "init"});
if (typeof env.bpb !== 'object') throw new Error('KV Dataset is not properly set! Please refer to tutorials.', { cause: "init"});
}
}

0 comments on commit 657d674

Please sign in to comment.