forced whitelabel

This commit is contained in:
Dot-Rar 2020-05-28 19:03:04 +01:00
parent 799e6b3389
commit 1433521855
3 changed files with 36 additions and 14 deletions

View File

@ -1,6 +1,7 @@
package api
import (
"github.com/TicketsBot/GoPanel/config"
dbclient "github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/messagequeue"
"github.com/TicketsBot/GoPanel/rpc"
@ -16,11 +17,21 @@ func WhitelabelHandler(ctx *gin.Context) {
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
if premiumTier < premium.Whitelabel {
ctx.JSON(402, gin.H{
"success": false,
"error": "You must have the whitelabel premium tier",
})
return
var isForced bool
for _, forced := range config.Conf.ForceWhitelabel {
if forced == userId {
isForced = true
break
}
}
if !isForced {
ctx.JSON(402, gin.H{
"success": false,
"error": "You must have the whitelabel premium tier",
})
return
}
}
// Get token

View File

@ -20,8 +20,18 @@ func WhitelabelHandler(ctx *gin.Context) {
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
if premiumTier < premium.Whitelabel {
ctx.Redirect(302, fmt.Sprintf("%s/premium", config.Conf.Server.MainSite))
return
var isForced bool
for _, forced := range config.Conf.ForceWhitelabel {
if forced == userId {
isForced = true
break
}
}
if !isForced {
ctx.Redirect(302, fmt.Sprintf("%s/premium", config.Conf.Server.MainSite))
return
}
}
ctx.HTML(200, "main/whitelabel", gin.H{

View File

@ -7,13 +7,14 @@ import (
type (
Config struct {
Admins []uint64
Server Server
Oauth Oauth
Database Database
Bot Bot
Redis Redis
Cache Cache
Admins []uint64
ForceWhitelabel []uint64
Server Server
Oauth Oauth
Database Database
Bot Bot
Redis Redis
Cache Cache
}
Server struct {