优化番号处理逻辑,添加对MetaTube的支持

优化番号处理逻辑,添加对MetaTube的支持
This commit is contained in:
truewhile
2026-08-21 00:06:49 +08:00
parent aa15cfe1f1
commit 65d1ad5ae5
25 changed files with 2283 additions and 83 deletions
+19
View File
@@ -1,6 +1,7 @@
package service
import (
"context"
"net/url"
"strings"
)
@@ -65,3 +66,21 @@ func dedupeStrings(values []string) []string {
}
return out
}
func (p *AdultProvider) getSetting(ctx context.Context, key, fallback string) string {
if p != nil && p.repo != nil && p.repo.Setting != nil {
if val, err := p.repo.Setting.Get(ctx, key); err == nil && strings.TrimSpace(val) != "" {
return strings.TrimSpace(val)
}
}
return fallback
}
func (p *AdultProvider) getSettingBool(ctx context.Context, key string, fallback bool) bool {
val := p.getSetting(ctx, key, "")
if val == "" {
return fallback
}
val = strings.ToLower(val)
return val == "true" || val == "1" || val == "yes" || val == "on"
}