Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package vidser
import (
"testing"
"91porn-server/models/v/vidmod"
)
type countingSigner struct{ n int }
func (c *countingSigner) SignM3u8URL(field *string, playable, preview bool) { c.n++ }
// 验证亚模块响应体不仅签直挂/精选视频,还会下钻到各专题(AllSection)内的视频——
// 这正是旧反射兜底会覆盖、改接口后最易漏掉的嵌套层级。
func TestVideoUnderSubModuleRespSignsNestedSections(t *testing.T) {
c := &countingSigner{}
resp := VideoUnderSubModuleResp{
AllVideoInfo: []*vidmod.VideoInfoResp{{}},
ChosenVideoInfo: []*vidmod.VideoInfoResp{{}},
AllSection: []Section{
{AllVideoInfo: []*vidmod.VideoInfoResp{{}, {}}},
},
}
resp.SignM3u8(c)
// (1 直挂 + 1 精选)*2 字段 + (2 专题内)*2 字段 = 8
if c.n != 8 {
t.Fatalf("VideoUnderSubModuleResp should offer 8 url fields incl nested sections, got %d", c.n)
}
}