Merge c5da11792ccf350144f284445b0b19d77facc5ed into eb5f8920038ecf0b81bb61e9e61bac70b72cf4af

This commit is contained in:
Tobias Poulsen 2025-02-20 20:56:09 +01:00 committed by GitHub
commit 4648da6409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 23 deletions

View File

@ -20,26 +20,16 @@ func VerifyWhitelabel(isApi bool) func(ctx *gin.Context) {
} }
if tier < premium.Whitelabel { if tier < premium.Whitelabel {
var isForced bool if isApi {
for _, id := range config.Conf.ForceWhitelabel { ctx.AbortWithStatusJSON(402, gin.H{
if id == userId { "success": false,
isForced = true "error": "You must have the whitelabel premium tier",
break })
} } else {
} ctx.Redirect(302, fmt.Sprintf("%s/premium", config.Conf.Server.MainSite))
ctx.Abort()
if !isForced {
if isApi {
ctx.AbortWithStatusJSON(402, gin.H{
"success": false,
"error": "You must have the whitelabel premium tier",
})
} else {
ctx.Redirect(302, fmt.Sprintf("%s/premium", config.Conf.Server.MainSite))
ctx.Abort()
}
return
} }
return
} }
} }
} }

View File

@ -10,7 +10,6 @@ import (
type Config struct { type Config struct {
Admins []uint64 `env:"ADMINS"` Admins []uint64 `env:"ADMINS"`
ForceWhitelabel []uint64 `env:"FORCED_WHITELABEL"`
Debug bool `env:"DEBUG"` Debug bool `env:"DEBUG"`
SentryDsn *string `env:"SENTRY_DSN"` SentryDsn *string `env:"SENTRY_DSN"`
JsonLogs bool `env:"JSON_LOGS" envDefault:"false"` JsonLogs bool `env:"JSON_LOGS" envDefault:"false"`

View File

@ -9,9 +9,8 @@
--- ---
- ADMINS - ADMINS
- FORCED_WHITELABEL - SENTRY_DSN
- SENTRY_DSN - SERVER_ADD
- SERVER_ADDR
- METRIC_SERVER_ADDR - METRIC_SERVER_ADDR
- BASE_URL - BASE_URL
- MAIN_SITE - MAIN_SITE