chore: expand debug logging + embeddable version

This commit is contained in:
Gabe Farrell 2025-06-13 18:29:08 -04:00
parent edbd7d506e
commit e92733823d
25 changed files with 563 additions and 303 deletions

View file

@ -21,17 +21,20 @@ func LbzValidateTokenHandler(store db.DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
l := logger.FromContext(ctx)
l.Debug().Msg("Validating user token...")
l.Debug().Msg("LbzValidateTokenHandler: Validating user token")
u := middleware.GetUserFromContext(ctx)
var response LbzValidateResponse
if u == nil {
l.Debug().Msg("LbzValidateTokenHandler: Invalid token, user not found in context")
response.Code = http.StatusUnauthorized
response.Error = "Incorrect Authorization"
w.WriteHeader(http.StatusUnauthorized)
utils.WriteJSON(w, http.StatusOK, response)
} else {
response.Code = 200
l.Debug().Msgf("LbzValidateTokenHandler: Token valid for user '%s'", u.Username)
response.Code = http.StatusOK
response.Message = "Token valid."
response.Valid = true
response.UserName = u.Username