forced whitelabel
This commit is contained in:
parent
799e6b3389
commit
1433521855
@ -1,6 +1,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/TicketsBot/GoPanel/config"
|
||||||
dbclient "github.com/TicketsBot/GoPanel/database"
|
dbclient "github.com/TicketsBot/GoPanel/database"
|
||||||
"github.com/TicketsBot/GoPanel/messagequeue"
|
"github.com/TicketsBot/GoPanel/messagequeue"
|
||||||
"github.com/TicketsBot/GoPanel/rpc"
|
"github.com/TicketsBot/GoPanel/rpc"
|
||||||
@ -16,11 +17,21 @@ func WhitelabelHandler(ctx *gin.Context) {
|
|||||||
|
|
||||||
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
|
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
|
||||||
if premiumTier < premium.Whitelabel {
|
if premiumTier < premium.Whitelabel {
|
||||||
ctx.JSON(402, gin.H{
|
var isForced bool
|
||||||
"success": false,
|
for _, forced := range config.Conf.ForceWhitelabel {
|
||||||
"error": "You must have the whitelabel premium tier",
|
if forced == userId {
|
||||||
})
|
isForced = true
|
||||||
return
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isForced {
|
||||||
|
ctx.JSON(402, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"error": "You must have the whitelabel premium tier",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get token
|
// Get token
|
||||||
|
@ -20,8 +20,18 @@ func WhitelabelHandler(ctx *gin.Context) {
|
|||||||
|
|
||||||
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
|
premiumTier := rpc.PremiumClient.GetTierByUser(userId, false)
|
||||||
if premiumTier < premium.Whitelabel {
|
if premiumTier < premium.Whitelabel {
|
||||||
ctx.Redirect(302, fmt.Sprintf("%s/premium", config.Conf.Server.MainSite))
|
var isForced bool
|
||||||
return
|
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{
|
ctx.HTML(200, "main/whitelabel", gin.H{
|
||||||
|
@ -7,13 +7,14 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Config struct {
|
Config struct {
|
||||||
Admins []uint64
|
Admins []uint64
|
||||||
Server Server
|
ForceWhitelabel []uint64
|
||||||
Oauth Oauth
|
Server Server
|
||||||
Database Database
|
Oauth Oauth
|
||||||
Bot Bot
|
Database Database
|
||||||
Redis Redis
|
Bot Bot
|
||||||
Cache Cache
|
Redis Redis
|
||||||
|
Cache Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
Server struct {
|
Server struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user