aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/game/http.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-29 03:44:10 +0900
committernsfisis <nsfisis@gmail.com>2024-07-29 19:38:39 +0900
commitd73fd8bf5bf589a4a391c867e980761fadb647ce (patch)
tree15f2454b48cae461a6d8acc7edb2c2111d445d3e /backend/game/http.go
parent3f95e0e6d62267cf8863e98f3ab7de8971a91000 (diff)
downloadphperkaigi-2025-albatross-d73fd8bf5bf589a4a391c867e980761fadb647ce.tar.gz
phperkaigi-2025-albatross-d73fd8bf5bf589a4a391c867e980761fadb647ce.tar.zst
phperkaigi-2025-albatross-d73fd8bf5bf589a4a391c867e980761fadb647ce.zip
feat: partially implement watching
Diffstat (limited to 'backend/game/http.go')
-rw-r--r--backend/game/http.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/backend/game/http.go b/backend/game/http.go
index beda46c..1ac77b0 100644
--- a/backend/game/http.go
+++ b/backend/game/http.go
@@ -5,6 +5,7 @@ import (
"strconv"
"github.com/labstack/echo/v4"
+ // "github.com/nsfisis/iosdc-2024-albatross/backend/auth"
)
type sockHandler struct {
@@ -18,7 +19,11 @@ func newSockHandler(hubs *GameHubs) *sockHandler {
}
func (h *sockHandler) HandleSockGolfPlay(c echo.Context) error {
- // TODO: auth
+ // user := c.Get("user").(*auth.JWTClaims)
+ // if user == nil {
+ // return echo.NewHTTPError(http.StatusUnauthorized)
+ // }
+ // TODO: check user permission
gameId := c.Param("gameId")
gameIdInt, err := strconv.Atoi(gameId)
if err != nil {
@@ -34,7 +39,7 @@ func (h *sockHandler) HandleSockGolfPlay(c echo.Context) error {
if foundHub == nil {
return echo.NewHTTPError(http.StatusNotFound, "Game not found")
}
- return servePlayerWs(foundHub, c.Response(), c.Request(), "a")
+ return servePlayerWs(foundHub, c.Response(), c.Request(), 1)
}
func (h *sockHandler) HandleSockGolfWatch(c echo.Context) error {