fix: defaut ui triage (#4802)
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (#4796, #4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (#4704, #4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
//"os"
|
||||
//"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -36,6 +37,26 @@ func SetTheme(t string) {
|
||||
}
|
||||
}
|
||||
|
||||
// ThemeAwarePath rewrites legacy /console/* paths to the default-theme
|
||||
// equivalents when the active theme is "default". For "classic" (or any
|
||||
// other theme) the path is returned unchanged. The function only touches
|
||||
// known prefixes so it is safe to call with arbitrary suffixes and query
|
||||
// strings.
|
||||
func ThemeAwarePath(suffix string) string {
|
||||
if GetTheme() != "default" {
|
||||
return suffix
|
||||
}
|
||||
switch {
|
||||
case strings.HasPrefix(suffix, "/console/topup"):
|
||||
return strings.Replace(suffix, "/console/topup", "/wallet", 1)
|
||||
case strings.HasPrefix(suffix, "/console/log"):
|
||||
return strings.Replace(suffix, "/console/log", "/usage-logs", 1)
|
||||
case strings.HasPrefix(suffix, "/console/personal"):
|
||||
return strings.Replace(suffix, "/console/personal", "/profile", 1)
|
||||
}
|
||||
return suffix
|
||||
}
|
||||
|
||||
// var ChatLink = ""
|
||||
// var ChatLink2 = ""
|
||||
var QuotaPerUnit = 500 * 1000.0 // $0.002 / 1K tokens
|
||||
|
||||
Reference in New Issue
Block a user