dogpixels / patreon-helper

Downloads media as you browse Patreon, so you don't have to do this manually.
MIT License
22 stars 5 forks source link

Tabs open for download URLs sometimes #13

Closed BigBlueHat closed 1 year ago

BigBlueHat commented 1 year ago

The downloadable/file URL sometimes opens in a new tab and triggers a download screen. Cancelling it does seem to allow the extension to proceed and download the file. Though sometimes it'll even open them in other windows which may not have the same session--if you're using private browsing to juggle two Patreon accounts.

If the tab does get opened in a window with a different session, that download will fail (Patreon will give it a 404) and there doesn't seem to be a way to re-trigger the download...and I'm not (yet) sure what may happen if I attempt to redo that set of "pages"...but I currently fear I'll get duplicate files...

BigBlueHat commented 1 year ago

Ah. I think I found it. It's the attachments: https://github.com/dogpixels/patreon-helper/blob/master/js/background-main.js#L10

dogpixels commented 1 year ago

Glad you dug into the code and found hints on what's going on - my comment is a tad misleading: since I wrote it, I learned that the user can, in fact, automate this kind of download. I think it was by checking a "always perform this action for this kind of file" option on the file save dialogue that pops up.

Regardless, having a separate window with another session logged in is a usecase I was completely oblivious of when writing this addon. Not sure that can be handled properly.

BigBlueHat commented 1 year ago

Yep. That's probably it. I had "Always ask you where to save files" checked in Settings.

Regardless, having a separate window with another session logged in is a usecase I was completely oblivious of when writing this addon. Not sure that can be handled properly.

Probably not...sadly. It'd be better (though not sure it's possible) to pull these files in via fetch() and save them in the same way the others are saved...if possible. 😄 Might have to add them to the page in some way first.

Still digging through the code, but thanks for making and sharing this and for the explanation!