summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-07-25 10:58:28 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-07-25 10:59:30 -0700
commitde5b309e0f06e93a963e09ef13c369ae7deeccc9 (patch)
tree87f0dec5650648640c6fc3119f32f7631b323f53 /roseh.moe.go
parent0e9b550cbeec4192dff7f760936fe1d85056a5f6 (diff)
downloadroseh.moe-de5b309e0f06e93a963e09ef13c369ae7deeccc9.tar.zst
Port a game I wrote a long time ago to JS
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go30
1 files changed, 28 insertions, 2 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 5a35147..f16ae55 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -189,7 +189,19 @@ func index(w http.ResponseWriter, _ *http.Request) {
}
var (
- //go:embed templates/pong.html.template
+ //go:embed templates/games/index.html.template
+ gamesIndexString string
+ gamesIndexTemplate = template.Must(outlinedTemplate(gamesIndexString))
+)
+
+func gamesIndex(w http.ResponseWriter, _ *http.Request) {
+ if err := gamesIndexTemplate.Execute(w, nil); err != nil {
+ log.Printf("Waning: gamesIndex: %s", err)
+ }
+}
+
+var (
+ //go:embed templates/games/pong.html.template
pongString string
pongTemplate = template.Must(template.New("pong").Parse(pongString))
)
@@ -200,6 +212,18 @@ func pong(w http.ResponseWriter, _ *http.Request) {
}
}
+var (
+ //go:embed templates/games/stallman-shooter.html.template
+ stallmanShooterString string
+ stallmanShooterTemplate = template.Must(outlinedTemplate(stallmanShooterString))
+)
+
+func stallmanShooter(w http.ResponseWriter, _ *http.Request) {
+ if err := stallmanShooterTemplate.Execute(w, nil); err != nil {
+ log.Printf("Warning: stallmanShooter: %s", err)
+ }
+}
+
//go:embed static
var staticFiles embed.FS
@@ -897,7 +921,9 @@ func main() {
mux := http.NewServeMux()
mux.HandleFunc("GET /{$}", index)
- mux.HandleFunc("GET /pong", pong)
+ mux.HandleFunc("GET /games/", gamesIndex)
+ mux.HandleFunc("GET /games/pong", pong)
+ mux.HandleFunc("GET /games/stallman", stallmanShooter)
mux.HandleFunc("GET /qr.png", qrHandler)
mux.HandleFunc("GET /wormhole", wormhole)
mux.HandleFunc("POST /wormhole", wormholeUpload)