aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handler.go
diff options
context:
space:
mode:
authornsfisis <54318333+nsfisis@users.noreply.github.com>2026-02-21 09:35:03 +0900
committerGitHub <noreply@github.com>2026-02-21 09:35:03 +0900
commitaa25d66376f30c590c697a2c7eb981a24e1057bb (patch)
treecd6dc50573a90bb2625df981b8c9305c63f156c0 /backend/api/handler.go
parent00354d392a0bcddaac71fee7b6aae721e5747f59 (diff)
parent277c9726f0f39d1db83624a8b62a77ac19c2ac0a (diff)
downloadphperkaigi-2026-albatross-aa25d66376f30c590c697a2c7eb981a24e1057bb.tar.gz
phperkaigi-2026-albatross-aa25d66376f30c590c697a2c7eb981a24e1057bb.tar.zst
phperkaigi-2026-albatross-aa25d66376f30c590c697a2c7eb981a24e1057bb.zip
Merge pull request #6 from nsfisis/claude/allow-viewing-without-login-zODtV
Allow unauthenticated users to view games and watch matches
Diffstat (limited to 'backend/api/handler.go')
-rw-r--r--backend/api/handler.go4
1 files changed, 2 insertions, 2 deletions
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