Remove /session endpoint

This commit is contained in:
rxdn 2024-11-13 22:46:19 +00:00
parent 16fadb8663
commit 28f1829d0c
2 changed files with 0 additions and 46 deletions

View File

@ -1,44 +0,0 @@
package api
import (
"github.com/TicketsBot/GoPanel/app/http/session"
"github.com/TicketsBot/GoPanel/config"
"github.com/TicketsBot/GoPanel/rpc"
"github.com/TicketsBot/GoPanel/utils"
"github.com/TicketsBot/common/premium"
"github.com/gin-gonic/gin"
)
func SessionHandler(ctx *gin.Context) {
userId := ctx.Keys["userid"].(uint64)
store, err := session.Store.Get(userId)
if err != nil {
if err == session.ErrNoSession {
ctx.JSON(404, gin.H{
"success": false,
"error": err.Error(),
"auth": true,
})
} else {
ctx.JSON(500, utils.ErrorJson(err))
}
return
}
tier, err := rpc.PremiumClient.GetTierByUser(ctx, userId, false)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
whitelabelOverride := utils.Contains(config.Conf.ForceWhitelabel, userId)
ctx.JSON(200, gin.H{
"username": store.Name,
"avatar": store.Avatar,
"whitelabel": tier >= premium.Whitelabel || whitelabelOverride,
"admin": utils.Contains(config.Conf.Admins, userId),
})
}

View File

@ -80,8 +80,6 @@ func StartServer(logger *zap.Logger, sm *livechat.SocketManager) {
apiGroup := router.Group("/api", middleware.VerifyXTicketsHeader, middleware.AuthenticateToken, middleware.UpdateLastSeen)
{
apiGroup.GET("/session", api.SessionHandler)
{
integrationGroup := apiGroup.Group("/integrations")