Add a home page (#113)

This commit is contained in:
Jesse Peterson
2017-03-21 22:35:21 -07:00
committed by GitHub
parent 82d1686436
commit caa3b31f98

View File

@@ -51,6 +51,24 @@ import (
"github.com/micromdm/micromdm/queue"
)
const homePage = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MicroMDM</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
</style>
</head>
<body>
<h3>Welcome to MicroMDM!</h3>
<p><a href="mdm/enroll">Enroll a device</a></p>
</body>
</html>
`
const configDBPath = "/var/db/micromdm"
func serve(args []string) error {
@@ -167,6 +185,9 @@ func serve(args []string) error {
r.Handle("/scep", scepHandler)
r.Handle("/push/{udid}", pushHandlers.PushHandler)
r.Handle("/v1/commands", commandHandlers.NewCommandHandler).Methods("POST")
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, homePage)
})
if *flRepoPath != "" {
r.PathPrefix("/repo/").Handler(http.StripPrefix("/repo/", http.FileServer(http.Dir(*flRepoPath))))