✨ feat(video): 新增视频 CENC 解密与流式代理播放

- 逆向 SpadeA(黑桃A) PlayAuth 混淆,从 spade_a 还原 AES-128 内容密钥
- 实现 cenc-aes-ctr MP4 解密(senc 逐样本 CTR + stsd entry 修复),实测可播放
- 新增 /video/proxy/{key} 代理:稳定 key + 磁盘缓存(二次命中提速 130x)+
  http.ServeContent 支持 Range/206/seek 流式播放
- /video 接口新增 output(url/proxy,默认 proxy) 与 quality(max/720p/档位key) 参数,
  可由 config fanqie.video.* 配置默认值;无匹配清晰度时明确报错
- 代理映射复用 audio_cache 存储,抽取 loadMediaProxyEntry 共用;挂接 7 天缓存清理
- deploy.sh 新增 --sync-nginx:备份→重写→校验→失败自动回滚,同步视频代理段配置
This commit is contained in:
chenxin committed 2026-10-10 12:58:25 +08:00
1 parent e3d96ca637
commit 49d0a371fb
13 files changed
+1000 -78

No files matched your search

+15
View File
@@ -41,6 +41,7 @@ type FanqieConfig struct {
Signature string `mapstructure:"signature"` // 签名方法: sign2 / sign4
Content ContentConfig `mapstructure:"content"`
Manga MangaConfig `mapstructure:"manga"`
Video VideoConfig `mapstructure:"video"`
}
// ContentConfig 内容处理配置
@@ -60,6 +61,14 @@ type MangaConfig struct {
OutputMode string `mapstructure:"output_mode"` // 输出模式: data_uri / base64 / url
}
// VideoConfig 视频处理配置
type VideoConfig struct {
OutputMode string `mapstructure:"output_mode"` // 输出模式: url(原始CDN链接,内容加密)/ proxy(本地解密代理,可直接播放)
Quality string `mapstructure:"quality"` // 默认清晰度: max(最高档)/ 360p/480p/... 或档位 key(video_1..N),留空返回全部
CacheEnabled bool `mapstructure:"cache_enabled"` // 解密后视频的磁盘缓存
CachePath string `mapstructure:"cache_path"` // 缓存目录
}
// CacheConfig 缓存配置
type CacheConfig struct {
Enabled bool `mapstructure:"enabled"`
@@ -197,6 +206,12 @@ func setDefaults() {
// 漫画处理配置
viper.SetDefault("fanqie.manga.output_mode", "url")
// 视频处理配置
viper.SetDefault("fanqie.video.output_mode", "proxy")
viper.SetDefault("fanqie.video.quality", "max")
viper.SetDefault("fanqie.video.cache_enabled", true)
viper.SetDefault("fanqie.video.cache_path", "./video_cache")
// 缓存配置
viper.SetDefault("cache.enabled", true)
viper.SetDefault("cache.backend", "sqlite")