~nromdotcom/gemif

dac43d27adde12ee7350a4c9d5d214370161ddbc — Norm MacLennan 11 months ago d1d393a
Pipe app version through to index page
M cmd/gemif/main.go => cmd/gemif/main.go +1 -0
@@ 54,6 54,7 @@ func main() {
		Port:     gsConfig.Get("port").(int64),
		CertFile: gsConfig.Get("cert_file").(string),
		KeyFile:  gsConfig.Get("key_file").(string),
		Version:  appVersion,
	}

	fmt.Printf("Starting %s %s (%s) - built %s\n\n", appName, appVersion, appCommit, buildTime)

M pkg/gemserver/router.go => pkg/gemserver/router.go +1 -1
@@ 30,7 30,7 @@ func StartRouter(gm *gamemanager.GameManager, gc ServerConfig) {
		templates: tmpl,
	}

	g.Handle("/", handleHome(gm))
	g.Handle("/", handleHome(gm, gc.Version))
	g.Handle("/game/:statetoken", handleGame(gm, sceneRenderer))
	g.Handle("/docs*", handleStatic)
	g.Handle("/robots.txt", handleRobots)

M pkg/gemserver/routes.go => pkg/gemserver/routes.go +2 -1
@@ 38,7 38,7 @@ func handleStatic(c gig.Context) error {
	return c.Gemini(string(sl))
}

func handleHome(gm *gamemanager.GameManager) func(gig.Context) error {
func handleHome(gm *gamemanager.GameManager, version string) func(gig.Context) error {
	return func(c gig.Context) error {
		stories := gm.GetStories()



@@ 50,6 50,7 @@ func handleHome(gm *gamemanager.GameManager) func(gig.Context) error {
		return c.Render("gemif:/static/templates/index.gmi.tmpl", map[string]interface{}{
			"Stories": startStates,
			"Banner":  getRandomBanner(),
			"Version": version,
		})
	}
}

M pkg/gemserver/serverconfig.go => pkg/gemserver/serverconfig.go +1 -0
@@ 6,4 6,5 @@ type ServerConfig struct {
	Port     int64
	CertFile string
	KeyFile  string
	Version  string
}

M static/templates/index.gmi.tmpl => static/templates/index.gmi.tmpl +2 -0
@@ 1,4 1,6 @@
{{.Banner}}
v{{.Version}}

GemIF is a simple Interactive Fiction engine for Gemini (think: twine but with fewer features).

Each story below is represented as a (relatively-) simple YAML file describing the scenes and transitions.