Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
bia-pain-bache committed Dec 13, 2024
2 parents 80b7180 + 43e1af4 commit becb1f8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build project
run: |
npx wrangler deploy src/worker.js --name bpb-worker-panel --compatibility-flag [nodejs_compat] --compatibility-date 2024-10-26 --dry-run --outdir=dist
npx javascript-obfuscator dist/worker.js --output _worker.js
npx javascript-obfuscator --split-strings true --split-strings-chunk-length 2 dist/worker.js --output _worker.js
- name: Commit and push built worker
run: |
Expand Down
2 changes: 1 addition & 1 deletion _worker.js

Large diffs are not rendered by default.

Binary file modified docs/assets/images/Panel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
8 changes: 4 additions & 4 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.8.1';
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 || !trojanPassword) throw new Error(`Please set UUID and Trojan password first. Please visit <a href="https://${hostName}/secrets" target="_blank">here</a> 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"});
}
}
4 changes: 2 additions & 2 deletions src/kv/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export async function updateDataset (request, env) {
throw new Error(`An error occurred while getting current KV settings - ${error}`);
}
} else {
await env.bpb.delete('warpConfigs');
newSettings = null;
}

Expand Down Expand Up @@ -115,7 +114,8 @@ export async function updateDataset (request, env) {
};

try {
await env.bpb.put("proxySettings", JSON.stringify(proxySettings));
await env.bpb.put("proxySettings", JSON.stringify(proxySettings));
if (isReset) await updateWarpConfigs(request, env);
} catch (error) {
console.log(error);
throw new Error(`An error occurred while updating KV - ${error}`);
Expand Down

0 comments on commit becb1f8

Please sign in to comment.