feat(rulesets): add Twitch preset and resilient CDN fallback
This commit is contained in:
@@ -46,6 +46,13 @@ assert(url.github_to_jsdelivr("https://raw.githubusercontent.com/owner/repo/main
|
||||
let candidates = url.download_candidates("https://github.com/owner/repo/blob/main/hosts");
|
||||
assert(candidates[0] == "https://raw.githubusercontent.com/owner/repo/main/hosts", "download_candidates first entry normalized");
|
||||
|
||||
let twitch_candidates = url.download_candidates("https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/twitch.srs");
|
||||
assert(twitch_candidates[0] == "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/twitch.srs", "twitch candidate 0 is raw github");
|
||||
assert(twitch_candidates[1] == "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/twitch.srs", "twitch candidate 1 is jsdelivr cdn");
|
||||
for (let c in twitch_candidates) {
|
||||
assert(index(c, "forkop") < 0, "no forkop mirrors allowed");
|
||||
}
|
||||
|
||||
// authority, host, port, userinfo with @ in query parameters
|
||||
let complex = "vless://user-uuid@example.com:8443?authority=name@channel&mode=gun#my-fragment";
|
||||
assert(url.authority(complex) == "example.com:8443", "authority strips userinfo and query with @");
|
||||
|
||||
@@ -47,6 +47,10 @@ assert_eq binary \
|
||||
|
||||
ucode -L "$TACHYON_LIB" -e 'let rulesets = require("singbox.rulesets"); if (rulesets.kind_from_reference_hint("geoip") != "subnets") exit(1);'
|
||||
ucode -L "$TACHYON_LIB" -e 'let rulesets = require("singbox.rulesets"); if (type(rulesets.COMMUNITY_SERVICES) != "object" || !rulesets.COMMUNITY_SERVICES.discord) exit(1);'
|
||||
ucode -L "$TACHYON_LIB" -e 'let rulesets = require("singbox.rulesets"); if (!rulesets.COMMUNITY_SERVICES.twitch) exit(1);'
|
||||
assert_eq "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/twitch.srs" \
|
||||
"$(ucode -L "$TACHYON_LIB" -e 'let rulesets = require("singbox.rulesets"); print(rulesets.community_url("twitch"));')" \
|
||||
"twitch community ruleset url"
|
||||
|
||||
printf 'singbox rulesets checks passed\n'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user