mirror of
https://gitlab.com/SukkaW/ruleset.skk.moe.git
synced 2026-01-02 02:20:24 +00:00
deploy: d5f0f2428ff4448ec4df8b0be64a26109def1840
This commit is contained in:
@@ -85,7 +85,13 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
|
||||
(await Promise.all([
|
||||
// Easy List
|
||||
'https://easylist.to/easylist/easylist.txt',
|
||||
[
|
||||
'https://easylist.to/easylist/easylist.txt',
|
||||
[
|
||||
'https://easylist-downloads.adblockplus.org/easylist.txt',
|
||||
'https://secure.fanboy.co.nz/easylist.txt'
|
||||
]
|
||||
],
|
||||
// AdGuard DNS Filter
|
||||
'https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt',
|
||||
// uBlock Origin Filter List
|
||||
@@ -112,7 +118,13 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
// AdGuard Chinese filter (EasyList China + AdGuard Chinese filter)
|
||||
'https://filters.adtidy.org/extension/ublock/filters/224.txt',
|
||||
// Easy Privacy
|
||||
'https://easylist.to/easylist/easyprivacy.txt',
|
||||
[
|
||||
'https://easylist.to/easylist/easyprivacy.txt',
|
||||
[
|
||||
'https://secure.fanboy.co.nz/easyprivacy.txt',
|
||||
'https://easylist-downloads.adblockplus.org/easyprivacy.txt'
|
||||
]
|
||||
],
|
||||
// Curben's Malware Online UrlHaus
|
||||
'https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh-online.txt',
|
||||
// Curben's Phishing Online Filter
|
||||
@@ -123,7 +135,14 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
'https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt',
|
||||
// PiHoleBlocklist
|
||||
'https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt',
|
||||
].map(processFilterRules))).forEach(({ white, black }) => {
|
||||
].map(input => {
|
||||
if (typeof input === 'string') {
|
||||
return processFilterRules(input);
|
||||
}
|
||||
if (Array.isArray(input) && input.length === 2) {
|
||||
return processFilterRules(input[0], input[1]);
|
||||
}
|
||||
}))).forEach(({ white, black }) => {
|
||||
white.forEach(i => filterRuleWhitelistDomainSets.add(i));
|
||||
black.forEach(i => domainSets.add(i));
|
||||
});
|
||||
|
||||
@@ -92,9 +92,12 @@ async function processHosts (hostsUrl, includeAllSubDomain = false) {
|
||||
|
||||
/**
|
||||
* @param {string | URL} filterRulesUrl
|
||||
* @param {(string | URL)[] | undefined} fallbackUrls
|
||||
* @returns {Promise<{ white: Set<string>, black: Set<string> }>}
|
||||
*/
|
||||
async function processFilterRules (filterRulesUrl) {
|
||||
async function processFilterRules (filterRulesUrl, fallbackUrls) {
|
||||
console.time(`processFilterRules: ${filterRulesUrl}`);
|
||||
|
||||
if (typeof filterRulesUrl === 'string') {
|
||||
filterRulesUrl = new URL(filterRulesUrl);
|
||||
}
|
||||
@@ -105,7 +108,13 @@ async function processFilterRules (filterRulesUrl) {
|
||||
const blacklistDomainSets = new Set();
|
||||
|
||||
/** @type string[] */
|
||||
const filterRules = (await (await fetchWithRetry(filterRulesUrl)).text()).split('\n').map(line => line.trim());
|
||||
const filterRules = (
|
||||
await Promise.any(
|
||||
[filterRulesUrl, ...(fallbackUrls || [])].map(
|
||||
async url => (await fetchWithRetry(url)).text()
|
||||
)
|
||||
)
|
||||
).split('\n').map(line => line.trim());
|
||||
|
||||
filterRules.forEach(line => {
|
||||
const lineStartsWithDoubleVerticalBar = line.startsWith('||');
|
||||
@@ -197,6 +206,8 @@ async function processFilterRules (filterRulesUrl) {
|
||||
}
|
||||
});
|
||||
|
||||
console.timeEnd(`processFilterRules: ${filterRulesUrl}`);
|
||||
|
||||
return {
|
||||
white: whitelistDomainSets,
|
||||
black: blacklistDomainSets
|
||||
|
||||
@@ -12,6 +12,9 @@ cdnjs.cloudflare.com
|
||||
.rawgit.com
|
||||
.rawgit.org
|
||||
.gitcdn.xyz
|
||||
.githack.com
|
||||
.gitcdn.top
|
||||
.gitcdn.link
|
||||
.bootstrapcdn.com
|
||||
twemoji.maxcdn.com
|
||||
code.jquery.com
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<main class="container">
|
||||
<h1>Sukka Surge Ruleset Server</h1>
|
||||
<p>Made by <a href="https://skk.moe">Sukka</a> | <a href="https://github.com/SukkaW/Surge/">Source @ GitHub</a> | Licensed under <a href="https://github.com/SukkaW/Surge/blob/master/LICENSE" target="_blank">AGPL-3.0</a></p>
|
||||
<p>Last Updated: 2022-09-22T13:58:25.451Z</p>
|
||||
<p>Last Updated: 2022-09-22T14:49:19.968Z</p>
|
||||
<hr>
|
||||
<br>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user