This commit is contained in:
Evan Goode 2025-03-29 19:19:31 -04:00
parent 9901aa8776
commit 817bb432c2
6 changed files with 15 additions and 11 deletions

View File

@ -189,6 +189,9 @@ func (app *App) AuthlibInjectorDeleteTexture(textureType string) func(c echo.Con
nil, // capeURL
textureType == TextureTypeCape, // deleteCape
)
if err != nil {
return err
}
return c.NoContent(http.StatusNoContent)
})

View File

@ -397,6 +397,9 @@ func CleanConfig(config *Config) error {
oidcConfig.Issuer,
false,
)
if err != nil {
return err
}
}
return nil
}
@ -418,7 +421,7 @@ RequireInvite = true
`
func HandleDeprecations(config Config, metadata *toml.MetaData) [][]string {
deprecatedPaths := make([][]string, 0, 0)
deprecatedPaths := make([][]string, 0)
warningTemplate := "Warning: config option %s is deprecated and will be removed in a future version. Use %s instead."

View File

@ -169,7 +169,7 @@ func (ts *TestSuite) testMigrateBackwards(t *testing.T) {
query, err := os.ReadFile("sql/1.sql")
assert.Nil(t, err)
assert.Nil(t, db.Exec(string(query)).Error)
setUserVersion(db, CURRENT_USER_VERSION+1)
assert.Nil(t, setUserVersion(db, CURRENT_USER_VERSION+1))
err = Migrate(ts.Config, mo.None[string](), db, true, CURRENT_USER_VERSION)
var backwardsMigrationError BackwardsMigrationError

View File

@ -101,9 +101,9 @@ func (app *App) setSuccessMessage(c *echo.Context, template string, args ...inte
app.setMessageCookie(c, SUCCESS_MESSAGE_COOKIE_NAME, template, args...)
}
func (app *App) setWarningMessage(c *echo.Context, template string, args ...interface{}) {
app.setMessageCookie(c, WARNING_MESSAGE_COOKIE_NAME, template, args...)
}
// func (app *App) setWarningMessage(c *echo.Context, template string, args ...interface{}) {
// app.setMessageCookie(c, WARNING_MESSAGE_COOKIE_NAME, template, args...)
// }
func (app *App) setErrorMessage(c *echo.Context, template string, args ...interface{}) {
app.setMessageCookie(c, ERROR_MESSAGE_COOKIE_NAME, template, args...)
@ -153,11 +153,11 @@ func (app *App) HandleWebError(err error, c *echo.Context) error {
var webError *WebError
var userError *UserError
if errors.As(err, &webError) {
app.setErrorMessage(c, webError.Error())
app.setErrorMessage(c, "%s", webError.Error())
return (*c).Redirect(http.StatusSeeOther, webError.ReturnURL)
} else if errors.As(err, &userError) {
returnURL := getReturnURL(app, c)
app.setErrorMessage(c, userError.Error())
app.setErrorMessage(c, "%s", userError.Error())
return (*c).Redirect(http.StatusSeeOther, returnURL)
}
@ -192,7 +192,7 @@ func (app *App) HandleWebError(err error, c *echo.Context) error {
})
} else {
returnURL := getReturnURL(app, c)
app.setErrorMessage(c, message)
app.setErrorMessage(c, "%s", message)
return (*c).Redirect(http.StatusSeeOther, returnURL)
}
}

View File

@ -117,7 +117,7 @@ func (ts *TestSuite) createPlayerShouldSucceed(t *testing.T, rec *httptest.Respo
returnURLExp := regexp.MustCompile("^" + regexp.QuoteMeta(ts.App.FrontEndURL+"/web/player/") + "(.+)$")
uuidMatch := returnURLExp.FindStringSubmatch(rec.Header().Get("Location"))
assert.True(t, uuidMatch != nil && len(uuidMatch) == 2)
assert.True(t, len(uuidMatch) == 2)
uuid_ := uuidMatch[1]
_, err := uuid.Parse(uuid_)
assert.Nil(t, err)

View File

@ -1,7 +1,6 @@
package main
import (
"cmp"
"crypto"
"crypto/rand"
"crypto/rsa"
@ -12,7 +11,6 @@ import (
"io"
"log"
"os"
"slices"
"strings"
"sync"
)