fix(sub): bound what a remote routing profile renders to

Remote routing sources are fetched documents the panel re-renders on
every subscription request. A Clash YAML document stays small through
aliases, which decode to one shared value but are written out in full,
so it now has to fit a 4 MiB written-size budget and 16 levels of
nesting when it is accepted (and when a persisted copy is loaded). A JSON
routing profile could repeat route groups, each copy repeating every
site list; a group now counts once, since a repeat can never match.
This commit is contained in:
MHSanaei
2026-10-31 08:59:23 +00:00
parent 8359a0f72e
commit 661a169045
4 changed files with 91 additions and 1 deletions
+4 -1
View File
@@ -210,7 +210,10 @@ func buildJsonRoutingSpec(object map[string]any) (jsonRoutingSpec, error) {
for _, segment := range strings.Split(order, "-") {
switch segment {
case "block", "proxy", "direct":
spec.RouteOrder = append(spec.RouteOrder, segment)
// A repeat can never match (the first rule wins) and would copy every list again.
if !slices.Contains(spec.RouteOrder, segment) {
spec.RouteOrder = append(spec.RouteOrder, segment)
}
}
}
return spec, nil