Skip to content

Commit

Permalink
feat: use separate API call for closing app
Browse files Browse the repository at this point in the history
  • Loading branch information
dessant committed Mar 2, 2019
1 parent 1fc6485 commit 7163fcd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/setup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ func installHandler(res http.ResponseWriter, req *http.Request) {
}

res.WriteHeader(http.StatusOK)
} else {
panic(http.ErrAbortHandler)
}
} else {
panic(http.ErrAbortHandler)
}
}

func closeHandler(res http.ResponseWriter, req *http.Request) {
if req.Method == "POST" {
if isValidSession(req.FormValue("session")) {
res.WriteHeader(http.StatusOK)
go exit()
} else {
panic(http.ErrAbortHandler)
Expand Down Expand Up @@ -305,6 +317,7 @@ func main() {
mux.HandleFunc("/buster/setup", initHandler)
mux.HandleFunc("/api/v1/setup/location", locationHandler)
mux.HandleFunc("/api/v1/setup/install", installHandler)
mux.HandleFunc("/api/v1/setup/close", closeHandler)
mux.HandleFunc("/", notFoundHandler)

server = &http.Server{
Expand Down

0 comments on commit 7163fcd

Please sign in to comment.