mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 02:25:00 +00:00
feat: Add trusted redirect domains.
This commit is contained in:
@@ -159,4 +159,17 @@ func initConstantEnv() {
|
||||
}
|
||||
constant.TaskPricePatches = taskPricePatches
|
||||
}
|
||||
|
||||
// Initialize trusted redirect domains for URL validation
|
||||
trustedDomainsStr := GetEnvOrDefaultString("TRUSTED_REDIRECT_DOMAINS", "")
|
||||
var trustedDomains []string
|
||||
domains := strings.Split(trustedDomainsStr, ",")
|
||||
for _, domain := range domains {
|
||||
trimmedDomain := strings.TrimSpace(domain)
|
||||
if trimmedDomain != "" {
|
||||
// Normalize domain to lowercase
|
||||
trustedDomains = append(trustedDomains, strings.ToLower(trimmedDomain))
|
||||
}
|
||||
}
|
||||
constant.TrustedRedirectDomains = trustedDomains
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user