zeldadungeon / maps

Interactive maps for Zelda games
40 stars 18 forks source link

Lost many hours of completion #9

Closed vmsh0 closed 1 year ago

vmsh0 commented 3 years ago

Hi,

I recently lost many hours of completion. I don't have an exact timeline of how it happened, here's the best I can say:

I have taken a look around the source code. From the very basic understanding I got from that, the map should use local storage when ran locally or when the user is not logged in. However, I can't find anything but the settings object in local storage. So what I think happened is the session timed out while I had the map open, and when I submitted new completion markers they wouldn't be saved on the Wiki because of that, but they were also wouldn't be saved to local storage because the map thought I was logged in.

I'll see about submitting a patch to fix this, if that's something you're interested in.

vmsh0 commented 3 years ago

https://github.com/zeldadungeon/maps/blob/master/src/common/WikiConnector.ts#L156

Here lies the issue. If this.user is defined, postWithRetry is called. If the post fails, the function just returns without any notice to the user. Ouch!

vmsh0 commented 3 years ago

I stand corrected. The postWithRetry function does throw after an error response. The issue is that the API does not return an error when the user is not logged in. I'm afraid this is out of my reach.

vmsh0 commented 3 years ago

More details: when the user is not logged in, the API endpoint responds with "invalidcsrf" status. So getToken() is called, which does not result in a failure. Instead, the "+\" token is returned.