From cde572d626e60df213a281168b7927a2e4511534 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 30 Apr 2024 13:39:06 -0400 Subject: [PATCH] Revert "Fix data override prevention on update" This reverts commit 52756fdba34b991c7cb11f81a1fa3a8b62a59100. --- api/endpoints.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/api/endpoints.go b/api/endpoints.go index f066efa..bc6eb25 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -279,29 +279,29 @@ func handleSaveData(w http.ResponseWriter, r *http.Request) { } } - if active || r.URL.Path == "/savedata/get" { - switch r.URL.Path { - case "/savedata/get": - save, err = savedata.Get(uuid, datatype, slot) - case "/savedata/update": - err = savedata.Update(uuid, slot, save) - case "/savedata/delete": - err = savedata.Delete(uuid, datatype, slot) - case "/savedata/clear": - s, ok := save.(defs.SessionSaveData) - if !ok { - err = fmt.Errorf("save data is not type SessionSaveData") - break - } - - // doesn't return a save, but it works - save, err = savedata.Clear(uuid, slot, daily.Seed(), s) + switch r.URL.Path { + case "/savedata/get": + save, err = savedata.Get(uuid, datatype, slot) + case "/savedata/update": + err = savedata.Update(uuid, slot, save) + case "/savedata/delete": + err = savedata.Delete(uuid, datatype, slot) + case "/savedata/clear": + if !active { + // TODO: make this not suck + save = savedata.ClearResponse{Error: "session out of date"} + break } - } else { - // TODO: make this not suck - save = savedata.ClearResponse{Error: "session out of date"} - } + s, ok := save.(defs.SessionSaveData) + if !ok { + err = fmt.Errorf("save data is not type SessionSaveData") + break + } + + // doesn't return a save, but it works + save, err = savedata.Clear(uuid, slot, daily.Seed(), s) + } if err != nil { httpError(w, r, err, http.StatusInternalServerError) return