mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-03 11:45:04 +03:00
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:
@@ -94,6 +94,18 @@ func TestParseJsonRoutingSpecRouteOrderUnknownSegments(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Every group copy repeats the profile's whole site lists in the rendered routing, and a
|
||||
// later copy can never match, so a remote profile repeating groups must not multiply them.
|
||||
func TestParseJsonRoutingSpecRouteOrderKeepsEachGroupOnce(t *testing.T) {
|
||||
spec, _, err := parseJsonRoutingSpec(`{"RouteOrder":"` + strings.Repeat("proxy-direct-block-", 500) + `proxy"}`)
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
if strings.Join(spec.RouteOrder, ",") != "proxy,direct,block" {
|
||||
t.Fatalf("RouteOrder = %d segments, want proxy,direct,block once each", len(spec.RouteOrder))
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseJsonRoutingSpecDeeplinks(t *testing.T) {
|
||||
payload := mustMarshal(t, fullRoutingPayload())
|
||||
cases := []string{
|
||||
|
||||
Reference in New Issue
Block a user