mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-05-23 11:26:17 +08:00
Various cleanup in endpoints.go
This commit is contained in:
parent
ef9b659127
commit
7da9a39e1b
@ -144,7 +144,7 @@ func handleGameTitleStats(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleGameClassicSessionCount(w http.ResponseWriter, r *http.Request) {
|
func handleGameClassicSessionCount(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte(strconv.Itoa(classicSessionCount)))
|
fmt.Fprint(w, classicSessionCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSession(w http.ResponseWriter, r *http.Request) {
|
func handleSession(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -179,12 +179,12 @@ func handleSession(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.PathValue("action") {
|
switch r.PathValue("action") {
|
||||||
case "get":
|
case "get":
|
||||||
save, err := savedata.GetSession(uuid, slot)
|
save, err := savedata.GetSession(uuid, slot)
|
||||||
|
if err != nil {
|
||||||
if errors.Is(err, savedata.ErrSaveNotExist) {
|
if errors.Is(err, savedata.ErrSaveNotExist) {
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
httpError(w, r, err, http.StatusInternalServerError)
|
httpError(w, r, err, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -398,10 +398,10 @@ func handleSystem(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, savedata.ErrSaveNotExist) {
|
if errors.Is(err, savedata.ErrSaveNotExist) {
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
} else {
|
return
|
||||||
httpError(w, r, fmt.Errorf("failed to get system save data: %s", err), http.StatusInternalServerError)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
httpError(w, r, fmt.Errorf("failed to get system save data: %s", err), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,10 +489,7 @@ func handleDailySeed(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = w.Write([]byte(seed))
|
fmt.Fprint(w, seed)
|
||||||
if err != nil {
|
|
||||||
httpError(w, r, fmt.Errorf("failed to write seed: %s", err), http.StatusInternalServerError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDailyRankings(w http.ResponseWriter, r *http.Request) {
|
func handleDailyRankings(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -541,7 +538,7 @@ func handleDailyRankingPageCount(w http.ResponseWriter, r *http.Request) {
|
|||||||
httpError(w, r, err, http.StatusInternalServerError)
|
httpError(w, r, err, http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Write([]byte(strconv.Itoa(count)))
|
fmt.Fprint(w, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect link after authorizing application link
|
// redirect link after authorizing application link
|
||||||
|
Loading…
x
Reference in New Issue
Block a user