From 4af93cae1ca54ad7c9bc7eb4b56c010f55c4c72d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Feb 2026 17:53:55 +0000 Subject: feat: allow viewing/spectating games without login Make watch, ranking, game list, and tournament endpoints accessible without authentication. Unauthenticated users can browse games and spectate from the index page, while play/submit/preview still require login. https://claude.ai/code/session_019j9tNcnLsLz15e1qtbmeqe --- backend/api/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backend/api/handler.go') diff --git a/backend/api/handler.go b/backend/api/handler.go index 57ae973..dcebfa1 100644 --- a/backend/api/handler.go +++ b/backend/api/handler.go @@ -218,7 +218,7 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, use } return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - if !row.IsPublic && !user.IsAdmin { + if !row.IsPublic && (user == nil || !user.IsAdmin) { return GetGame404JSONResponse{ Message: "Game not found", }, nil @@ -318,7 +318,7 @@ func (h *Handler) GetGameWatchLatestStates(ctx context.Context, request GetGameW Status: status, } - if row.UserID == user.UserID && !user.IsAdmin { + if user != nil && row.UserID == user.UserID && !user.IsAdmin { return GetGameWatchLatestStates403JSONResponse{ Message: "You are one of the main players of this game", }, nil -- cgit v1.3.1