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,12 +17,22 @@ func WhitelabelHandler(ctx *gin.Context) {
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
if premiumTier < premium.Whitelabel {
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
var data map[string]interface{}

View File

@ -20,9 +20,19 @@ func WhitelabelHandler(ctx *gin.Context) {
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
if premiumTier < premium.Whitelabel {
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{
"name": store.Get("name").(string),

View File

@ -8,6 +8,7 @@ import (
type (
Config struct {
Admins []uint64
ForceWhitelabel []uint64
Server Server
Oauth Oauth
Database Database