gildas-lormeau / SingleFileZ

Web Extension to save a faithful copy of an entire web page in a self-extracting ZIP file
GNU Affero General Public License v3.0
1.82k stars 138 forks source link

Tool to batch convert SingleFileZ files to SingleFile files or vice-versa? #147

Open nitincodery opened 1 year ago

nitincodery commented 1 year ago

I really liked zipped single file version to use in my workflow as it saves space and gives out resources if needed, but using them over phone is a mess. Also, the loading time of pages is slow due to unzipping its contents. So I thought, if there would be a tool to batch convert the SFZs into SFs or vice-versa, it would be great. Because, SFs are useful for sharing and using on phones. SFZs are useful for its unzipping resources accessiblity and saving space.

Downloading both the files for each tab manually or via auto save option or via cli is slow, instead why not have a cron job to convert them in background?

gildas-lormeau commented 1 year ago

There is a way to convert SFZ to SF pages, see https://gist.github.com/gildas-lormeau/f05b65a8654587ea89857c0213d809a9. Saving a SFZ page with SingleFile should also work. Note also that SingleFileZ should fully work on Firefox for Android.

nitincodery commented 1 year ago

What do you mean by "Saving SFZ page with SingleFile should also work."?

Yeah, thanks a ton for the tool to convert it, it should be added to SingleFIleZ ReadMe?

Also, thanks for the android input, but if that tools batch convert SFZs into SF then it would be more easy and less mess.

gildas-lormeau commented 1 year ago

What do you mean by "Saving SFZ page with SingleFile should also work."?

Sorry, forget about my remark, it is not relevant.

Yeah, thanks a ton for the tool to convert it, it should be added to SingleFIleZ ReadMe?

Yes, it should.

nitincodery commented 1 year ago

There is a way to convert SFZ to SF pages, see https://gist.github.com/gildas-lormeau/f05b65a8654587ea89857c0213d809a9. Saving a SFZ page with SingleFile should also work. Note also that SingleFileZ should fully work on Firefox for Android.

It's not working on Firefox for Android, So I tried, Kiwi Browser and Yandex Browser (with extension installed and allowed to open file urls) but neither of them works.

On Kiwi Browser, we can open developer tools it shows this error while opening SFZ file:

Access to XMLHttpRequest at 'content://org.telegram.messenger.web.provider/media/Telegram/Telegram%20Files/Page.zip.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.

Page.zip.html:1 Failed to load resource: net::ERR_FAILED 

The SFZ file is downloaded from telegram, it works on desktop, so telegram doesn't affects SFZ file format.

Also, when using SFZ from file manager, the error persists, just the path changes to: content://com.mi.android.globalFileexplorer.myprovider/external_files/Download/Telegram/Page.zip.html So, it doesn't work for local files either.

Edit: Using Termux and Python to start http server in SFZ files folder, I was able to view SFZ files without any issues on both Kiwi and Yandex browsers.

But I was surprised, when the file was working on Chrome, Brave and Firefox too which doesn't support installing extensions.

So, on android browsers it is working without installing SFZ extension, on every browser as long as its served over http.

nitincodery commented 1 year ago

Saving a SFZ page with SingleFile should also work.

This is implemented now as mentioned here: https://gildas-lormeau.github.io/singlefile-updates/version-1-22.html, right?

Which also fixes #146, as now SingleFile uses SingleFileZ file format too, there's no need of its companion?

So SingleFileZ becomes obsolete, with this new update of SingleFile?

gildas-lormeau commented 1 year ago

Actually, I didn't check if the companion works with the new formats yet. I confirm SingleFileZ will become obsolete. You'll be notified when this happens via an announcement page at the time of the last update. For the moment, I don't know when this will happen.