Remove /session endpoint
This commit is contained in:
parent
16fadb8663
commit
28f1829d0c
@ -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),
|
|
||||||
})
|
|
||||||
}
|
|
@ -80,8 +80,6 @@ func StartServer(logger *zap.Logger, sm *livechat.SocketManager) {
|
|||||||
|
|
||||||
apiGroup := router.Group("/api", middleware.VerifyXTicketsHeader, middleware.AuthenticateToken, middleware.UpdateLastSeen)
|
apiGroup := router.Group("/api", middleware.VerifyXTicketsHeader, middleware.AuthenticateToken, middleware.UpdateLastSeen)
|
||||||
{
|
{
|
||||||
apiGroup.GET("/session", api.SessionHandler)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
integrationGroup := apiGroup.Group("/integrations")
|
integrationGroup := apiGroup.Group("/integrations")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user