From 59f4a247dbe49c0f13d40aea69729076208d651e Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Mon, 25 Jul 2022 22:43:32 +0100 Subject: [PATCH] Revamp settings page --- .../endpoints/api/autoclose/autocloseget.go | 67 ---- .../endpoints/api/autoclose/autoclosepost.go | 64 ---- .../endpoints/api/customisation/getcolours.go | 33 -- .../api/customisation/updatecolours.go | 71 ---- .../endpoints/api/settings/claimsettings.go | 20 -- app/http/endpoints/api/settings/settings.go | 141 +++++++- .../api/settings/updateclaimsettings.go | 40 --- .../endpoints/api/settings/updatesettings.go | 178 ++++++++-- app/http/server.go | 11 - frontend/src/components/Collapsible.svelte | 24 +- frontend/src/components/PremiumBadge.svelte | 19 ++ frontend/src/components/form/Checkbox.svelte | 3 +- frontend/src/components/form/Duration.svelte | 17 +- .../src/components/manage/SettingsCard.svelte | 312 +++++++++++++----- frontend/src/includes/Navbar.svelte | 5 +- frontend/src/views/Settings.svelte | 14 +- go.mod | 2 +- go.sum | 2 + 18 files changed, 566 insertions(+), 457 deletions(-) delete mode 100644 app/http/endpoints/api/autoclose/autocloseget.go delete mode 100644 app/http/endpoints/api/autoclose/autoclosepost.go delete mode 100644 app/http/endpoints/api/customisation/getcolours.go delete mode 100644 app/http/endpoints/api/customisation/updatecolours.go delete mode 100644 app/http/endpoints/api/settings/claimsettings.go delete mode 100644 app/http/endpoints/api/settings/updateclaimsettings.go create mode 100644 frontend/src/components/PremiumBadge.svelte diff --git a/app/http/endpoints/api/autoclose/autocloseget.go b/app/http/endpoints/api/autoclose/autocloseget.go deleted file mode 100644 index 66a97e4..0000000 --- a/app/http/endpoints/api/autoclose/autocloseget.go +++ /dev/null @@ -1,67 +0,0 @@ -package api - -import ( - dbclient "github.com/TicketsBot/GoPanel/database" - "github.com/TicketsBot/database" - "github.com/gin-gonic/gin" - "time" -) - -// time.Duration marshals to nanoseconds, custom impl to marshal to seconds -type autoCloseBody struct { - Enabled bool `json:"enabled"` - SinceOpenWithNoResponse int64 `json:"since_open_with_no_response"` - SinceLastMessage int64 `json:"since_last_message"` - OnUserLeave bool `json:"on_user_leave"` -} - -func GetAutoClose(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - settings, err := dbclient.Client.AutoClose.Get(guildId) - if err != nil { - ctx.AbortWithStatusJSON(500, gin.H{ - "success": false, - "error": err.Error(), - }) - return - } - - ctx.JSON(200, convertToAutoCloseBody(settings)) -} - -func convertToAutoCloseBody(settings database.AutoCloseSettings) (body autoCloseBody) { - body.Enabled = settings.Enabled - - if settings.SinceOpenWithNoResponse != nil { - body.SinceOpenWithNoResponse = int64(*settings.SinceOpenWithNoResponse / time.Second) - } - - if settings.SinceLastMessage != nil { - body.SinceLastMessage = int64(*settings.SinceLastMessage / time.Second) - } - - if settings.OnUserLeave != nil { - body.OnUserLeave = *settings.OnUserLeave - } - - return -} - -func convertFromAutoCloseBody(body autoCloseBody) (settings database.AutoCloseSettings) { - settings.Enabled = body.Enabled - - if body.SinceOpenWithNoResponse > 0 { - duration := time.Second * time.Duration(body.SinceOpenWithNoResponse) - settings.SinceOpenWithNoResponse = &duration - } - - if body.SinceLastMessage > 0 { - duration := time.Second * time.Duration(body.SinceLastMessage) - settings.SinceLastMessage = &duration - } - - settings.OnUserLeave = &body.OnUserLeave - - return -} diff --git a/app/http/endpoints/api/autoclose/autoclosepost.go b/app/http/endpoints/api/autoclose/autoclosepost.go deleted file mode 100644 index 63ce6d3..0000000 --- a/app/http/endpoints/api/autoclose/autoclosepost.go +++ /dev/null @@ -1,64 +0,0 @@ -package api - -import ( - "github.com/TicketsBot/GoPanel/botcontext" - dbclient "github.com/TicketsBot/GoPanel/database" - "github.com/TicketsBot/GoPanel/rpc" - "github.com/TicketsBot/GoPanel/utils" - "github.com/TicketsBot/common/premium" - "github.com/gin-gonic/gin" - "time" -) - -var maxDays = 90 -var maxLength = time.Hour * 24 * time.Duration(maxDays) - -func PostAutoClose(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - var body autoCloseBody - if err := ctx.BindJSON(&body); err != nil { - ctx.JSON(400, utils.ErrorJson(err)) - return - } - - settings := convertFromAutoCloseBody(body) - - // get premium - botContext, err := botcontext.ContextForGuild(guildId) - if err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - premiumTier, err := rpc.PremiumClient.GetTierByGuildId(guildId, true, botContext.Token, botContext.RateLimiter) - if err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - if premiumTier < premium.Premium { - settings.SinceOpenWithNoResponse = nil - settings.SinceLastMessage = nil - } - - // Time period cannot be negative, convertFromAutoCloseBody will not allow - if (settings.SinceOpenWithNoResponse != nil && *settings.SinceOpenWithNoResponse > maxLength) || - (settings.SinceLastMessage != nil && *settings.SinceLastMessage > maxLength) { - ctx.JSON(400, utils.ErrorStr("Time period cannot be longer than %d days", maxDays)) - return - } - - if !settings.Enabled { - settings.SinceLastMessage = nil - settings.SinceOpenWithNoResponse = nil - settings.OnUserLeave = nil - } - - if err := dbclient.Client.AutoClose.Set(guildId, settings); err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - ctx.JSON(200, utils.SuccessResponse) -} diff --git a/app/http/endpoints/api/customisation/getcolours.go b/app/http/endpoints/api/customisation/getcolours.go deleted file mode 100644 index 83588f1..0000000 --- a/app/http/endpoints/api/customisation/getcolours.go +++ /dev/null @@ -1,33 +0,0 @@ -package customisation - -import ( - dbclient "github.com/TicketsBot/GoPanel/database" - "github.com/TicketsBot/GoPanel/utils" - "github.com/TicketsBot/worker/bot/customisation" - "github.com/gin-gonic/gin" -) - -// GetColours TODO: Don't depend on worker -func GetColours(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - // TODO: Don't duplicate - raw, err := dbclient.Client.CustomColours.GetAll(guildId) - if err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - colours := make(map[customisation.Colour]utils.HexColour) - for id, hex := range raw { - colours[customisation.Colour(id)] = utils.HexColour(hex) - } - - for id, hex := range customisation.DefaultColours { - if _, ok := colours[id]; !ok { - colours[id] = utils.HexColour(hex) - } - } - - ctx.JSON(200, colours) -} diff --git a/app/http/endpoints/api/customisation/updatecolours.go b/app/http/endpoints/api/customisation/updatecolours.go deleted file mode 100644 index 1ac3962..0000000 --- a/app/http/endpoints/api/customisation/updatecolours.go +++ /dev/null @@ -1,71 +0,0 @@ -package customisation - -import ( - "context" - "github.com/TicketsBot/GoPanel/botcontext" - dbclient "github.com/TicketsBot/GoPanel/database" - "github.com/TicketsBot/GoPanel/rpc" - "github.com/TicketsBot/GoPanel/utils" - "github.com/TicketsBot/common/premium" - "github.com/TicketsBot/worker/bot/customisation" - "github.com/gin-gonic/gin" - "golang.org/x/sync/errgroup" -) - -// UpdateColours TODO: Don't depend on worker -func UpdateColours(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - botContext, err := botcontext.ContextForGuild(guildId) - if err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - // Allow votes - premiumTier, err := rpc.PremiumClient.GetTierByGuildId(guildId, true, botContext.Token, botContext.RateLimiter) - if err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - if premiumTier < premium.Premium { - ctx.JSON(402, utils.ErrorStr("You must have premium to customise message appearance")) - return - } - - var data map[customisation.Colour]utils.HexColour - if err := ctx.BindJSON(&data); err != nil { - ctx.JSON(400, utils.ErrorJson(err)) - return - } - - if len(data) > len(customisation.DefaultColours) { - ctx.JSON(400, utils.ErrorStr("Invalid colour")) - return - } - - for colourCode, hex := range customisation.DefaultColours { - if _, ok := data[colourCode]; !ok { - data[colourCode] = utils.HexColour(hex) - } - } - - // TODO: Single query - group, _ := errgroup.WithContext(context.Background()) - for colourCode, hex := range data { - colourCode := colourCode - hex := hex - - group.Go(func() error { - return dbclient.Client.CustomColours.Set(guildId, colourCode.Int16(), hex.Int()) - }) - } - - if err := group.Wait(); err != nil { - ctx.JSON(500, utils.ErrorJson(err)) - return - } - - ctx.JSON(200, utils.SuccessResponse) -} diff --git a/app/http/endpoints/api/settings/claimsettings.go b/app/http/endpoints/api/settings/claimsettings.go deleted file mode 100644 index 272c617..0000000 --- a/app/http/endpoints/api/settings/claimsettings.go +++ /dev/null @@ -1,20 +0,0 @@ -package api - -import ( - "github.com/TicketsBot/GoPanel/database" - "github.com/gin-gonic/gin" -) - -func GetClaimSettings(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - settings, err := database.Client.ClaimSettings.Get(guildId); if err != nil { - ctx.AbortWithStatusJSON(500, gin.H{ - "success": false, - "error": err.Error(), - }) - return - } - - ctx.JSON(200, settings) -} diff --git a/app/http/endpoints/api/settings/settings.go b/app/http/endpoints/api/settings/settings.go index 403613c..db55bf7 100644 --- a/app/http/endpoints/api/settings/settings.go +++ b/app/http/endpoints/api/settings/settings.go @@ -3,24 +3,44 @@ package api import ( "context" dbclient "github.com/TicketsBot/GoPanel/database" + "github.com/TicketsBot/GoPanel/utils" "github.com/TicketsBot/database" + "github.com/TicketsBot/worker/bot/customisation" + "github.com/TicketsBot/worker/i18n" "github.com/gin-gonic/gin" "golang.org/x/sync/errgroup" + "time" ) -type Settings struct { - database.Settings - Prefix string `json:"prefix"` - WelcomeMessage string `json:"welcome_message"` - TicketLimit uint8 `json:"ticket_limit"` - Category uint64 `json:"category,string"` - ArchiveChannel *uint64 `json:"archive_channel,string"` - NamingScheme database.NamingScheme `json:"naming_scheme"` - PingEveryone bool `json:"ping_everyone"` - UsersCanClose bool `json:"users_can_close"` - CloseConfirmation bool `json:"close_confirmation"` - FeedbackEnabled bool `json:"feedback_enabled"` -} +type ( + Settings struct { + database.Settings + ClaimSettings database.ClaimSettings `json:"claim_settings"` + AutoCloseSettings AutoCloseData `json:"auto_close"` + Colours ColourMap `json:"colours"` + + Prefix string `json:"prefix"` + WelcomeMessage string `json:"welcome_message"` + TicketLimit uint8 `json:"ticket_limit"` + Category uint64 `json:"category,string"` + ArchiveChannel *uint64 `json:"archive_channel,string"` + NamingScheme database.NamingScheme `json:"naming_scheme"` + PingEveryone bool `json:"ping_everyone"` + UsersCanClose bool `json:"users_can_close"` + CloseConfirmation bool `json:"close_confirmation"` + FeedbackEnabled bool `json:"feedback_enabled"` + Language *i18n.Language `json:"language"` + } + + AutoCloseData struct { + Enabled bool `json:"enabled"` + SinceOpenWithNoResponse int64 `json:"since_open_with_no_response"` + SinceLastMessage int64 `json:"since_last_message"` + OnUserLeave bool `json:"on_user_leave"` + } + + ColourMap map[customisation.Colour]utils.HexColour +) func GetSettingsHandler(ctx *gin.Context) { guildId := ctx.Keys["guildid"].(uint64) @@ -29,11 +49,35 @@ func GetSettingsHandler(ctx *gin.Context) { group, _ := errgroup.WithContext(context.Background()) + // main settings group.Go(func() (err error) { settings.Settings, err = dbclient.Client.Settings.Get(guildId) return }) + // claim settings + group.Go(func() (err error) { + settings.ClaimSettings, err = dbclient.Client.ClaimSettings.Get(guildId) + return + }) + + // auto close settings + group.Go(func() error { + tmp, err := dbclient.Client.AutoClose.Get(guildId) + if err != nil { + return err + } + + settings.AutoCloseSettings = convertToAutoCloseData(tmp) + return nil + }) + + // colour map + group.Go(func() (err error) { + settings.Colours, err = getColourMap(guildId) + return + }) + // prefix group.Go(func() (err error) { settings.Prefix, err = dbclient.Client.Prefix.Get(guildId) @@ -106,13 +150,74 @@ func GetSettingsHandler(ctx *gin.Context) { return }) + // language + group.Go(func() error { + tmp, err := dbclient.Client.ActiveLanguage.Get(guildId) + if err != nil { + return err + } + + if tmp != "" { + settings.Language = utils.Ptr(i18n.Language(tmp)) + } + + return nil + }) + if err := group.Wait(); err != nil { - ctx.AbortWithStatusJSON(500, gin.H{ - "success": false, - "error": err.Error(), - }) + ctx.JSON(500, utils.ErrorJson(err)) return } - ctx.JSON(200, settings) + ctx.JSON(200, struct { + Settings + Languages []i18n.Language `json:"languages"` + LanguageNames map[i18n.Language]string `json:"language_names"` + }{ + Settings: settings, + Languages: i18n.LanguagesAlphabetical, + LanguageNames: i18n.FullNames, + }) +} + +func getColourMap(guildId uint64) (ColourMap, error) { + raw, err := dbclient.Client.CustomColours.GetAll(guildId) + if err != nil { + return nil, err + } + + colours := make(ColourMap) + for id, hex := range raw { + if !utils.Exists(activeColours, customisation.Colour(id)) { + continue + } + + colours[customisation.Colour(id)] = utils.HexColour(hex) + } + + for _, id := range activeColours { + if _, ok := colours[id]; !ok { + colours[id] = utils.HexColour(customisation.DefaultColours[id]) + } + } + + return colours, nil +} + +func convertToAutoCloseData(settings database.AutoCloseSettings) (body AutoCloseData) { + body.Enabled = settings.Enabled + + if settings.SinceOpenWithNoResponse != nil { + body.SinceOpenWithNoResponse = int64(*settings.SinceOpenWithNoResponse / time.Second) + } + + if settings.SinceLastMessage != nil { + body.SinceLastMessage = int64(*settings.SinceLastMessage / time.Second) + } + + if settings.OnUserLeave != nil { + body.OnUserLeave = *settings.OnUserLeave + } + + return } diff --git a/app/http/endpoints/api/settings/updateclaimsettings.go b/app/http/endpoints/api/settings/updateclaimsettings.go deleted file mode 100644 index fcbe17f..0000000 --- a/app/http/endpoints/api/settings/updateclaimsettings.go +++ /dev/null @@ -1,40 +0,0 @@ -package api - -import ( - dbclient "github.com/TicketsBot/GoPanel/database" - "github.com/TicketsBot/database" - "github.com/gin-gonic/gin" -) - -func PostClaimSettings(ctx *gin.Context) { - guildId := ctx.Keys["guildid"].(uint64) - - var settings database.ClaimSettings - if err := ctx.BindJSON(&settings); err != nil { - ctx.AbortWithStatusJSON(400, gin.H{ - "success": false, - "error": err.Error(), - }) - return - } - - if settings.SupportCanType && !settings.SupportCanView { - ctx.AbortWithStatusJSON(400, gin.H{ - "success": false, - "error": "Must be able to view channel to type", - }) - return - } - - if err := dbclient.Client.ClaimSettings.Set(guildId, settings); err != nil { - ctx.AbortWithStatusJSON(500, gin.H{ - "success": false, - "error": err.Error(), - }) - return - } - - ctx.JSON(200, gin.H{ - "success": true, - }) -} diff --git a/app/http/endpoints/api/settings/updatesettings.go b/app/http/endpoints/api/settings/updatesettings.go index 86cb115..f16f5bf 100644 --- a/app/http/endpoints/api/settings/updatesettings.go +++ b/app/http/endpoints/api/settings/updatesettings.go @@ -2,14 +2,21 @@ package api import ( "context" + "errors" "fmt" + "github.com/TicketsBot/GoPanel/botcontext" dbclient "github.com/TicketsBot/GoPanel/database" + "github.com/TicketsBot/GoPanel/rpc" "github.com/TicketsBot/GoPanel/rpc/cache" "github.com/TicketsBot/GoPanel/utils" + "github.com/TicketsBot/common/premium" "github.com/TicketsBot/database" + "github.com/TicketsBot/worker/bot/customisation" + "github.com/TicketsBot/worker/i18n" "github.com/gin-gonic/gin" "github.com/rxdn/gdl/objects/channel" "golang.org/x/sync/errgroup" + "time" ) func UpdateSettingsHandler(ctx *gin.Context) { @@ -17,20 +24,52 @@ func UpdateSettingsHandler(ctx *gin.Context) { var settings Settings if err := ctx.BindJSON(&settings); err != nil { - ctx.AbortWithStatusJSON(400, gin.H{ - "success": false, - "error": err.Error(), - }) + ctx.JSON(400, utils.ErrorJson(err)) return } // Get a list of all channel IDs channels := cache.Instance.GetGuildChannels(guildId) + botContext, err := botcontext.ContextForGuild(guildId) + if err != nil { + ctx.JSON(500, utils.ErrorJson(err)) + return + } + + // Includes voting + premiumTier, err := rpc.PremiumClient.GetTierByGuildId(guildId, true, botContext.Token, botContext.RateLimiter) + if err != nil { + ctx.JSON(500, utils.ErrorJson(err)) + return + } + + if err := settings.Validate(guildId, premiumTier); err != nil { + ctx.JSON(400, utils.ErrorJson(err)) + return + } + + group, _ := errgroup.WithContext(context.Background()) + + group.Go(func() error { + return settings.updateSettings(guildId) + }) + + group.Go(func() error { + return settings.updateClaimSettings(guildId) + }) + + addToWaitGroup(group, guildId, settings.updateLanguage) + addToWaitGroup(group, guildId, settings.updateAutoClose) + + if premiumTier > premium.None { + addToWaitGroup(group, guildId, settings.updateColours) + } + // TODO: Errors var errStr *string = nil - if e := settings.updateSettings(guildId); e != nil { - errStr = utils.Ptr(e.Error()) + if err := group.Wait(); err != nil { + errStr = utils.Ptr(err.Error()) } validPrefix := settings.updatePrefix(guildId) @@ -56,16 +95,77 @@ func UpdateSettingsHandler(ctx *gin.Context) { } func (s *Settings) updateSettings(guildId uint64) error { - if err := s.Validate(guildId); err != nil { - return err - } - return dbclient.Client.Settings.Set(guildId, s.Settings) } -var validAutoArchive = []int{60, 1440, 4320, 10080} +func (s *Settings) updateClaimSettings(guildId uint64) error { + return dbclient.Client.ClaimSettings.Set(guildId, s.ClaimSettings) +} -func (s *Settings) Validate(guildId uint64) error { +var ( + validAutoArchive = []int{60, 1440, 4320, 10080} + activeColours = []customisation.Colour{customisation.Green, customisation.Red} +) + +func (s *Settings) Validate(guildId uint64, premiumTier premium.PremiumTier) error { + // Sync checks + if s.ClaimSettings.SupportCanType && !s.ClaimSettings.SupportCanView { + return errors.New("Must be able to view channel to type") + } + + if s.Settings.UseThreads { + return fmt.Errorf("threads are disabled") + } + + if s.Language != nil { + if _, ok := i18n.FullNames[*s.Language]; !ok { + return fmt.Errorf("invalid language") + } + } + + // Validate colours + if len(s.Colours) > len(activeColours) { + return errors.New("Invalid colour") + } + + for colour, _ := range s.Colours { + if !utils.Exists(activeColours, colour) { + return errors.New("Invalid colour") + } + } + + for _, colourCode := range activeColours { + if _, ok := s.Colours[colourCode]; !ok { + s.Colours[colourCode] = utils.HexColour(customisation.DefaultColours[colourCode]) + } + } + + // Validate autoclose + if premiumTier < premium.Premium { + s.AutoCloseSettings.SinceOpenWithNoResponse = 0 + s.AutoCloseSettings.SinceLastMessage = 0 + } + + if !s.AutoCloseSettings.Enabled { + s.AutoCloseSettings.SinceOpenWithNoResponse = 0 + s.AutoCloseSettings.SinceLastMessage = 0 + s.AutoCloseSettings.OnUserLeave = false + } + + if s.AutoCloseSettings.SinceOpenWithNoResponse < 0 { + s.AutoCloseSettings.SinceOpenWithNoResponse = 0 + } + + if s.AutoCloseSettings.SinceLastMessage < 0 { + s.AutoCloseSettings.SinceLastMessage = 0 + } + + if s.AutoCloseSettings.SinceLastMessage > int64((time.Hour*24*60).Seconds()) || + s.AutoCloseSettings.SinceOpenWithNoResponse > int64((time.Hour*24*60).Seconds()) { + return errors.New("Autoclose time period cannot be longer than 60 days") + } + + // Async checks group, _ := errgroup.WithContext(context.Background()) // Validate panel from same guild @@ -102,14 +202,6 @@ func (s *Settings) Validate(guildId uint64) error { return nil }) - group.Go(func() error { - if s.Settings.UseThreads { - return fmt.Errorf("threads are disabled") - } else { - return nil - } - }) - group.Go(func() error { if s.Settings.OverflowCategoryId != nil { ch, ok := cache.Instance.GetChannel(*s.Settings.OverflowCategoryId) @@ -132,6 +224,12 @@ func (s *Settings) Validate(guildId uint64) error { return group.Wait() } +func addToWaitGroup(group *errgroup.Group, guildId uint64, f func(uint64) error) { + group.Go(func() error { + return f(guildId) + }) +} + func (s *Settings) updatePrefix(guildId uint64) bool { if s.Prefix == "" || len(s.Prefix) > 8 { return false @@ -232,3 +330,43 @@ func (s *Settings) updateCloseConfirmation(guildId uint64) { func (s *Settings) updateFeedbackEnabled(guildId uint64) { go dbclient.Client.FeedbackEnabled.Set(guildId, s.FeedbackEnabled) } + +func (s *Settings) updateLanguage(guildId uint64) error { + if s.Language == nil { + return dbclient.Client.ActiveLanguage.Delete(guildId) + } else { + return dbclient.Client.ActiveLanguage.Set(guildId, string(*s.Language)) + } +} + +func (s *Settings) updateColours(guildId uint64) error { + // Convert ColourMap to primitives + converted := make(map[int16]int) + for colour, hex := range s.Colours { + converted[int16(colour)] = int(hex) + } + + return dbclient.Client.CustomColours.BatchSet(guildId, converted) +} + +func (s *Settings) updateAutoClose(guildId uint64) error { + data := s.AutoCloseSettings.ConvertToDatabase() // Already validated + return dbclient.Client.AutoClose.Set(guildId, data) +} + +func (d AutoCloseData) ConvertToDatabase() (settings database.AutoCloseSettings) { + settings.Enabled = d.Enabled + + if d.SinceOpenWithNoResponse > 0 { + duration := time.Second * time.Duration(d.SinceOpenWithNoResponse) + settings.SinceOpenWithNoResponse = &duration + } + + if d.SinceLastMessage > 0 { + duration := time.Second * time.Duration(d.SinceLastMessage) + settings.SinceLastMessage = &duration + } + + settings.OnUserLeave = &d.OnUserLeave + return +} diff --git a/app/http/server.go b/app/http/server.go index e6dda27..b93c04b 100644 --- a/app/http/server.go +++ b/app/http/server.go @@ -3,9 +3,7 @@ package http import ( "github.com/TicketsBot/GoPanel/app/http/endpoints/api" "github.com/TicketsBot/GoPanel/app/http/endpoints/api/admin/botstaff" - api_autoclose "github.com/TicketsBot/GoPanel/app/http/endpoints/api/autoclose" api_blacklist "github.com/TicketsBot/GoPanel/app/http/endpoints/api/blacklist" - api_customisation "github.com/TicketsBot/GoPanel/app/http/endpoints/api/customisation" api_forms "github.com/TicketsBot/GoPanel/app/http/endpoints/api/forms" api_integrations "github.com/TicketsBot/GoPanel/app/http/endpoints/api/integrations" api_panels "github.com/TicketsBot/GoPanel/app/http/endpoints/api/panel" @@ -149,15 +147,6 @@ func StartServer() { guildAuthApiSupport.PUT("/tags", api_tags.CreateTag) guildAuthApiSupport.DELETE("/tags", api_tags.DeleteTag) - guildAuthApiAdmin.GET("/claimsettings", api_settings.GetClaimSettings) - guildAuthApiAdmin.POST("/claimsettings", api_settings.PostClaimSettings) - - guildAuthApiAdmin.GET("/autoclose", api_autoclose.GetAutoClose) - guildAuthApiAdmin.POST("/autoclose", api_autoclose.PostAutoClose) - - guildAuthApiAdmin.GET("/customisation/colours", api_customisation.GetColours) - guildAuthApiAdmin.POST("/customisation/colours", api_customisation.UpdateColours) - guildAuthApiAdmin.GET("/team", api_team.GetTeams) guildAuthApiAdmin.GET("/team/:teamid", rl(middleware.RateLimitTypeUser, 10, time.Second*30), api_team.GetMembers) guildAuthApiAdmin.POST("/team", rl(middleware.RateLimitTypeUser, 10, time.Minute), api_team.CreateTeam) diff --git a/frontend/src/components/Collapsible.svelte b/frontend/src/components/Collapsible.svelte index b15b933..1f38ee9 100644 --- a/frontend/src/components/Collapsible.svelte +++ b/frontend/src/components/Collapsible.svelte @@ -16,17 +16,24 @@ + + @@ -76,5 +85,6 @@ border-left: 0; border-right: 0; width: 100%; + flex: 1; } \ No newline at end of file diff --git a/frontend/src/components/PremiumBadge.svelte b/frontend/src/components/PremiumBadge.svelte new file mode 100644 index 0000000..32264b4 --- /dev/null +++ b/frontend/src/components/PremiumBadge.svelte @@ -0,0 +1,19 @@ + +
+ + Premium +
+
+ + + + \ No newline at end of file diff --git a/frontend/src/components/form/Checkbox.svelte b/frontend/src/components/form/Checkbox.svelte index 8a19fec..84a5d3c 100644 --- a/frontend/src/components/form/Checkbox.svelte +++ b/frontend/src/components/form/Checkbox.svelte @@ -1,11 +1,12 @@
- +