ttu-ttu / ebook-reader

Online e-book reader that supports Yomichan
https://reader.ttsu.app
BSD 3-Clause "New" or "Revised" License
698 stars 64 forks source link

Clearing History & Cookies Loses Book Progres #343

Closed aramrw closed 1 day ago

aramrw commented 3 months ago

I have my book data saved to Google Drive, however I cleared my history & cookies and now my book got reset 0% and I lost where I was at...

Also I thought I would also mention that data differs between browsers & mobile as well (I tested it with Chrome, Edge, and Arc browsers) which I'm guessing is also the reason why I lost my progress after clearing my history.

Edit: Also it looks like all my settings got cleared as well, including my stats...

Google Chrome v126.0.6478.127 (Official Build) (64bit)

Renji-XD commented 3 months ago

hi,

not 100% sure what you want to report / what response you expect so just let me comment on your points

aramrw commented 3 months ago

As you said yourself - with the wipe you cleared also your settings. so you probably did not re enabled the sync or have not re enabled gdrive as sync target. Then you probably reloaded the book locally or opened an old version which created a fresh entry with more recent timestamps which therefore overwrote the data after reenabling the sync.

You were right, I didn't have auto import & export set.

  1. I set Auto Import & Export to All.
  2. Set ttu-gdrive-default as sync target.

Now, it does show the correct location (red bar at the bottom of the cover of the book), however if I actually go back into the book, I am back on the first page.

If you want I can recreate these steps again and record a video?

Renji-XD commented 3 months ago

if you are talking about a position between images then i guess it is not supported because the progress only works on text.

try to scroll to some location where the counter in the right corner bottom has changed and set a boomark. then you can trigger a manual sync by clicking on that cloud icon in the left bottom corner. If you now refresh the page you should still be there and if you refresh it on an other browser (remember - going to manager will do a new bookmark which would overwrite the old one on gdrive, so just f5 or whatever) you should also land somewhere close there (can also have small delay until gdrive sees the change - if the last part on the filename before .json on gdrive matches the progress in browser 1 you know its safe to test)

aramrw commented 3 months ago

try to scroll to some location where the counter in the right corner bottom has changed and set a boomark. then you can trigger a manual sync by clicking on that cloud icon in the left bottom corner.

You can see the red line (when selecting the book) is at the correct spot so the data is loading (i believe so right???) But it starts me back at the beginning? I tried reloading, waiting, nothing, always at page 1. Am I still doing something wrong?

https://github.com/ttu-ttu/ebook-reader/assets/106574385/dcb9c267-2306-48e5-9022-bfe3411bfff7

Renji-XD commented 3 months ago

no that looks fine - and the same exact steps also seems to work on my site. i guess the only "interesting" difference to my previous test was that you read from the external storage and not synced it down before. But both ways seems to be fine on my side.

i guess what you could check and share is:

aramrw commented 3 months ago

Before clearing cookies

progress_1_6_1720132283555_0.7190132654344272.json

{
  "dataId": 1,
  "exploredCharCount": 91493,
  "progress": 0.7190132654344272, 
  "lastBookmarkModified": 1720132283555
}

After clearing cookies:

progress_1_6_1720132283555_0.7190132654344272.json's values are the exact same in Google Drive.

Errors:

I have no sort of ad block installed or any extensions that aren't local.

▼ Cross-Origin-Opener-Policy policy would block the window.closed call.
    clearAuthData @ store.o6di8xEP.js

(x2).

All network requests to googleapis return 200. No entries exist in the bookmark store.

Renji-XD commented 3 months ago

have you tested this time at 91493 character position (just asking as the video was at 10k)?

the network request with "fields=files(id,name,thumbnailLink,parents)" in the url - when you check the response. does it have the progress file in the file list?

Also just to double check - an entry for the book under the data item exists or not and does it have "ttu-gdrive-default" as storageSource value?

aramrw commented 3 months ago

have you tested this time at 91493 character position (just asking as the video was at 10k)?

Yes the data is correctly being exported to Google Drive but not from it seems the network request with "fields=files(id,name,thumbnailLink,parents)" in the url - when you check the response. does it have the progress file in the file list?

googleapis.com/drive/v3/files?corpora=user&spaces=drive&fields=files%28id%2Cname%29%2CnextPageToken&q=trashed%3Dfalse+and+mimeType%3D%27application%2Fvnd.google-apps.folder%27+and+%271ed6JHl-eseC3VXBz0OR8LSXP3TVTvRFE%27+in+parents

{
"files": [
{
"id": "1jshXA5ArsXCL0eL3_Vors2mkjtcF-ygx",
"name": "恥知らずのパープルヘイズ―ジョジョの奇妙な冒険より―"
}
]
}

_googleapis.com/drive/v3/files?corpora=user&spaces=drive&fields=files%28id%2Cname%2CthumbnailLink%2Cparents%29%2CnextPageToken&q=trashed%3Dfalse+and+%28%271jshXA5ArsXCL0eL3Vors2mkjtcF-ygx%27+in+parents%29P

{
"files": [
{
"parents": [
"1jshXA5ArsXCL0eL3_Vors2mkjtcF-ygx"
],
"id": "16hAzRQFpwBmBP22OSegI_55HLOTKh5yG",
"name": "progress_1_6_1720132524359_0.7190132654344272.json"
},
{
"parents": [
"1jshXA5ArsXCL0eL3_Vors2mkjtcF-ygx"
],
"id": "1zGTnAKACwqIwd9E6VpzHBz0v8ve_rd5o",
"name": "bookdata_1_6_73456_1715750629182_1720132517073.zip"
},
{
"parents": [
"1jshXA5ArsXCL0eL3_Vors2mkjtcF-ygx"
],
"thumbnailLink": "https://lh3.googleusercontent.com/drive-storage/AJQWtBN9ltmDtmkpTWDlalMu83MWbEj_8oMJdWGBMZ77w9j3EK6022H4LPbY0rZYBMjqG9T30lLvoBZOzIMe-mLFZbcTlfTyu1YoySV8JyfZCWjtom0=s220",
"id": "1puNPG1U2PxZM_AHXRLU5NCqsLyO46T-2",
"name": "cover_1_5.jpeg"
}
]
}

Also just to double check - an entry for the book under the data item exists or not and does it have "ttu-gdrive-default" as storageSource value?

So you mean IndexedDB/books/data/item? Every store inside IndexedDB (audioBook, bookmark, handle, lastItem etc) is empty

Renji-XD commented 3 months ago

it is IndexedDB/books/data/ => it was also more rethorical because this has to exist technically.. otherwise the reader would just jump back to the manager. so try to open the devtools after the book was loaded and then check the indexeddb (network / console we should have covered).

Whole thing is very strange cause everything left should be in error handlers which would popup an error dialog.. so right now my assumption is the indexeddb view was not refreshed and you have the data but for whatever reason it does not scroll (which is probably not further debugable in this way i am afraid)

aramrw commented 3 months ago

Whole thing is very strange cause everything left should be in error handlers which would popup an error dialog.. so right now my assumption is the indexeddb view was not refreshed and you have the data but for whatever reason it does not scroll (which is probably not further debugable in this way i am afraid)

Alright. I appreciate the help, for me it's actually not a big deal I just wanted to see what was up with it 👍🏼

I will do more tests on other browsers/another pc/my phone later If I find anything I'll let you know

Renji-XD commented 3 months ago

sure - you could also "just for fun" test out if syncing the book itself to the browser and then opening from browser view aka locally will sync the other data probably .. maybe that works for you.

also if it turns out you have the bookmark but it just not scrolls to it there is a return to bookmark icon in the header (or keybind r) - would be strange if that one would work but who knows O_O

Renji-XD commented 1 day ago

as discussed there is probably no real way to debug further and it doesn't seem to be a global issue - therefore i will close this issue for now. feel free to open a new one in case you have updates or other information to check