aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-10 00:14:17 +0900
committernsfisis <nsfisis@gmail.com>2024-08-10 00:14:17 +0900
commitb450648caa0d1bd5c91e67a33153bbacaf57f006 (patch)
tree8dce01b8eb398759a3abdb97d3d333b52738c768 /backend
parenta7342525e5e4052113e6d5e75b6fd50c91687514 (diff)
downloadphperkaigi-2025-albatross-b450648caa0d1bd5c91e67a33153bbacaf57f006.tar.gz
phperkaigi-2025-albatross-b450648caa0d1bd5c91e67a33153bbacaf57f006.tar.zst
phperkaigi-2025-albatross-b450648caa0d1bd5c91e67a33153bbacaf57f006.zip
feat: prepend base path
Diffstat (limited to 'backend')
-rw-r--r--backend/admin/handler.go4
-rw-r--r--backend/admin/templates/base.html6
-rw-r--r--backend/admin/templates/dashboard.html6
-rw-r--r--backend/admin/templates/game_edit.html2
-rw-r--r--backend/admin/templates/games.html4
-rw-r--r--backend/admin/templates/user_edit.html2
-rw-r--r--backend/admin/templates/users.html4
-rw-r--r--backend/main.go12
8 files changed, 20 insertions, 20 deletions
diff --git a/backend/admin/handler.go b/backend/admin/handler.go
index b50b942..7239b08 100644
--- a/backend/admin/handler.go
+++ b/backend/admin/handler.go
@@ -37,11 +37,11 @@ func newAdminMiddleware() echo.MiddlewareFunc {
return func(c echo.Context) error {
jwt, err := c.Cookie("albatross_token")
if err != nil {
- return c.Redirect(http.StatusSeeOther, "/login")
+ return c.Redirect(http.StatusSeeOther, "/iosdc-japan/2024/code-battle/login")
}
claims, err := auth.ParseJWT(jwt.Value)
if err != nil {
- return c.Redirect(http.StatusSeeOther, "/login")
+ return c.Redirect(http.StatusSeeOther, "/iosdc-japan/2024/code-battle/login")
}
if !claims.IsAdmin {
return echo.NewHTTPError(http.StatusForbidden)
diff --git a/backend/admin/templates/base.html b/backend/admin/templates/base.html
index 4bcdbdd..49e2066 100644
--- a/backend/admin/templates/base.html
+++ b/backend/admin/templates/base.html
@@ -2,9 +2,9 @@
<html>
<head>
<title>ADMIN {{ .Title }} | iOSDC Japan 2024 Albatross.swift</title>
- <link rel="icon" href="/favicon.svg">
- <link rel="stylesheet" href="/admin/css/normalize.css">
- <link rel="stylesheet" href="/admin/css/sakura.css">
+ <link rel="icon" href="/iosdc-japan/2024/code-battle/favicon.svg">
+ <link rel="stylesheet" href="/iosdc-japan/2024/code-battle/admin/css/normalize.css">
+ <link rel="stylesheet" href="/iosdc-japan/2024/code-battle/admin/css/sakura.css">
</head>
<body>
<section>
diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html
index cdb8ba1..b2037cb 100644
--- a/backend/admin/templates/dashboard.html
+++ b/backend/admin/templates/dashboard.html
@@ -2,12 +2,12 @@
{{ define "content" }}
<p>
- <a href="/admin/users">Users</a>
+ <a href="/iosdc-japan/2024/code-battle/admin/users">Users</a>
</p>
<p>
- <a href="/admin/games">Games</a>
+ <a href="/iosdc-japan/2024/code-battle/admin/games">Games</a>
</p>
-<form method="post" action="/logout">
+<form method="post" action="/iosdc-japan/2024/code-battle/logout">
<button type="submit">Logout</button>
</form>
{{ end }}
diff --git a/backend/admin/templates/game_edit.html b/backend/admin/templates/game_edit.html
index 108ae99..f40cc5d 100644
--- a/backend/admin/templates/game_edit.html
+++ b/backend/admin/templates/game_edit.html
@@ -1,7 +1,7 @@
{{ template "base.html" . }}
{{ define "breadcrumb" }}
-<a href="/admin/dashboard">Dashboard</a> | <a href="/admin/games">Games</a>
+<a href="/iosdc-japan/2024/code-battle/admin/dashboard">Dashboard</a> | <a href="/iosdc-japan/2024/code-battle/admin/games">Games</a>
{{ end }}
{{ define "content" }}
diff --git a/backend/admin/templates/games.html b/backend/admin/templates/games.html
index 47dc4a3..0616938 100644
--- a/backend/admin/templates/games.html
+++ b/backend/admin/templates/games.html
@@ -1,14 +1,14 @@
{{ template "base.html" . }}
{{ define "breadcrumb" }}
-<a href="/admin/dashboard">Dashboard</a>
+<a href="/iosdc-japan/2024/code-battle/admin/dashboard">Dashboard</a>
{{ end }}
{{ define "content" }}
<ul>
{{ range .Games }}
<li>
- <a href="/admin/games/{{ .GameID }}">
+ <a href="/iosdc-japan/2024/code-battle/admin/games/{{ .GameID }}">
{{ .DisplayName }} (id={{ .GameID }} type={{ .GameType }} state={{ .State }})
</a>
</li>
diff --git a/backend/admin/templates/user_edit.html b/backend/admin/templates/user_edit.html
index bde7c84..56ecbc8 100644
--- a/backend/admin/templates/user_edit.html
+++ b/backend/admin/templates/user_edit.html
@@ -1,7 +1,7 @@
{{ template "base.html" . }}
{{ define "breadcrumb" }}
-<a href="/admin/dashboard">Dashboard</a> | <a href="/admin/users">Users</a>
+<a href="/iosdc-japan/2024/code-battle/admin/dashboard">Dashboard</a> | <a href="/iosdc-japan/2024/code-battle/admin/users">Users</a>
{{ end }}
{{ define "content" }}
diff --git a/backend/admin/templates/users.html b/backend/admin/templates/users.html
index 656ad53..3543457 100644
--- a/backend/admin/templates/users.html
+++ b/backend/admin/templates/users.html
@@ -1,14 +1,14 @@
{{ template "base.html" . }}
{{ define "breadcrumb" }}
-<a href="/admin/dashboard">Dashboard</a>
+<a href="/iosdc-japan/2024/code-battle/admin/dashboard">Dashboard</a>
{{ end }}
{{ define "content" }}
<ul>
{{ range .Users }}
<li>
- <a href="/admin/users/{{ .UserID }}">
+ <a href="/iosdc-japan/2024/code-battle/admin/users/{{ .UserID }}">
{{ .DisplayName }} (id={{ .UserID }} username={{ .Username }}){{ if .IsAdmin }} <em>admin</em>{{ end }}
</a>
</li>
diff --git a/backend/main.go b/backend/main.go
index 575c3f8..c01394b 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -38,7 +38,7 @@ func main() {
log.Fatalf("Error loading env %v", err)
}
- openAPISpec, err := api.GetSwaggerWithPrefix("/api")
+ openAPISpec, err := api.GetSwaggerWithPrefix("/iosdc-japan/2024/code-battle/api")
if err != nil {
log.Fatalf("Error loading OpenAPI spec\n: %s", err)
}
@@ -69,7 +69,7 @@ func main() {
log.Fatalf("Error restoring game hubs from db %v", err)
}
defer gameHubs.Close()
- sockGroup := e.Group("/sock")
+ sockGroup := e.Group("/iosdc-japan/2024/code-battle/sock")
sockHandler := gameHubs.SockHandler()
sockGroup.GET("/golf/:gameID/play", func(c echo.Context) error {
return sockHandler.HandleSockGolfPlay(c)
@@ -78,22 +78,22 @@ func main() {
return sockHandler.HandleSockGolfWatch(c)
})
- apiGroup := e.Group("/api")
+ apiGroup := e.Group("/iosdc-japan/2024/code-battle/api")
apiGroup.Use(oapimiddleware.OapiRequestValidator(openAPISpec))
apiHandler := api.NewHandler(queries, gameHubs)
api.RegisterHandlers(apiGroup, api.NewStrictHandler(apiHandler, nil))
adminHandler := admin.NewHandler(queries, gameHubs)
- adminGroup := e.Group("/admin")
+ adminGroup := e.Group("/iosdc-japan/2024/code-battle/admin")
adminHandler.RegisterHandlers(adminGroup)
// For local dev: This is never used in production because the reverse
// proxy sends /login and /logout to the app server.
e.GET("/login", func(c echo.Context) error {
- return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/login")
+ return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/iosdc-japan/2024/code-battle/login")
})
e.POST("/logout", func(c echo.Context) error {
- return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/logout")
+ return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/iosdc-japan/2024/code-battle/logout")
})
go gameHubs.Run()