mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
Update CDN Hosts
This commit is contained in:
parent
aedcddff9f
commit
16bbc886d1
@ -8,6 +8,12 @@ const { Stream, Readable } = require('stream');
|
||||
const { promisify } = require('util');
|
||||
const pipeline = promisify(Stream.pipeline);
|
||||
|
||||
const fileExists = (path) => {
|
||||
return fs.promises.access(path, fs.constants.F_OK)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
};
|
||||
|
||||
(async () => {
|
||||
const filesList = (
|
||||
await fs.promises.readFile(resolve(__dirname, '../.gitignore'), { encoding: 'utf-8' })
|
||||
@ -15,6 +21,11 @@ const pipeline = promisify(Stream.pipeline);
|
||||
.split('\n')
|
||||
.filter(p => p.startsWith('List/'));
|
||||
|
||||
if (
|
||||
(await Promise.all(
|
||||
filesList.map(p => fileExists(join(__dirname, '..', p)))
|
||||
)).some(exist => !exist)
|
||||
) {
|
||||
const tempFile = join(tmpdir(), `sukka-surge-last-build-tar-${Date.now()}`);
|
||||
const resp = await fetch('https://codeload.github.com/sukkaw/surge/tar.gz/gh-pages');
|
||||
const readableNodeStream = Readable.fromWeb(resp.body);
|
||||
@ -43,4 +54,7 @@ const pipeline = promisify(Stream.pipeline);
|
||||
|
||||
await fs.promises.unlink(tempFile).catch(() => { });
|
||||
await fs.promises.unlink(extractedPath).catch(() => { });
|
||||
} else {
|
||||
console.log('All files exists, skip download.');
|
||||
}
|
||||
})();
|
||||
|
||||
@ -878,6 +878,10 @@ static-cdn.mastodon.social
|
||||
.wsimg.com
|
||||
# SurveyMonkey
|
||||
.smassets.net
|
||||
# Envato
|
||||
.envato-static.com
|
||||
.envatousercontent.com
|
||||
s3.envato.com
|
||||
# Others
|
||||
.yelpcdn.com
|
||||
cf-images.us-east-1.prod.boltdns.net
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
.nitro.download
|
||||
.download.mokeedev.com
|
||||
|
||||
get.pixelexperience.org
|
||||
download.pixelexperience.org
|
||||
|
||||
# >> MEGA
|
||||
|
||||
.mega.nz
|
||||
|
||||
@ -52,7 +52,10 @@
|
||||
]
|
||||
},
|
||||
"build:telegram-cidr": {
|
||||
"command": "node ./Build/build-telegram-cidr.js"
|
||||
"command": "node ./Build/build-telegram-cidr.js",
|
||||
"dependencies": [
|
||||
"download-previous-build"
|
||||
]
|
||||
},
|
||||
"build:chn-cidr": {
|
||||
"command": "node ./Build/build-chn-cidr.js",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user