Fix local adult metadata and watch history removal

This commit is contained in:
ShukeBta
2026-05-28 14:52:20 +08:00
parent 352edd86ed
commit 32ccb33fed
95 changed files with 6589 additions and 1307 deletions
+29
View File
@@ -0,0 +1,29 @@
package service
import "testing"
func TestProxyURLFromProxyServer(t *testing.T) {
cases := []struct {
name string
proxyServer string
requestScheme string
want string
}{
{"bare", "127.0.0.1:10808", "https", "http://127.0.0.1:10808"},
{"scheme map https", "http=127.0.0.1:7890;https=127.0.0.1:7891", "https", "http://127.0.0.1:7891"},
{"fallback http", "http=127.0.0.1:7890", "https", "http://127.0.0.1:7890"},
{"socks", "socks=127.0.0.1:1080", "https", "socks5://127.0.0.1:1080"},
{"explicit", "http://127.0.0.1:8080", "https", "http://127.0.0.1:8080"},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got, err := proxyURLFromProxyServer(tc.proxyServer, tc.requestScheme)
if err != nil {
t.Fatal(err)
}
if got.String() != tc.want {
t.Fatalf("got %q, want %q", got.String(), tc.want)
}
})
}
}