@swimmingliu/autovpn 1.6.5 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/doctor/checks.js +17 -2
- package/dist/pipeline/deploy.js +27 -50
- package/dist/pipeline/orchestrator.js +6 -3
- package/dist/runtime/templates.js +37 -0
- package/dist/templates/share-worker/vpn.js +4813 -0
- package/dist/templates/vmess_node.js +27 -0
- package/dist/web/renderer/i18n.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const SUBSCRIPTION_PAYLOAD = `__MAIN_DATA__`;
|
|
2
|
+
|
|
3
|
+
function buildRandomPayload() {
|
|
4
|
+
const randomBytes = new Uint8Array(Math.floor(Math.random() * 100));
|
|
5
|
+
crypto.getRandomValues(randomBytes);
|
|
6
|
+
return String.fromCharCode.apply(null, randomBytes);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function handleSubscriptionRequest(request) {
|
|
10
|
+
try {
|
|
11
|
+
const url = new URL(request.url);
|
|
12
|
+
const secretToken = url.searchParams.get("serect_key");
|
|
13
|
+
const responsePayload = secretToken === "swimmingliu"
|
|
14
|
+
? SUBSCRIPTION_PAYLOAD
|
|
15
|
+
: buildRandomPayload();
|
|
16
|
+
return new Response(btoa(responsePayload));
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.log(error);
|
|
19
|
+
return new Response(error.toString());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
async fetch(request) {
|
|
25
|
+
return handleSubscriptionRequest(request);
|
|
26
|
+
},
|
|
27
|
+
};
|