mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
Ensure save export can be changed in the future
This commit is contained in:
@@ -78,6 +78,10 @@ type AuthData struct {
|
|||||||
PatchServer string `json:"patchServer"`
|
PatchServer string `json:"patchServer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExportData struct {
|
||||||
|
Character map[string]interface{} `json:"character"`
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) newAuthData(userID uint32, userRights uint32, userToken string, characters []Character) AuthData {
|
func (s *Server) newAuthData(userID uint32, userRights uint32, userToken string, characters []Character) AuthData {
|
||||||
resp := AuthData{
|
resp := AuthData{
|
||||||
CurrentTS: uint32(channelserver.TimeAdjusted().Unix()),
|
CurrentTS: uint32(channelserver.TimeAdjusted().Unix()),
|
||||||
@@ -373,12 +377,15 @@ func (s *Server) ExportSave(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
save, err := s.exportSave(ctx, userID, reqData.CharID)
|
character, err := s.exportSave(ctx, userID, reqData.CharID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Error("Failed to export save", zap.Error(err), zap.String("token", reqData.Token), zap.Uint32("charID", reqData.CharID))
|
s.logger.Error("Failed to export save", zap.Error(err), zap.String("token", reqData.Token), zap.Uint32("charID", reqData.CharID))
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
save := ExportData{
|
||||||
|
Character: character,
|
||||||
|
}
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(save)
|
json.NewEncoder(w).Encode(save)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user