Refine LuCI download and rule set settings
This commit is contained in:
@@ -47,7 +47,9 @@ const fixture = {
|
||||
domain: [ 'Example.COM' ],
|
||||
domain_keyword_text_mode: '1',
|
||||
domain_keyword_text: 'Video, Stream # comment',
|
||||
domain_regex_text: '^api[.]example$, ^cdn[.]example$'
|
||||
domain_regex_text: '^api[.]example$, ^cdn[.]example$',
|
||||
rule_set: [ 'https://example.com/domains.srs' ],
|
||||
rule_set_with_subnets: [ 'https://example.com/mixed.srs' ]
|
||||
}
|
||||
],
|
||||
section: [
|
||||
@@ -143,6 +145,7 @@ assert(config.settings.update_interval === '1d', 'missing update_interval should
|
||||
assert(config.settings.download_lists_via_proxy === '1', 'download_lists_via_proxy should be preserved');
|
||||
assert(config.settings.download_components_via_proxy === '1', 'download_components_via_proxy should be copied');
|
||||
assert(config.settings.download_lists_via_proxy_section === 'legacy-urltest', 'download section should be preserved for lists/components');
|
||||
assert(config.settings.download_components_via_proxy_section === 'legacy-urltest', 'component download section should be migrated from the legacy common selector');
|
||||
absent(config.settings, 'download_subscriptions_via_proxy', 'settings');
|
||||
absent(config.settings, 'routing_excluded_ips', 'settings');
|
||||
|
||||
@@ -156,6 +159,8 @@ assert(legacyUrl.domain_suffix.includes('keyword:Video'), 'keyword migrated');
|
||||
assert(legacyUrl.domain_suffix.includes('keyword:Stream'), 'keyword comment stripped');
|
||||
assert(legacyUrl.domain_suffix.includes('regex:^api[.]example$'), 'regex migrated');
|
||||
assert(legacyUrl.domain_suffix.includes('regex:^cdn[.]example$'), 'second regex migrated');
|
||||
const legacyUrlRuleSetSettings = JSON.parse(legacyUrl.rule_set_settings);
|
||||
assert(legacyUrlRuleSetSettings['https://example.com/mixed.srs'].include_subnets === '1', 'rule set subnet setting migrated');
|
||||
absent(legacyUrl, 'proxy_string', 'legacy-url');
|
||||
absent(legacyUrl, 'proxy_config_type', 'legacy-url');
|
||||
absent(legacyUrl, 'connection_type', 'legacy-url');
|
||||
|
||||
@@ -386,7 +386,8 @@ cat >"$WORK_DIR/download-via-proxy-fixture.json" <<'JSON'
|
||||
"download_lists_via_proxy": "1",
|
||||
"download_subscriptions_via_proxy": "1",
|
||||
"download_components_via_proxy": "1",
|
||||
"download_lists_via_proxy_section": "proxy"
|
||||
"download_lists_via_proxy_section": "proxy",
|
||||
"download_components_via_proxy_section": "components_proxy"
|
||||
},
|
||||
"section": [
|
||||
{
|
||||
@@ -397,6 +398,14 @@ cat >"$WORK_DIR/download-via-proxy-fixture.json" <<'JSON'
|
||||
"outbound_json": "{\"type\":\"socks\",\"server\":\"127.0.0.1\",\"server_port\":1080}",
|
||||
"domain_suffix": [ "example.org" ],
|
||||
"rule_set": [ "https://example.com/rules.srs" ]
|
||||
},
|
||||
{
|
||||
".name": "components_proxy",
|
||||
".type": "section",
|
||||
"enabled": "1",
|
||||
"action": "outbound",
|
||||
"outbound_json": "{\"type\":\"socks\",\"server\":\"127.0.0.2\",\"server_port\":1080}",
|
||||
"domain_suffix": [ "components.example" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -817,6 +826,8 @@ assert(dns_rule(vpn, r => contains(r.domain_suffix, "vpn.example")) != null, "re
|
||||
let download = cfg("download");
|
||||
assert(inbound(download, "service-mixed-in") != null, "service mixed inbound");
|
||||
assert(route_rule(download, r => r.inbound == "service-mixed-in" && r.outbound == "proxy-out") != null, "service mixed route");
|
||||
assert(inbound(download, "service-components-in") != null, "components service mixed inbound");
|
||||
assert(route_rule(download, r => r.inbound == "service-components-in" && r.outbound == "components_proxy-out") != null, "components service mixed route");
|
||||
assert(first_remote_ruleset(download).download_detour == "proxy-out", "download_detour on remote ruleset");
|
||||
|
||||
let fully = cfg("fully-routed");
|
||||
|
||||
Reference in New Issue
Block a user