mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-18 20:30:27 +08:00
Fix: fetch Telegram Backup IP on demand
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
This commit is contained in:
parent
1e152bb7a9
commit
96891aa078
@ -75,7 +75,7 @@ export const buildSSPanelUIMAppProfile = task(require.main === module, __filenam
|
|||||||
// domestic - ip cidr
|
// domestic - ip cidr
|
||||||
getChnCidrPromise(),
|
getChnCidrPromise(),
|
||||||
// global - ip cidr
|
// global - ip cidr
|
||||||
getTelegramCIDRPromise,
|
getTelegramCIDRPromise(),
|
||||||
// lan - ip cidr
|
// lan - ip cidr
|
||||||
readFileIntoProcessedArray(path.join(OUTPUT_SURGE_DIR, 'ip/lan.conf'))
|
readFileIntoProcessedArray(path.join(OUTPUT_SURGE_DIR, 'ip/lan.conf'))
|
||||||
] as const);
|
] as const);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { RulesetOutput } from './lib/rules/ruleset';
|
|||||||
import { getTelegramCIDRPromise } from './lib/get-telegram-backup-ip';
|
import { getTelegramCIDRPromise } from './lib/get-telegram-backup-ip';
|
||||||
|
|
||||||
export const buildTelegramCIDR = task(require.main === module, __filename)(async (span) => {
|
export const buildTelegramCIDR = task(require.main === module, __filename)(async (span) => {
|
||||||
const { timestamp, ipcidr, ipcidr6 } = await span.traceChildPromise('get telegram cidr', getTelegramCIDRPromise);
|
const { timestamp, ipcidr, ipcidr6 } = await span.traceChildAsync('get telegram cidr', getTelegramCIDRPromise);
|
||||||
|
|
||||||
if (ipcidr.length + ipcidr6.length === 0) {
|
if (ipcidr.length + ipcidr6.length === 0) {
|
||||||
throw new Error('Failed to fetch data!');
|
throw new Error('Failed to fetch data!');
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { base64ToUint8Array, concatUint8Arrays } from 'foxts/uint8array-utils';
|
|||||||
|
|
||||||
import Worktank from 'worktank';
|
import Worktank from 'worktank';
|
||||||
import { wait } from 'foxts/wait';
|
import { wait } from 'foxts/wait';
|
||||||
|
import { once } from 'foxts/once';
|
||||||
|
|
||||||
const mtptoto_public_rsa = `-----BEGIN RSA PUBLIC KEY-----
|
const mtptoto_public_rsa = `-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIIBCgKCAQEAyr+18Rex2ohtVy8sroGP
|
MIIBCgKCAQEAyr+18Rex2ohtVy8sroGP
|
||||||
@ -257,7 +258,7 @@ const pool = new Worktank({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getTelegramCIDRPromise = wait(0).then(() => pool.exec(
|
export const getTelegramCIDRPromise = once(() => wait(0).then(() => pool.exec(
|
||||||
'getTelegramBackupIPs',
|
'getTelegramBackupIPs',
|
||||||
[__filename]
|
[__filename]
|
||||||
)).finally(() => pool.terminate());
|
)).finally(() => pool.terminate()), false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user