mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 10:56:06 -04:00
lint
This commit is contained in:
parent
3097c11b31
commit
a87ecaf6a4
2
api.go
2
api.go
@ -120,7 +120,7 @@ func (app *App) APIRequestToMaybeUser(c echo.Context) (mo.Option[User], error) {
|
||||
bearerExp := regexp.MustCompile("^Bearer (.*)$")
|
||||
|
||||
tokenMatch := bearerExp.FindStringSubmatch(authorizationHeader)
|
||||
if tokenMatch == nil || len(tokenMatch) < 2 {
|
||||
if len(tokenMatch) < 2 {
|
||||
return mo.None[User](), NewUserErrorWithCode(http.StatusUnauthorized, "Malformed Authorization header")
|
||||
}
|
||||
token := tokenMatch[1]
|
||||
|
5
front.go
5
front.go
@ -1335,7 +1335,8 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
|
||||
|
||||
var playerName string
|
||||
var userUUID *string
|
||||
if action == ChallengeActionRegister {
|
||||
switch action {
|
||||
case ChallengeActionRegister:
|
||||
if useIDToken {
|
||||
provider, _, claims, err := app.getIDTokenCookie(&c)
|
||||
if err != nil {
|
||||
@ -1358,7 +1359,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
|
||||
} else {
|
||||
playerName = c.QueryParam("playerName")
|
||||
}
|
||||
} else if action == ChallengeActionCreatePlayer {
|
||||
case ChallengeActionCreatePlayer:
|
||||
playerName = c.QueryParam("playerName")
|
||||
userUUID = Ptr(c.QueryParam("userUuid"))
|
||||
}
|
||||
|
2
main.go
2
main.go
@ -439,7 +439,7 @@ func setup(config *Config) *App {
|
||||
locales := map[language.Tag]*gotext.Locale{}
|
||||
localeTags := make([]language.Tag, 0)
|
||||
localesPath := path.Join(config.DataDirectory, "locales")
|
||||
langPaths, err := filepath.Glob(path.Join(localesPath, "*"))
|
||||
langPaths := Unwrap(filepath.Glob(path.Join(localesPath, "*")))
|
||||
defaultLang := "en-US" // TODO config option?
|
||||
var defaultLocale *gotext.Locale
|
||||
for _, lang_path := range langPaths {
|
||||
|
2
model.go
2
model.go
@ -402,7 +402,7 @@ func (app *App) GetClient(accessToken string, stalePolicy StaleTokenPolicy) *Cli
|
||||
}
|
||||
|
||||
var client Client
|
||||
result := app.DB.Preload("User").Preload("Player").First(&client, "uuid = ?", claims.RegisteredClaims.Subject)
|
||||
result := app.DB.Preload("User").Preload("Player").First(&client, "uuid = ?", claims.Subject)
|
||||
if result.Error != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -30,9 +30,10 @@ func (app *App) getTexture(
|
||||
|
||||
if textureReader != nil || textureURL != nil {
|
||||
allowed := false
|
||||
if textureType == TextureTypeSkin {
|
||||
switch textureType {
|
||||
case TextureTypeSkin:
|
||||
allowed = app.Config.AllowSkins
|
||||
} else if textureType == TextureTypeCape {
|
||||
case TextureTypeCape:
|
||||
allowed = app.Config.AllowCapes
|
||||
}
|
||||
if !allowed && !callerIsAdmin {
|
||||
|
@ -34,7 +34,7 @@ func withBearerAuthentication(app *App, f func(c echo.Context, user *User, playe
|
||||
}
|
||||
|
||||
accessTokenMatch := bearerExp.FindStringSubmatch(authorizationHeader)
|
||||
if accessTokenMatch == nil || len(accessTokenMatch) < 2 {
|
||||
if len(accessTokenMatch) < 2 {
|
||||
return &YggdrasilError{Code: http.StatusUnauthorized}
|
||||
}
|
||||
accessToken := accessTokenMatch[1]
|
||||
@ -114,7 +114,7 @@ func getServicesProfile(app *App, player *Player) (ServicesProfile, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
var skins []ServicesProfileSkin = []ServicesProfileSkin{}
|
||||
skins := []ServicesProfileSkin{}
|
||||
if skin := getServicesProfileSkin(); skin != nil {
|
||||
skins = []ServicesProfileSkin{*skin}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user