Simplify whitelabel setup

This commit is contained in:
rxdn 2024-06-18 23:00:34 +01:00
parent 42111df1c6
commit fd5ff3331d
11 changed files with 512 additions and 580 deletions

View File

@ -0,0 +1,20 @@
package api
import (
"github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/utils"
"github.com/gin-gonic/gin"
"net/http"
)
func WhitelabelDelete(ctx *gin.Context) {
userId := ctx.Keys["userid"].(uint64)
// Check if this is a different token
if err := database.Client.Whitelabel.Delete(userId); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
ctx.Status(http.StatusNoContent)
}

View File

@ -2,6 +2,7 @@ package api
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"github.com/TicketsBot/GoPanel/botcontext" "github.com/TicketsBot/GoPanel/botcontext"
"github.com/TicketsBot/GoPanel/database" "github.com/TicketsBot/GoPanel/database"
@ -34,45 +35,50 @@ func GetWhitelabelCreateInteractions() func(*gin.Context) {
return return
} }
if err := createInteractions(cm, bot.BotId, bot.Token); err != nil {
if errors.Is(err, ErrInteractionCreateCooldown) {
ctx.JSON(400, utils.ErrorJson(err))
} else {
ctx.JSON(500, utils.ErrorJson(err))
}
return
}
ctx.JSON(200, utils.SuccessResponse)
}
}
var ErrInteractionCreateCooldown = errors.New("Interaction creation on cooldown")
func createInteractions(cm *manager.CommandManager, botId uint64, token string) error {
// Cooldown // Cooldown
key := fmt.Sprintf("tickets:interaction-create-cooldown:%d", bot.BotId) key := fmt.Sprintf("tickets:interaction-create-cooldown:%d", botId)
// try to set first, prevent race condition // try to set first, prevent race condition
wasSet, err := redis.Client.SetNX(redis.DefaultContext(), key, 1, time.Minute).Result() wasSet, err := redis.Client.SetNX(redis.DefaultContext(), key, 1, time.Minute).Result()
if err != nil { if err != nil {
ctx.JSON(500, gin.H{ return err
"success": false,
"error": err.Error(),
})
return
} }
// on cooldown, tell user how long left // on cooldown, tell user how long left
if !wasSet { if !wasSet {
expiration, err := redis.Client.TTL(redis.DefaultContext(), key).Result() expiration, err := redis.Client.TTL(redis.DefaultContext(), key).Result()
if err != nil { if err != nil {
ctx.JSON(500, utils.ErrorJson(err)) return err
return
} }
ctx.JSON(400, utils.ErrorStr(fmt.Sprintf("Interaction creation on cooldown, please wait another %d seconds", int64(expiration.Seconds())))) return fmt.Errorf("%w, please wait another %d seconds", ErrInteractionCreateCooldown, int64(expiration.Seconds()))
return
} }
botContext, err := botcontext.ContextForGuild(0) botContext, err := botcontext.ContextForGuild(0)
if err != nil { if err != nil {
ctx.JSON(500, utils.ErrorJson(err)) return err
return
} }
commands, _ := cm.BuildCreatePayload(true, nil) commands, _ := cm.BuildCreatePayload(true, nil)
// TODO: Use proper context // TODO: Use proper context
if _, err = rest.ModifyGlobalCommands(context.Background(), bot.Token, botContext.RateLimiter, bot.BotId, commands); err == nil { _, err = rest.ModifyGlobalCommands(context.Background(), token, botContext.RateLimiter, botId, commands)
ctx.JSON(200, utils.SuccessResponse) return err
} else {
ctx.JSON(500, utils.ErrorJson(err))
}
}
} }

View File

@ -1,14 +1,18 @@
package api package api
import ( import (
"context"
"github.com/TicketsBot/GoPanel/database" "github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/utils" "github.com/TicketsBot/GoPanel/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/rxdn/gdl/objects/user" "github.com/rxdn/gdl/objects/user"
"github.com/rxdn/gdl/rest"
) )
type whitelabelResponse struct { type whitelabelResponse struct {
Id uint64 `json:"id,string"` Id uint64 `json:"id,string"`
PublicKey string `json:"public_key"`
Username string `json:"username"`
statusUpdateBody statusUpdateBody
} }
@ -27,6 +31,13 @@ func WhitelabelGet(ctx *gin.Context) {
return return
} }
// Get public key
publicKey, err := database.Client.WhitelabelKeys.Get(bot.BotId)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
// Get status // Get status
status, statusType, _, err := database.Client.WhitelabelStatuses.Get(bot.BotId) status, statusType, _, err := database.Client.WhitelabelStatuses.Get(bot.BotId)
if err != nil { if err != nil {
@ -34,11 +45,25 @@ func WhitelabelGet(ctx *gin.Context) {
return return
} }
username := getBotUsername(context.Background(), bot.Token)
ctx.JSON(200, whitelabelResponse{ ctx.JSON(200, whitelabelResponse{
Id: bot.BotId, Id: bot.BotId,
PublicKey: publicKey,
Username: username,
statusUpdateBody: statusUpdateBody{ // Zero values if no status is fine statusUpdateBody: statusUpdateBody{ // Zero values if no status is fine
Status: status, Status: status,
StatusType: user.ActivityType(statusType), StatusType: user.ActivityType(statusType),
}, },
}) })
} }
func getBotUsername(ctx context.Context, token string) string {
user, err := rest.GetCurrentUser(ctx, token, nil)
if err != nil {
// TODO: Log error
return "Unknown User"
}
return user.Username
}

View File

@ -1,48 +0,0 @@
package api
import (
"github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/utils"
"github.com/gin-gonic/gin"
)
func WhitelabelGetPublicKey(ctx *gin.Context) {
type data struct {
PublicKey string `json:"public_key"`
}
userId := ctx.Keys["userid"].(uint64)
// Get bot
bot, err := database.Client.Whitelabel.GetByUserId(userId)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
// Ensure bot exists
if bot.BotId == 0 {
ctx.JSON(404, gin.H{
"success": false,
"error": "No bot found",
})
return
}
key, err := database.Client.WhitelabelKeys.Get(bot.BotId)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
if key == "" {
ctx.JSON(404, gin.H{
"success": false,
})
} else {
ctx.JSON(200, gin.H{
"success": true,
"key": key,
})
}
}

View File

@ -3,22 +3,34 @@ package api
import ( import (
"context" "context"
"encoding/base64" "encoding/base64"
"fmt"
dbclient "github.com/TicketsBot/GoPanel/database" dbclient "github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/redis" "github.com/TicketsBot/GoPanel/redis"
"github.com/TicketsBot/GoPanel/utils" "github.com/TicketsBot/GoPanel/utils"
"github.com/TicketsBot/common/tokenchange" "github.com/TicketsBot/common/tokenchange"
"github.com/TicketsBot/common/whitelabeldelete"
"github.com/TicketsBot/database" "github.com/TicketsBot/database"
"github.com/TicketsBot/worker/bot/command/manager"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/rxdn/gdl/objects/application"
"github.com/rxdn/gdl/rest" "github.com/rxdn/gdl/rest"
"strconv" "strconv"
"strings" "strings"
) )
func WhitelabelPost(ctx *gin.Context) { func WhitelabelPost() func(*gin.Context) {
cm := new(manager.CommandManager)
cm.RegisterCommands()
return func(ctx *gin.Context) {
userId := ctx.Keys["userid"].(uint64) userId := ctx.Keys["userid"].(uint64)
type whitelabelPostBody struct {
Token string `json:"token"`
}
// Get token // Get token
var data map[string]interface{} var data whitelabelPostBody
if err := ctx.BindJSON(&data); err != nil { if err := ctx.BindJSON(&data); err != nil {
ctx.JSON(400, gin.H{ ctx.JSON(400, gin.H{
"success": false, "success": false,
@ -27,35 +39,12 @@ func WhitelabelPost(ctx *gin.Context) {
return return
} }
token, ok := data["token"].(string) bot, err := fetchApplication(data.Token)
if !ok || token == "" {
ctx.JSON(400, utils.ErrorStr("Missing token"))
return
}
if !validateToken(token) {
ctx.JSON(400, utils.ErrorStr("Invalid token"))
return
}
// Validate token + get bot ID
// TODO: Use proper context
bot, err := rest.GetCurrentUser(context.Background(), token, nil)
if err != nil { if err != nil {
ctx.JSON(400, utils.ErrorJson(err)) ctx.JSON(400, utils.ErrorJson(err))
return return
} }
if bot.Id == 0 {
ctx.JSON(400, utils.ErrorStr("Invalid token"))
return
}
if !bot.Bot {
ctx.JSON(400, utils.ErrorStr("Token is not of a bot user"))
return
}
// Check if this is a different token // Check if this is a different token
existing, err := dbclient.Client.Whitelabel.GetByUserId(userId) existing, err := dbclient.Client.Whitelabel.GetByUserId(userId)
if err != nil { if err != nil {
@ -63,19 +52,58 @@ func WhitelabelPost(ctx *gin.Context) {
return return
} }
if err = dbclient.Client.Whitelabel.Set(database.WhitelabelBot{ // Take existing whitelabel bot offline, if it is a different bot
if existing.BotId != 0 && existing.BotId != bot.Id {
whitelabeldelete.Publish(redis.Client.Client, existing.BotId)
}
// Set token in DB so that http-gateway can use it when Discord validates the interactions endpoint
// TODO: Use a transaction
if err := dbclient.Client.Whitelabel.Set(database.WhitelabelBot{
UserId: userId, UserId: userId,
BotId: bot.Id, BotId: bot.Id,
Token: token, Token: data.Token,
}); err != nil { }); err != nil {
ctx.JSON(500, utils.ErrorJson(err)) ctx.JSON(500, utils.ErrorJson(err))
return return
} }
if err := dbclient.Client.WhitelabelKeys.Set(bot.Id, bot.VerifyKey); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
// Set intents
var currentFlags application.Flag = 0
if bot.Flags != nil {
currentFlags = *bot.Flags
}
editData := rest.EditCurrentApplicationData{
Flags: utils.Ptr(application.BuildFlags(
currentFlags,
application.FlagIntentGatewayGuildMembersLimited,
application.FlagGatewayMessageContentLimited,
)),
// TODO: Don't hardcode URL
InteractionsEndpointUrl: utils.Ptr(fmt.Sprintf("https://gateway.ticketsbot.net/handle/%d", bot.InteractionsEndpointUrl)),
}
if _, err := rest.EditCurrentApplication(context.Background(), data.Token, nil, editData); err != nil {
// TODO: Use a transaction
if err := dbclient.Client.Whitelabel.Delete(bot.Id); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
ctx.JSON(500, utils.ErrorJson(err))
return
}
tokenChangeData := tokenchange.TokenChangeData{ tokenChangeData := tokenchange.TokenChangeData{
Token: token, Token: data.Token,
NewId: bot.Id, NewId: bot.Id,
OldId: existing.BotId, OldId: 0,
} }
if err := tokenchange.PublishTokenChange(redis.Client.Client, tokenChangeData); err != nil { if err := tokenchange.PublishTokenChange(redis.Client.Client, tokenChangeData); err != nil {
@ -83,10 +111,16 @@ func WhitelabelPost(ctx *gin.Context) {
return return
} }
if err := createInteractions(cm, bot.Id, data.Token); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
ctx.JSON(200, gin.H{ ctx.JSON(200, gin.H{
"success": true, "success": true,
"bot": bot, "bot": bot,
}) })
}
} }
func validateToken(token string) bool { func validateToken(token string) bool {
@ -115,3 +149,22 @@ func validateToken(token string) bool {
return true return true
} }
func fetchApplication(token string) (*application.Application, error) {
if !validateToken(token) {
return nil, fmt.Errorf("Invalid token")
}
// Validate token + get bot ID
// TODO: Use proper context
app, err := rest.GetCurrentApplication(context.Background(), token, nil)
if err != nil {
return nil, err
}
if app.Id == 0 {
return nil, fmt.Errorf("Invalid token")
}
return &app, nil
}

View File

@ -1,60 +0,0 @@
package api
import (
"encoding/hex"
"github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/utils"
"github.com/gin-gonic/gin"
)
func WhitelabelPostPublicKey(ctx *gin.Context) {
type data struct {
PublicKey string `json:"public_key"`
}
userId := ctx.Keys["userid"].(uint64)
// Get bot
bot, err := database.Client.Whitelabel.GetByUserId(userId)
if err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
// Ensure bot exists
if bot.BotId == 0 {
ctx.JSON(404, gin.H{
"success": false,
"error": "No bot found",
})
return
}
// Parse status
var body data
if err := ctx.BindJSON(&body); err != nil {
ctx.JSON(400, gin.H{
"success": false,
"error": "No public key provided",
})
return
}
bytes, err := hex.DecodeString(body.PublicKey)
if err != nil || len(bytes) != 32 {
ctx.JSON(400, gin.H{
"success": false,
"error": "Invalid public key",
})
return
}
if err := database.Client.WhitelabelKeys.Set(bot.BotId, body.PublicKey); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
ctx.JSON(200, gin.H{
"success": true,
})
}

View File

@ -197,11 +197,10 @@ func StartServer(sm *livechat.SocketManager) {
whitelabelGroup.GET("/", api_whitelabel.WhitelabelGet) whitelabelGroup.GET("/", api_whitelabel.WhitelabelGet)
whitelabelGroup.GET("/errors", api_whitelabel.WhitelabelGetErrors) whitelabelGroup.GET("/errors", api_whitelabel.WhitelabelGetErrors)
whitelabelGroup.GET("/guilds", api_whitelabel.WhitelabelGetGuilds) whitelabelGroup.GET("/guilds", api_whitelabel.WhitelabelGetGuilds)
whitelabelGroup.GET("/public-key", api_whitelabel.WhitelabelGetPublicKey)
whitelabelGroup.POST("/public-key", api_whitelabel.WhitelabelPostPublicKey)
whitelabelGroup.POST("/create-interactions", api_whitelabel.GetWhitelabelCreateInteractions()) whitelabelGroup.POST("/create-interactions", api_whitelabel.GetWhitelabelCreateInteractions())
whitelabelGroup.DELETE("/", api_whitelabel.WhitelabelDelete)
whitelabelGroup.POST("/", rl(middleware.RateLimitTypeUser, 10, time.Minute), api_whitelabel.WhitelabelPost) whitelabelGroup.POST("/", rl(middleware.RateLimitTypeUser, 5, time.Minute), api_whitelabel.WhitelabelPost())
whitelabelGroup.POST("/status", rl(middleware.RateLimitTypeUser, 1, time.Second*5), api_whitelabel.WhitelabelStatusPost) whitelabelGroup.POST("/status", rl(middleware.RateLimitTypeUser, 1, time.Second*5), api_whitelabel.WhitelabelStatusPost)
} }
} }

View File

@ -11,7 +11,7 @@
"axios": "^0.21.4", "axios": "^0.21.4",
"sirv-cli": "^1.0.0", "sirv-cli": "^1.0.0",
"svelte-emoji-selector": "^1.0.1", "svelte-emoji-selector": "^1.0.1",
"svelte-router-spa": "^6.0.2", "svelte-router-spa": "^6.0.3",
"svelte-select": "^5.6.1", "svelte-select": "^5.6.1",
"svelte-tooltip": "^1.2.0" "svelte-tooltip": "^1.2.0"
}, },
@ -28,7 +28,7 @@
"rollup-plugin-livereload": "^2.0.0", "rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.1.0", "rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.0", "rollup-plugin-terser": "^7.0.0",
"svelte": "^3.48.0", "svelte": "^3.59.2",
"svelte-toggle": "^3.1.0" "svelte-toggle": "^3.1.0"
} }
}, },
@ -46,12 +46,13 @@
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
"integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/highlight": "^7.18.6" "@babel/highlight": "^7.24.7",
"picocolors": "^1.0.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -97,14 +98,14 @@
} }
}, },
"node_modules/@babel/generator": { "node_modules/@babel/generator": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz",
"integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.21.4", "@babel/types": "^7.24.7",
"@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.17", "@jridgewell/trace-mapping": "^0.3.25",
"jsesc": "^2.5.1" "jsesc": "^2.5.1"
}, },
"engines": { "engines": {
@ -211,10 +212,13 @@
} }
}, },
"node_modules/@babel/helper-environment-visitor": { "node_modules/@babel/helper-environment-visitor": {
"version": "7.18.9", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz",
"integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==",
"dev": true, "dev": true,
"dependencies": {
"@babel/types": "^7.24.7"
},
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
@ -232,25 +236,25 @@
} }
}, },
"node_modules/@babel/helper-function-name": { "node_modules/@babel/helper-function-name": {
"version": "7.21.0", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz",
"integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/template": "^7.20.7", "@babel/template": "^7.24.7",
"@babel/types": "^7.21.0" "@babel/types": "^7.24.7"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/helper-hoist-variables": { "node_modules/@babel/helper-hoist-variables": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz",
"integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.24.7"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -374,30 +378,30 @@
} }
}, },
"node_modules/@babel/helper-split-export-declaration": { "node_modules/@babel/helper-split-export-declaration": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz",
"integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.24.7"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/helper-string-parser": { "node_modules/@babel/helper-string-parser": {
"version": "7.19.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz",
"integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/helper-validator-identifier": { "node_modules/@babel/helper-validator-identifier": {
"version": "7.19.1", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz",
"integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -442,23 +446,24 @@
} }
}, },
"node_modules/@babel/highlight": { "node_modules/@babel/highlight": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz",
"integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-validator-identifier": "^7.18.6", "@babel/helper-validator-identifier": "^7.24.7",
"chalk": "^2.0.0", "chalk": "^2.4.2",
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/parser": { "node_modules/@babel/parser": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz",
"integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==",
"dev": true, "dev": true,
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
@ -1529,34 +1534,34 @@
} }
}, },
"node_modules/@babel/template": { "node_modules/@babel/template": {
"version": "7.20.7", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz",
"integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.18.6", "@babel/code-frame": "^7.24.7",
"@babel/parser": "^7.20.7", "@babel/parser": "^7.24.7",
"@babel/types": "^7.20.7" "@babel/types": "^7.24.7"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/traverse": { "node_modules/@babel/traverse": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz",
"integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.21.4", "@babel/code-frame": "^7.24.7",
"@babel/generator": "^7.21.4", "@babel/generator": "^7.24.7",
"@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-environment-visitor": "^7.24.7",
"@babel/helper-function-name": "^7.21.0", "@babel/helper-function-name": "^7.24.7",
"@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-hoist-variables": "^7.24.7",
"@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-split-export-declaration": "^7.24.7",
"@babel/parser": "^7.21.4", "@babel/parser": "^7.24.7",
"@babel/types": "^7.21.4", "@babel/types": "^7.24.7",
"debug": "^4.1.0", "debug": "^4.3.1",
"globals": "^11.1.0" "globals": "^11.1.0"
}, },
"engines": { "engines": {
@ -1564,13 +1569,13 @@
} }
}, },
"node_modules/@babel/types": { "node_modules/@babel/types": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz",
"integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-string-parser": "^7.19.4", "@babel/helper-string-parser": "^7.24.7",
"@babel/helper-validator-identifier": "^7.19.1", "@babel/helper-validator-identifier": "^7.24.7",
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
}, },
"engines": { "engines": {
@ -1624,14 +1629,14 @@
} }
}, },
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.3", "version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@jridgewell/set-array": "^1.0.1", "@jridgewell/set-array": "^1.2.1",
"@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/sourcemap-codec": "^1.4.10",
"@jridgewell/trace-mapping": "^0.3.9" "@jridgewell/trace-mapping": "^0.3.24"
}, },
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
@ -1647,9 +1652,9 @@
} }
}, },
"node_modules/@jridgewell/set-array": { "node_modules/@jridgewell/set-array": {
"version": "1.1.2", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
@ -1672,21 +1677,15 @@
"dev": true "dev": true
}, },
"node_modules/@jridgewell/trace-mapping": { "node_modules/@jridgewell/trace-mapping": {
"version": "0.3.18", "version": "0.3.25",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@jridgewell/resolve-uri": "3.1.0", "@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.14",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
"dev": true
},
"node_modules/@polka/url": { "node_modules/@polka/url": {
"version": "1.0.0-next.15", "version": "1.0.0-next.15",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.15.tgz", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.15.tgz",
@ -1944,12 +1943,12 @@
} }
}, },
"node_modules/braces": { "node_modules/braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@ -2225,9 +2224,9 @@
"integrity": "sha512-RqBOWwt7sc+ta9GFjbu5GOwKFRzn3rMPPSqvSGpIwsfVnpMjiI5ttv84lwNsCMEYI6/lu/iH21HUcE3TLz8RGQ==" "integrity": "sha512-RqBOWwt7sc+ta9GFjbu5GOwKFRzn3rMPPSqvSGpIwsfVnpMjiI5ttv84lwNsCMEYI6/lu/iH21HUcE3TLz8RGQ=="
}, },
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
@ -2237,9 +2236,9 @@
} }
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.14.8", "version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@ -3094,9 +3093,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "3.58.0", "version": "3.59.2",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.58.0.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.59.2.tgz",
"integrity": "sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==", "integrity": "sha512-vzSyuGr3eEoAtT/A6bmajosJZIUWySzY2CzB3w2pgPvnkUjGqlDnsNnA0PMO+mMAhuyMul6C2uuZzY6ELSkzyA==",
"engines": { "engines": {
"node": ">= 8" "node": ">= 8"
} }
@ -3130,9 +3129,9 @@
} }
}, },
"node_modules/svelte-router-spa": { "node_modules/svelte-router-spa": {
"version": "6.0.2", "version": "6.0.3",
"resolved": "https://registry.npmjs.org/svelte-router-spa/-/svelte-router-spa-6.0.2.tgz", "resolved": "https://registry.npmjs.org/svelte-router-spa/-/svelte-router-spa-6.0.3.tgz",
"integrity": "sha512-ySs/2TnjdLnvo0tHfdJsRPhPl0Mj4/h2qi0Zb8t4zC+BBBaCr6cZc7MtRfgzD4IMp80Nqe7ZXd/hCJuHSGtf5A==", "integrity": "sha512-aHgyUVVI/WjipQNmKcXpX0hFZtkW5Y6hwH5aXLr2P/aRQ/qlX8ZbKQJUwKjOD59p7tt/c+wqokiIt68N7aNuKQ==",
"dependencies": { "dependencies": {
"url-params-parser": "^1.0.3" "url-params-parser": "^1.0.3"
}, },
@ -3342,9 +3341,9 @@
"dev": true "dev": true
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "7.4.6", "version": "7.5.10",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=8.3.0" "node": ">=8.3.0"
@ -3381,12 +3380,13 @@
} }
}, },
"@babel/code-frame": { "@babel/code-frame": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
"integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/highlight": "^7.18.6" "@babel/highlight": "^7.24.7",
"picocolors": "^1.0.0"
} }
}, },
"@babel/compat-data": { "@babel/compat-data": {
@ -3419,14 +3419,14 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz",
"integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.21.4", "@babel/types": "^7.24.7",
"@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.17", "@jridgewell/trace-mapping": "^0.3.25",
"jsesc": "^2.5.1" "jsesc": "^2.5.1"
} }
}, },
@ -3503,10 +3503,13 @@
} }
}, },
"@babel/helper-environment-visitor": { "@babel/helper-environment-visitor": {
"version": "7.18.9", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz",
"integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==",
"dev": true "dev": true,
"requires": {
"@babel/types": "^7.24.7"
}
}, },
"@babel/helper-explode-assignable-expression": { "@babel/helper-explode-assignable-expression": {
"version": "7.14.5", "version": "7.14.5",
@ -3518,22 +3521,22 @@
} }
}, },
"@babel/helper-function-name": { "@babel/helper-function-name": {
"version": "7.21.0", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz",
"integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/template": "^7.20.7", "@babel/template": "^7.24.7",
"@babel/types": "^7.21.0" "@babel/types": "^7.24.7"
} }
}, },
"@babel/helper-hoist-variables": { "@babel/helper-hoist-variables": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz",
"integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.18.6" "@babel/types": "^7.24.7"
} }
}, },
"@babel/helper-member-expression-to-functions": { "@babel/helper-member-expression-to-functions": {
@ -3627,24 +3630,24 @@
} }
}, },
"@babel/helper-split-export-declaration": { "@babel/helper-split-export-declaration": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz",
"integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.18.6" "@babel/types": "^7.24.7"
} }
}, },
"@babel/helper-string-parser": { "@babel/helper-string-parser": {
"version": "7.19.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz",
"integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==",
"dev": true "dev": true
}, },
"@babel/helper-validator-identifier": { "@babel/helper-validator-identifier": {
"version": "7.19.1", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz",
"integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==",
"dev": true "dev": true
}, },
"@babel/helper-validator-option": { "@babel/helper-validator-option": {
@ -3677,20 +3680,21 @@
} }
}, },
"@babel/highlight": { "@babel/highlight": {
"version": "7.18.6", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz",
"integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/helper-validator-identifier": "^7.18.6", "@babel/helper-validator-identifier": "^7.24.7",
"chalk": "^2.0.0", "chalk": "^2.4.2",
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz",
"integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==",
"dev": true "dev": true
}, },
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": {
@ -4404,42 +4408,42 @@
} }
}, },
"@babel/template": { "@babel/template": {
"version": "7.20.7", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz",
"integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.18.6", "@babel/code-frame": "^7.24.7",
"@babel/parser": "^7.20.7", "@babel/parser": "^7.24.7",
"@babel/types": "^7.20.7" "@babel/types": "^7.24.7"
} }
}, },
"@babel/traverse": { "@babel/traverse": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz",
"integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.21.4", "@babel/code-frame": "^7.24.7",
"@babel/generator": "^7.21.4", "@babel/generator": "^7.24.7",
"@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-environment-visitor": "^7.24.7",
"@babel/helper-function-name": "^7.21.0", "@babel/helper-function-name": "^7.24.7",
"@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-hoist-variables": "^7.24.7",
"@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-split-export-declaration": "^7.24.7",
"@babel/parser": "^7.21.4", "@babel/parser": "^7.24.7",
"@babel/types": "^7.21.4", "@babel/types": "^7.24.7",
"debug": "^4.1.0", "debug": "^4.3.1",
"globals": "^11.1.0" "globals": "^11.1.0"
} }
}, },
"@babel/types": { "@babel/types": {
"version": "7.21.4", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz",
"integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/helper-string-parser": "^7.19.4", "@babel/helper-string-parser": "^7.24.7",
"@babel/helper-validator-identifier": "^7.19.1", "@babel/helper-validator-identifier": "^7.24.7",
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
@ -4478,14 +4482,14 @@
} }
}, },
"@jridgewell/gen-mapping": { "@jridgewell/gen-mapping": {
"version": "0.3.3", "version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@jridgewell/set-array": "^1.0.1", "@jridgewell/set-array": "^1.2.1",
"@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/sourcemap-codec": "^1.4.10",
"@jridgewell/trace-mapping": "^0.3.9" "@jridgewell/trace-mapping": "^0.3.24"
} }
}, },
"@jridgewell/resolve-uri": { "@jridgewell/resolve-uri": {
@ -4495,9 +4499,9 @@
"dev": true "dev": true
}, },
"@jridgewell/set-array": { "@jridgewell/set-array": {
"version": "1.1.2", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
"dev": true "dev": true
}, },
"@jridgewell/source-map": { "@jridgewell/source-map": {
@ -4517,21 +4521,13 @@
"dev": true "dev": true
}, },
"@jridgewell/trace-mapping": { "@jridgewell/trace-mapping": {
"version": "0.3.18", "version": "0.3.25",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@jridgewell/resolve-uri": "3.1.0", "@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
},
"dependencies": {
"@jridgewell/sourcemap-codec": {
"version": "1.4.14",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
"dev": true
}
} }
}, },
"@polka/url": { "@polka/url": {
@ -4732,12 +4728,12 @@
} }
}, },
"braces": { "braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true, "dev": true,
"requires": { "requires": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
} }
}, },
"browserslist": { "browserslist": {
@ -4931,18 +4927,18 @@
"integrity": "sha512-RqBOWwt7sc+ta9GFjbu5GOwKFRzn3rMPPSqvSGpIwsfVnpMjiI5ttv84lwNsCMEYI6/lu/iH21HUcE3TLz8RGQ==" "integrity": "sha512-RqBOWwt7sc+ta9GFjbu5GOwKFRzn3rMPPSqvSGpIwsfVnpMjiI5ttv84lwNsCMEYI6/lu/iH21HUcE3TLz8RGQ=="
}, },
"fill-range": { "fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true, "dev": true,
"requires": { "requires": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
} }
}, },
"follow-redirects": { "follow-redirects": {
"version": "1.14.8", "version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA=="
}, },
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
@ -5578,9 +5574,9 @@
} }
}, },
"svelte": { "svelte": {
"version": "3.58.0", "version": "3.59.2",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.58.0.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.59.2.tgz",
"integrity": "sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==" "integrity": "sha512-vzSyuGr3eEoAtT/A6bmajosJZIUWySzY2CzB3w2pgPvnkUjGqlDnsNnA0PMO+mMAhuyMul6C2uuZzY6ELSkzyA=="
}, },
"svelte-click-outside": { "svelte-click-outside": {
"version": "1.0.0", "version": "1.0.0",
@ -5610,9 +5606,9 @@
} }
}, },
"svelte-router-spa": { "svelte-router-spa": {
"version": "6.0.2", "version": "6.0.3",
"resolved": "https://registry.npmjs.org/svelte-router-spa/-/svelte-router-spa-6.0.2.tgz", "resolved": "https://registry.npmjs.org/svelte-router-spa/-/svelte-router-spa-6.0.3.tgz",
"integrity": "sha512-ySs/2TnjdLnvo0tHfdJsRPhPl0Mj4/h2qi0Zb8t4zC+BBBaCr6cZc7MtRfgzD4IMp80Nqe7ZXd/hCJuHSGtf5A==", "integrity": "sha512-aHgyUVVI/WjipQNmKcXpX0hFZtkW5Y6hwH5aXLr2P/aRQ/qlX8ZbKQJUwKjOD59p7tt/c+wqokiIt68N7aNuKQ==",
"requires": { "requires": {
"url-params-parser": "^1.0.3" "url-params-parser": "^1.0.3"
} }
@ -5762,9 +5758,9 @@
"dev": true "dev": true
}, },
"ws": { "ws": {
"version": "7.4.6", "version": "7.5.10",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"dev": true, "dev": true,
"requires": {} "requires": {}
}, },

View File

@ -20,14 +20,14 @@
"rollup-plugin-livereload": "^2.0.0", "rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.1.0", "rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.0", "rollup-plugin-terser": "^7.0.0",
"svelte": "^3.48.0", "svelte": "^3.59.2",
"svelte-toggle": "^3.1.0" "svelte-toggle": "^3.1.0"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.4", "axios": "^0.21.4",
"sirv-cli": "^1.0.0", "sirv-cli": "^1.0.0",
"svelte-emoji-selector": "^1.0.1", "svelte-emoji-selector": "^1.0.1",
"svelte-router-spa": "^6.0.2", "svelte-router-spa": "^6.0.3",
"svelte-select": "^5.6.1", "svelte-select": "^5.6.1",
"svelte-tooltip": "^1.2.0" "svelte-tooltip": "^1.2.0"
} }

View File

@ -57,6 +57,7 @@ export default {
// consult the documentation for details: // consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs // https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({ resolve({
preferBuiltins: true,
browser: true, browser: true,
dedupe: ['svelte'] dedupe: ['svelte']
}), }),

View File

@ -1,62 +1,27 @@
<div class="wrapper"> <div class="wrapper">
<div class="content"> <div class="col">
<div class="content-col"> {#if active}
<Card footer="{false}" fill="{false}"> <Card footer="{false}" fill="{false}">
<h4 slot="title">Bot Token</h4> <h4 slot="title">Manage Bot</h4>
<div slot="body" class="full-width"> <div slot="body" class="full-width">
<form class="full-width" onsubmit="return false;"> <p>Your whitelabel bot <b>{bot.username}</b> is active.</p>
<label class="form-label">Bot Token</label>
<input name="token" type="text" bind:value={token} class="form-input full-width"
placeholder="xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxx">
<p>Note: You will not be able to view the token after submitting it</p>
<div class="buttons"> <div class="buttons">
<div class="col"> <Button icon="fas fa-plus" on:click={invite}>
<Button icon="fas fa-paper-plane" on:click={submitToken} fullWidth="{true}">Submit
</Button>
</div>
<div class="col">
<Button icon="fas fa-plus" on:click={invite} fullWidth="{true}"
disabled="{bot.id === undefined}">
Generate Invite Link Generate Invite Link
</Button> </Button>
</div>
</div>
</form>
</div>
</Card>
</div>
<div class="content-col">
<Card footer="{false}" fill="{false}">
<h4 slot="title">Slash Commands</h4>
<div slot="body" class="full-width">
<form class="full-width" onsubmit="return false;">
<label class="form-label">Interactions Endpoint URL</label>
<input name="token" type="text" bind:value={interactionUrl} class="form-input full-width"
readonly>
<label class="form-label">Public Key</label> <Button icon="fas fa-paper-plane" on:click={createSlashCommands}>
<input name="token" type="text" bind:value={publicKey} class="form-input full-width"> Re-create Slash Commands
<div class="buttons">
<div class="col">
<Button icon="fas fa-paper-plane" on:click={updatePublicKey} fullWidth="{true}"
disabled="{bot.id === undefined}">Submit Key
</Button> </Button>
</div>
<div class="col"> <Button icon="fas fa-trash-can" on:click={disable} danger>
<Button icon="fas fa-paper-plane" on:click={createSlashCommands} fullWidth="{true}" Disable Whitelabel
disabled="{!publicKeyOk}">Create Slash Commands
</Button> </Button>
</div> </div>
</div> </div>
</form>
</div>
</Card> </Card>
</div>
</div>
<div class="content">
<div class="content-col">
<Card footer="{false}" fill="{false}"> <Card footer="{false}" fill="{false}">
<h4 slot="title">Custom Status</h4> <h4 slot="title">Custom Status</h4>
<div slot="body" class="full-width"> <div slot="body" class="full-width">
@ -69,20 +34,39 @@
</Dropdown> </Dropdown>
<div class="col-2-3"> <div class="col-2-3">
<Input col1 label="Status Text" placeholder="/help" bind:value={bot.status} /> <Input col1 label="Status Text" placeholder="/help" bind:value={bot.status}/>
</div> </div>
</div> </div>
<div class="buttons"> <div class="buttons">
<Button icon="fas fa-paper-plane" on:click={updateStatus} fullWidth="{true}" <Button icon="fas fa-paper-plane" on:click={updateStatus} fullWidth="{true}">
disabled="{bot.id === undefined}">Submit Submit
</Button> </Button>
</div> </div>
</form> </form>
</div> </div>
</Card> </Card>
{:else}
<Card footer="{false}" fill="{false}">
<h4 slot="title">Bot Token</h4>
<div slot="body" class="full-width">
<form class="full-width" onsubmit="return false;">
<label class="form-label">Bot Token</label>
<input name="token" type="text" bind:value={token} class="form-input full-width"
placeholder="xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxx">
<p>Note: You will not be able to view the token after submitting it</p>
<div class="buttons">
<Button icon="fas fa-paper-plane" on:click={submitToken} fullWidth="{true}">Submit
</Button>
</div> </div>
<div class="content-col"> </form>
</div>
</Card>
{/if}
</div>
<div class="col">
<Card footer="{false}" fill="{false}"> <Card footer="{false}" fill="{false}">
<h4 slot="title">Error Log</h4> <h4 slot="title">Error Log</h4>
<div slot="body" class="full-width"> <div slot="body" class="full-width">
@ -105,45 +89,32 @@
</div> </div>
</Card> </Card>
</div> </div>
</div>
</div> </div>
<style> <style>
.wrapper { .wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: row;
height: 100%; height: 100%;
width: 100%; width: 100%;
align-items: center; padding: 2%;
} gap: 2%;
.content {
display: flex;
justify-content: space-around;
flex-direction: row;
width: 95%;
margin-top: 2%;
} }
.col { .col {
width: 48%; display: flex;
height: 100%; flex-direction: column;
} width: 50%;
gap: 2%;
.content-col {
width: 48%;
height: 100%;
} }
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
.content { .wrapper {
flex-direction: column; flex-direction: column;
} }
.content-col { .col {
width: 100%; width: 100%;
margin-top: 2%;
} }
} }
@ -173,10 +144,16 @@
.buttons { .buttons {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; gap: 12px;
margin-top: 12px; margin-top: 12px;
} }
@media only screen and (max-width: 576px) {
.buttons {
flex-direction: column;
}
}
.error-log { .error-log {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
@ -216,15 +193,13 @@
import Button from '../components/Button.svelte' import Button from '../components/Button.svelte'
import {API_URL} from "../js/constants"; import {API_URL} from "../js/constants";
import {setDefaultHeaders} from '../includes/Auth.svelte' import {setDefaultHeaders} from '../includes/Auth.svelte'
import Input from "../components/form/Input.svelte";
import Dropdown from "../components/form/Dropdown.svelte"; import Dropdown from "../components/form/Dropdown.svelte";
import Input from "../components/form/Input.svelte";
setDefaultHeaders() setDefaultHeaders()
let active = false;
let token; let token;
let publicKey;
let publicKeyOk = false;
let interactionUrl;
let bot = {}; let bot = {};
let errors = []; let errors = [];
@ -252,25 +227,8 @@
$: token = ''; $: token = '';
await loadInteractionUrl();
await loadBot(); await loadBot();
notifySuccess(`Started tickets whitelabel on ${res.data.bot.username}#${res.data.bot.discriminator}`); notifySuccess(`Started tickets whitelabel on ${res.data.bot.username}`);
}
async function updatePublicKey() {
const data = {
public_key: publicKey,
};
const res = await axios.post(`${API_URL}/user/whitelabel/public-key`, data);
if (res.status !== 200 || !res.data.success) {
notifyError(res.data.error);
return;
}
$: publicKeyOk = true;
notifySuccess('Updated slash command settings successfully')
} }
async function updateStatus() { async function updateStatus() {
@ -309,6 +267,8 @@
} }
bot = res.data; bot = res.data;
active = true;
return true; return true;
} }
@ -325,35 +285,6 @@
} }
} }
async function loadPublicKey() {
const res = await axios.get(`${API_URL}/user/whitelabel/public-key`);
if (res.status === 404) {
return;
}
if ((res.status !== 200 || !res.data.success)) {
notifyError(res.data.error);
return;
}
publicKey = res.data.key;
$: publicKeyOk = true;
}
async function loadInteractionUrl() {
const res = await axios.get(`${API_URL}/user/whitelabel/`);
if (res.status === 404) {
return;
}
if (res.status !== 200) {
notifyError(res.data.error);
return;
}
interactionUrl = 'https://gateway.ticketsbot.net/handle/' + res.data.id;
}
async function createSlashCommands() { async function createSlashCommands() {
const opts = { const opts = {
timeout: 20 * 1000 timeout: 20 * 1000
@ -365,15 +296,24 @@
return; return;
} }
notifySuccess('Slash commands have been created. Please note, Discord may take up to an hour to show them in your client'); notifySuccess('Slash commands have been created. Please note, they may take a few minutes before they are visible.');
}
async function disable() {
const res = await axios.delete(`${API_URL}/user/whitelabel/`);
if (res.status !== 204) {
notifyError(res.data.error);
return;
}
active = false;
notifySuccess('Whitelabel has been disabled');
} }
withLoadingScreen(async () => { withLoadingScreen(async () => {
if (await loadBot()) { if (await loadBot()) {
await Promise.all([ await Promise.all([
loadErrors(), loadErrors()
loadInteractionUrl(),
loadPublicKey()
]); ]);
} }
}); });