mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-03 03:27:13 +08:00
Support legacy /savedata/system/verify
This commit is contained in:
parent
f9cce330f6
commit
23c2458d8f
@ -479,15 +479,18 @@ func handleSystem(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !r.URL.Query().Has("clientSessionId") {
|
var active bool
|
||||||
httpError(w, r, fmt.Errorf("missing clientSessionId"), http.StatusBadRequest)
|
if r.URL.Path != "/savedata/system/verify" {
|
||||||
return
|
if !r.URL.Query().Has("clientSessionId") {
|
||||||
}
|
httpError(w, r, fmt.Errorf("missing clientSessionId"), http.StatusBadRequest)
|
||||||
|
return
|
||||||
active, err := db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
}
|
||||||
if err != nil {
|
|
||||||
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
active, err = db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
||||||
return
|
if err != nil {
|
||||||
|
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch r.PathValue("action") {
|
switch r.PathValue("action") {
|
||||||
@ -536,12 +539,20 @@ func handleSystem(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
case "verify":
|
case "verify":
|
||||||
var input SystemVerifyRequest
|
var input SystemVerifyRequest
|
||||||
err = json.NewDecoder(r.Body).Decode(&input)
|
if !r.URL.Query().Has("clientSessionId") {
|
||||||
if err != nil {
|
err = json.NewDecoder(r.Body).Decode(&input)
|
||||||
httpError(w, r, fmt.Errorf("failed to decode request body: %s", err), http.StatusBadRequest)
|
if err != nil {
|
||||||
return
|
httpError(w, r, fmt.Errorf("failed to decode request body: %s", err), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
active, err = db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
||||||
|
if err != nil {
|
||||||
|
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response := SystemVerifyResponse{
|
response := SystemVerifyResponse{
|
||||||
Valid: active,
|
Valid: active,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user