mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Fix: properly build internal cdn rules
This commit is contained in:
parent
9a351b2905
commit
9a6ba02d3e
@ -8,7 +8,7 @@ const { createDomainSorter } = require('./lib/stable-sort-domain');
|
|||||||
const { task } = require('./lib/trace-runner');
|
const { task } = require('./lib/trace-runner');
|
||||||
const { compareAndWriteFile } = require('./lib/create-file');
|
const { compareAndWriteFile } = require('./lib/create-file');
|
||||||
const { getGorhillPublicSuffixPromise } = require('./lib/get-gorhill-publicsuffix');
|
const { getGorhillPublicSuffixPromise } = require('./lib/get-gorhill-publicsuffix');
|
||||||
const { createCachedGorhillGetDomain } = require('./lib/cached-tld-parse');
|
// const { createCachedGorhillGetDomain } = require('./lib/cached-tld-parse');
|
||||||
|
|
||||||
const escapeRegExp = (string = '') => string.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&');
|
const escapeRegExp = (string = '') => string.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&');
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ const buildInternalCDNDomains = task(__filename, async () => {
|
|||||||
const keywords = new Set();
|
const keywords = new Set();
|
||||||
|
|
||||||
const gorhill = await getGorhillPublicSuffixPromise();
|
const gorhill = await getGorhillPublicSuffixPromise();
|
||||||
const getDomain = createCachedGorhillGetDomain(gorhill);
|
|
||||||
const domainSorter = createDomainSorter(gorhill);
|
const domainSorter = createDomainSorter(gorhill);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} input
|
* @param {string} input
|
||||||
*/
|
*/
|
||||||
const addApexDomain = (input) => {
|
const addApexDomain = (input) => {
|
||||||
const d = getDomain(input);
|
// We are including the private domains themselves
|
||||||
|
const d = tldts.getDomain(input, { allowPrivateDomains: false });
|
||||||
if (d) {
|
if (d) {
|
||||||
set.add(d);
|
set.add(d);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user