mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Update CDN Hosts
This commit is contained in:
parent
573c0f5274
commit
6e839279cf
@ -8,7 +8,7 @@ const { Readable } = require('stream');
|
|||||||
const { pipeline } = require('stream/promises');
|
const { pipeline } = require('stream/promises');
|
||||||
const { readFileByLine } = require('./lib/fetch-remote-text-by-line');
|
const { readFileByLine } = require('./lib/fetch-remote-text-by-line');
|
||||||
const { isCI } = require('ci-info');
|
const { isCI } = require('ci-info');
|
||||||
const { task } = require('./lib/trace-runner');
|
const { task, traceAsync } = require('./lib/trace-runner');
|
||||||
|
|
||||||
const fileExists = (path) => {
|
const fileExists = (path) => {
|
||||||
return fs.promises.access(path, fs.constants.F_OK)
|
return fs.promises.access(path, fs.constants.F_OK)
|
||||||
@ -31,7 +31,7 @@ const downloadPreviousBuild = task(__filename, async () => {
|
|||||||
line.startsWith('Modules/')
|
line.startsWith('Modules/')
|
||||||
) && !line.endsWith('/')
|
) && !line.endsWith('/')
|
||||||
) {
|
) {
|
||||||
allFileExists = await fileExists(join(__dirname, '..', line));
|
allFileExists = fs.existsSync(join(__dirname, '..', line));
|
||||||
filesList.push(line);
|
filesList.push(line);
|
||||||
|
|
||||||
if (!allFileExists) {
|
if (!allFileExists) {
|
||||||
@ -47,35 +47,40 @@ const downloadPreviousBuild = task(__filename, async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Download previous build.');
|
|
||||||
|
|
||||||
const extractedPath = join(tmpdir(), `sukka-surge-last-build-extracted-${Date.now()}`);
|
const extractedPath = join(tmpdir(), `sukka-surge-last-build-extracted-${Date.now()}`);
|
||||||
|
|
||||||
const [resp] = await Promise.all([
|
await traceAsync(
|
||||||
fetch('https://codeload.github.com/sukkaw/surge/tar.gz/gh-pages'),
|
'Download and extract previous build',
|
||||||
fse.ensureDir(extractedPath)
|
() => Promise.all([
|
||||||
]);
|
fetch('https://codeload.github.com/sukkaw/surge/tar.gz/gh-pages'),
|
||||||
|
fse.ensureDir(extractedPath)
|
||||||
await pipeline(
|
]).then(([resp]) => pipeline(
|
||||||
Readable.fromWeb(resp.body),
|
Readable.fromWeb(resp.body),
|
||||||
tar.x({
|
tar.x({
|
||||||
cwd: extractedPath,
|
cwd: extractedPath,
|
||||||
filter(p) {
|
filter(p) {
|
||||||
const dir = p.split('/')[1];
|
const dir = p.split('/')[1];
|
||||||
return dir === 'List' || dir === 'Modules' || dir === 'Clash';
|
return dir === 'List' || dir === 'Modules' || dir === 'Clash';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('Files list:', filesList);
|
||||||
|
|
||||||
await Promise.all(filesList.map(async p => {
|
await Promise.all(filesList.map(async p => {
|
||||||
const src = join(extractedPath, 'Surge-gh-pages', p);
|
const src = join(extractedPath, 'Surge-gh-pages', p);
|
||||||
if (await fileExists(src)) {
|
if (await fileExists(src)) {
|
||||||
|
const dst = join(__dirname, '..', p);
|
||||||
|
console.log('Copy', { src, dst });
|
||||||
return fse.copy(
|
return fse.copy(
|
||||||
src,
|
src,
|
||||||
join(__dirname, '..', p),
|
join(__dirname, '..', p),
|
||||||
{ overwrite: true }
|
{ overwrite: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('File not exists:', src);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await fs.promises.unlink(extractedPath).catch(() => { });
|
await fs.promises.unlink(extractedPath).catch(() => { });
|
||||||
|
|||||||
@ -362,6 +362,7 @@ embed-ssl.wistia.com
|
|||||||
.alonestreaming.com
|
.alonestreaming.com
|
||||||
.thisiscdn.com
|
.thisiscdn.com
|
||||||
cdn.vidible.tv
|
cdn.vidible.tv
|
||||||
|
.video-cdn.net
|
||||||
# vimeo
|
# vimeo
|
||||||
player.vimeo.com
|
player.vimeo.com
|
||||||
.vimeocdn.com
|
.vimeocdn.com
|
||||||
@ -658,6 +659,7 @@ player-frontend.cnevids.com
|
|||||||
w.chatlio.com
|
w.chatlio.com
|
||||||
snippet.maze.co
|
snippet.maze.co
|
||||||
.transcend-cdn.com
|
.transcend-cdn.com
|
||||||
|
imgssl.constantcontact.com
|
||||||
|
|
||||||
c.navattic.com
|
c.navattic.com
|
||||||
js.navattic.com
|
js.navattic.com
|
||||||
@ -929,6 +931,8 @@ assets.video.yahoo.net
|
|||||||
yep.video.yahoo.com
|
yep.video.yahoo.com
|
||||||
# CookieLaw
|
# CookieLaw
|
||||||
.cdn.cookielaw.org
|
.cdn.cookielaw.org
|
||||||
|
# CookieBot
|
||||||
|
cookie-cdn.cookiepro.com
|
||||||
# Cloudflare
|
# Cloudflare
|
||||||
static.dash.cloudflare.com
|
static.dash.cloudflare.com
|
||||||
info.cloudflare.com
|
info.cloudflare.com
|
||||||
@ -969,6 +973,7 @@ steamcdn-a.akamaihd.net
|
|||||||
# TikTok
|
# TikTok
|
||||||
.ibytedtos.com
|
.ibytedtos.com
|
||||||
.bytedapm.com
|
.bytedapm.com
|
||||||
|
.ttwstatic.com
|
||||||
# eBay
|
# eBay
|
||||||
.ebayimg.com
|
.ebayimg.com
|
||||||
.ebaystatic.com
|
.ebaystatic.com
|
||||||
@ -1517,6 +1522,12 @@ images.idgesg.net
|
|||||||
.staticworld.net
|
.staticworld.net
|
||||||
# Indiegogo
|
# Indiegogo
|
||||||
.iggcdn.com
|
.iggcdn.com
|
||||||
|
# dynamicyield.com
|
||||||
|
static.dynamicyield.com
|
||||||
|
st.dynamicyield.com
|
||||||
|
st-eu.dynamicyield.com
|
||||||
|
cdn.dynamicyield.com
|
||||||
|
cdn-eu.dynamicyield.com
|
||||||
# Others
|
# Others
|
||||||
api.mintlify.com
|
api.mintlify.com
|
||||||
content-prod-live.cert.starbucks.com
|
content-prod-live.cert.starbucks.com
|
||||||
@ -1858,3 +1869,7 @@ assets.dnsfilter.com
|
|||||||
images.emojiterra.com
|
images.emojiterra.com
|
||||||
cdn.osxdaily.com
|
cdn.osxdaily.com
|
||||||
user-uploads.perchance.org
|
user-uploads.perchance.org
|
||||||
|
img.riskified.com
|
||||||
|
cdn.pathfactory.com
|
||||||
|
cdn-app.pathfactory.com
|
||||||
|
.prcdn.co
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user