ci: 复用部署服务器缓存并支持 HTTPS 同源登录

This commit is contained in:
2026-10-09 21:11:44 +08:00
parent 2cad6d7533
commit ac936d2a1a
14 changed files with 158 additions and 47 deletions
+25
View File
@@ -23,3 +23,28 @@ func TestRejectInvalidRedisDB(t *testing.T) {
t.Fatal("negative database must be rejected")
}
}
func TestPublicOriginConfiguration(t *testing.T) {
for _, tc := range []struct {
origin string
valid bool
}{
{"", true},
{"https://veyra.sundynix.cn", true},
{"http://localhost:8080", true},
{"https://veyra.sundynix.cn/", false},
{"https://veyra.sundynix.cn?", false},
{"https://veyra.sundynix.cn#", false},
{"https://user:password@veyra.sundynix.cn", false},
{"ftp://veyra.sundynix.cn", false},
{"https:///missing-host", false},
} {
t.Run(tc.origin, func(t *testing.T) {
t.Setenv("PUBLIC_ORIGIN", tc.origin)
_, err := Load()
if (err == nil) != tc.valid {
t.Fatalf("valid=%v error=%v", tc.valid, err)
}
})
}
}