package games import ( "net/http" "dofdev/tem" "github.com/gorilla/mux" ) type Game struct { Name string Desc string PrivacyPolicy string Notes string } var Games = map[string]Game{ "silo": { Name: "stretch silo", Desc: "a stretch cursor 360 missile defense game", PrivacyPolicy: "we do not collect store or distribute any user data", Notes: `start with air raid sirens and shouted commands shilouttes in the night (fight or flight - adrenaline) walk into futuristic vector battlestation (step up buckle down) overview of your silos and what you are protecting missiles fly in (take responsibility) *ref typhon missile system`, }, "snake": { Name: "snake in a box", Desc: "vr snake zencore", PrivacyPolicy: "we do not collect store or distribute any user data", Notes: `cute happy go lucky eating stuff older and bigger and have to deal with your past choices`, }, "vien": { Name: "vien", Desc: "hordiculture", PrivacyPolicy: "we do not collect store or distribute any user data", }, } func Handler(w http.ResponseWriter, r *http.Request) { data := struct { Games map[string]Game }{ Games: Games, } tem.Render( w, r, "games.html", "games", "dof driven games", data, ) } func GameHandler(w http.ResponseWriter, r *http.Request) { hash := mux.Vars(r)["hash"] game, ok := Games[hash] if !ok { w.WriteHeader(http.StatusNotFound) return } data := struct { Hash string Game Game }{ Hash: hash, Game: game, } tem.Render( w, r, "game.html", game.Name, game.Desc, data, ) } func PrivacyHandler(w http.ResponseWriter, r *http.Request) { hash := mux.Vars(r)["hash"] game, ok := Games[hash] if !ok { w.WriteHeader(http.StatusNotFound) return } data := struct { Hash string Game Game }{ Hash: hash, Game: game, } tem.Render( w, r, "privacy.html", "privacy", game.Name, data, ) }