mirror of
https://gitlab.com/SukkaW/ruleset.skk.moe.git
synced 2026-01-09 05:50:27 +00:00
deploy: c91d22b2d323735b58052af2436b68955cd34e18
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const { promises: fsPromises } = require('fs');
|
||||
const { resolve: pathResolve } = require('path');
|
||||
const Piscina = require('piscina');
|
||||
const { processHosts, processFilterRules } = require('./lib/parse-filter');
|
||||
const { processHosts, processFilterRules, preprocessFullDomainSetBeforeUsedAsWorkerData } = require('./lib/parse-filter');
|
||||
const cpuCount = require('os').cpus().length;
|
||||
const { isCI } = require('ci-info');
|
||||
const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
@@ -68,6 +68,7 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
'ip6-allrouters',
|
||||
'ip6-allhosts',
|
||||
'mcastprefix',
|
||||
'skk.moe',
|
||||
'analytics.google.com',
|
||||
'msa.cdn.mediaset.net', // Added manually using DOMAIN-KEYWORDS
|
||||
'cloud.answerhub.com',
|
||||
@@ -145,6 +146,8 @@ 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',
|
||||
// Spam404
|
||||
'https://raw.githubusercontent.com/Spam404/lists/master/adblock-list.txt'
|
||||
].map(input => {
|
||||
if (typeof input === 'string') {
|
||||
return processFilterRules(input);
|
||||
@@ -233,7 +236,7 @@ const threads = isCI ? cpuCount : cpuCount / 2;
|
||||
|
||||
const piscina = new Piscina({
|
||||
filename: pathResolve(__dirname, 'worker/build-reject-domainset-worker.js'),
|
||||
workerData: [...domainSets],
|
||||
workerData: preprocessFullDomainSetBeforeUsedAsWorkerData([...domainSets]),
|
||||
idleTimeout: 50,
|
||||
minThreads: threads,
|
||||
maxThreads: threads
|
||||
|
||||
@@ -125,6 +125,7 @@ async function processFilterRules (filterRulesUrl, fallbackUrls) {
|
||||
|| line.includes('!')
|
||||
|| line.includes('*')
|
||||
|| line.includes('/')
|
||||
|| line.includes('[')
|
||||
|| line.includes('$') && !lineStartsWithDoubleVerticalBar
|
||||
|| line === ''
|
||||
|| isIP(line) !== 0
|
||||
@@ -214,6 +215,28 @@ async function processFilterRules (filterRulesUrl, fallbackUrls) {
|
||||
};
|
||||
}
|
||||
|
||||
function preprocessFullDomainSetBeforeUsedAsWorkerData (data) {
|
||||
return data.filter(domain => (
|
||||
domain.charCodeAt(0) === 46
|
||||
&& !canExcludeFromDedupe(domain)
|
||||
));
|
||||
}
|
||||
|
||||
// duckdns.org domain will not overlap and doesn't need dedupe
|
||||
function canExcludeFromDedupe (domain) {
|
||||
if (
|
||||
// starts with a dot
|
||||
domain.charCodeAt(0) === 46
|
||||
&& domain.length === 23
|
||||
&& domain.endsWith('.duckdns.org')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports.processDomainLists = processDomainLists;
|
||||
module.exports.processHosts = processHosts;
|
||||
module.exports.processFilterRules = processFilterRules;
|
||||
module.exports.preprocessFullDomainSetBeforeUsedAsWorkerData = preprocessFullDomainSetBeforeUsedAsWorkerData;
|
||||
module.exports.canExcludeFromDedupe = canExcludeFromDedupe;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
const Piscina = require('piscina');
|
||||
// pre check if fullset domain is starts with a "."
|
||||
// This avoid calling chatCodeAt repeatedly
|
||||
const { canExcludeFromDedupe } = require('../lib/parse-filter')
|
||||
|
||||
// workerData is an array of string. Sort it by length, short first:
|
||||
const fullsetDomainStartsWithADot = Piscina.workerData.filter(domain => (
|
||||
domain.charCodeAt(0) === 46
|
||||
&& !canExcludeFromDedupe(domain)
|
||||
));
|
||||
// workerData is an array of string, sorted by length, short first
|
||||
const fullsetDomainStartsWithADot = Piscina.workerData
|
||||
const totalLen = fullsetDomainStartsWithADot.length;
|
||||
|
||||
module.exports.dedupe = ({ chunk }) => {
|
||||
@@ -60,13 +58,5 @@ module.exports.dedupe = ({ chunk }) => {
|
||||
}
|
||||
}
|
||||
|
||||
return outputToBeRemoved;
|
||||
return Piscina.move(outputToBeRemoved);
|
||||
};
|
||||
|
||||
// duckdns.org domain will not overlap and doesn't need dedupe
|
||||
function canExcludeFromDedupe (domain) {
|
||||
if (domain.length === 23 && domain.endsWith('.duckdns.org')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,8 @@ spcdn.incartupsell.com
|
||||
.adtidy.org
|
||||
.disconnect.me
|
||||
.easylist.to
|
||||
secure.fanboy.co.nz
|
||||
easylist-downloads.adblockplus.org
|
||||
|
||||
# >> 1Password
|
||||
.1passwordusercontent.com
|
||||
@@ -793,3 +795,5 @@ static.bit.dev
|
||||
assets.bwbx.io
|
||||
images.g2crowd.com
|
||||
.anpoimages.com
|
||||
kdata1.com
|
||||
img.kbhgames.com
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
############################
|
||||
# Mainland China IPv4 CIDR
|
||||
# Data from misaka.io (misakaio @ GitHub)
|
||||
# Last Updated: 2022-10-07T12:52:14.656Z
|
||||
# Last Updated: 2022-10-08T09:50:57.203Z
|
||||
# Routes: 4238
|
||||
############################
|
||||
IP-CIDR,1.2.4.0/24
|
||||
@@ -631,7 +631,7 @@ IP-CIDR,59.81.86.0/23
|
||||
IP-CIDR,59.81.88.0/23
|
||||
IP-CIDR,59.81.92.0/22
|
||||
IP-CIDR,59.81.98.0/23
|
||||
IP-CIDR,59.81.100.0/22
|
||||
IP-CIDR,59.81.102.0/23
|
||||
IP-CIDR,59.81.104.0/22
|
||||
IP-CIDR,59.82.0.0/18
|
||||
IP-CIDR,59.82.64.0/19
|
||||
@@ -2693,6 +2693,7 @@ IP-CIDR,171.112.0.0/12
|
||||
IP-CIDR,171.208.0.0/12
|
||||
IP-CIDR,172.81.192.0/18
|
||||
IP-CIDR,173.39.200.0/23
|
||||
IP-CIDR,173.214.64.0/24
|
||||
IP-CIDR,173.214.106.0/23
|
||||
IP-CIDR,175.0.0.0/12
|
||||
IP-CIDR,175.16.0.0/13
|
||||
@@ -2843,7 +2844,6 @@ IP-CIDR,193.17.120.0/22
|
||||
IP-CIDR,193.112.0.0/16
|
||||
IP-CIDR,194.138.202.0/23
|
||||
IP-CIDR,194.138.245.0/24
|
||||
IP-CIDR,194.246.96.0/24
|
||||
IP-CIDR,198.133.199.0/24
|
||||
IP-CIDR,198.153.192.0/24
|
||||
IP-CIDR,198.153.194.0/24
|
||||
|
||||
@@ -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-10-07T12:54:02.227Z</p>
|
||||
<p>Last Updated: 2022-10-08T09:53:00.481Z</p>
|
||||
<hr>
|
||||
<br>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user