gildas-lormeau / SingleFile

Web Extension for saving a faithful copy of a complete web page in a single HTML file
GNU Affero General Public License v3.0
14.73k stars 969 forks source link

Support for Mac #569

Closed ivanfei-1 closed 1 year ago

ivanfei-1 commented 3 years ago

This app is so good and helpful! But the SingleFileMacOS isn't working on Mac OS now. plz add an Safari Extension orz.

截屏2020-12-17 上午11 29 29
gildas-lormeau commented 3 years ago

I understand your frustration. I would also like to be able to port SingleFile to Safari. The problem is that Apple requires me to have a Mac and I pay $100/year to do so. On top of that, there is also the amount of work time needed to test, debug and adapt the code. Indeed, the support of Web extensions on Safari is far from being 100% compatible with the specification. Today, these conditions are quite unacceptable from my point of view. As far as I know, many developers share my opinion, see https://twitter.com/jensimmons/status/1338558758025367553.

Edit: I didn't know they managed to break SingleFileMacOS in the process.

warichnict commented 3 years ago

just use Opera, Firefox or SRWare Iron on your fancy box. safari is not a browser for a pro but for a rich and fancy user ;)

pro users want to use pro products, pro products are most times free (cause paid is most time outdated bloatware), so if your system dosnt support free software anymore (apple lost interest after osx 10.6 or so, lion was the first killer for any free exchange) but just creating a garden for the rich but dumb folks...

ogirginc commented 3 years ago

I would also like to be able to port SingleFile to Safari. The problem is that Apple requires me to have a Mac and I pay $100/year to do so. On top of that, there is also the amount of work time needed to test, debug and adapt the code.

@gildas-lormeau would you consider found raising? For example, I have contributed to https://github.com/sindresorhus/refined-github/issues/3686. I can't say how many are willing to pay for this, but you can count me in. :)

gildas-lormeau commented 3 years ago

@ogirginc Thank you for your support! In fact, I'm already accepting donations for people who want to support SingleFile. I might agree to the principle of paying the annual fee through these donations. However, it doesn't solve the Mac problem. I still have a little trouble accepting that Apple forces me to buy one to develop a Web Extension, which is supposed to be portable. It's not a problem of money but a matter of principle.

unphased commented 2 years ago

I think that it would be possible to make a Safari extension that does something super simple which is to export the visited URL plus cookie state that pushes to either a local process or server which in turn runs SingleFile on a headless browser to generate the output.

I suppose this only probably seems like a reasonable approach for me, because I'm looking to use this library in a pretty specific way: I want to auto save/record all visited pages as a kind of maximally comprehensive browsing history. My plan is to build more layers on top of this big pile of data, such as filtering it down for textual content only, and then making that available for indexing for search. It's about time that we graduate from relying on our brains to recall things that we've seen in the past and let our computers do this for us. Modern machines are capable of accomplishing the task of accurately recalling any content whatsoever that might have made its way through your browser through your whole lifetime, and disk space is really the only limiting factor. As you can see my goal is not perfectly aligned with that of SingleFile but it really is very well aligned, because having the resources embedded while not resorting to convert the page into a PDF or image is by far the most elegant way to create a preserved snapshot of webpages. The historical resilience of these snapshots is a big part of the attraction to me since i feel like it would be a far simpler problem to solve to merely extract textual content. Anyway, I digress.

As part of the effort to cover browsing across all devices in this web browsing dragnet, I must include Safari (and in particular iOS Mobile Safari) as a lot of my time browsing is spent on apple devices. Since they are for the most part mobile devices I would prefer to avoid the added energy impact of executing the export work locally. I also have a hunch that the puppeteer codepath is less convoluted and breakage-prone compared to the extension + companion codepath. I have a lot of trouble when it comes to debugging browser extensions. There's just a lot of behavior in the chrome devtools that don't click for me for them.

gildas-lormeau commented 1 year ago

Hello Safari users. I wanted to keep you informed about this. Thanks to donations, I'll be able to buy a Mac and port SingleFile to Safari. I'm going to buy it in the next few days, I hope I'll have some good news soon!

gildas-lormeau commented 1 year ago
image

I have a Mac (my first Mac, as well)! It's a MacBook Pro M2 with 16GB of RAM. I must admit it runs well and is also very quiet (edit: I've just learned that it has no fans..., edit 2: it does have fans).

Regarding SingleFile. I have some good and bad news.

The bad news is that the Manifest V3 version of SingleFile (aka SingleFile Lite) does not work at all. It's also impossible to debug it right now. The Manifest V3 support seems very poor in Safari currently.

The good news is that the Manifest V2 version of SingleFile runs almost as is. Although, the major problem is that Safari does not offer to extensions any API to download files (see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/download). I didn't know it and that's extremely regrettable, maybe I should have read the doc before buying this nice Mac... SingleFile has an option to download pages in "foreground" that can be used to circumvent this kind of issue. It somewhat helps but an annoying popup forces the user to confirm the download every time a page is saved.

I suppose I'll need to learn how to code in Swift in order to circumvent the lack of the downloads API in Safari. It will be a little bit more complicated than expected...

unphased commented 1 year ago

Awesome! Enjoy your new machine. Thanks for looking into this.

gildas-lormeau commented 1 year ago

I released on GitHub the code of the extension for Safari here: https://github.com/gildas-lormeau/SingleFile-Safari-Extension. You can test it if you want/can. Any feedback is appreciated :). Note that some features can't work in Safari so they've been removed. It could be called "SingleFile Lite--".

gildas-lormeau commented 1 year ago

The extension is now available for download on the Mac App Store, see https://apps.apple.com/us/app/singlefile-for-safari/id6444322545

gildas-lormeau commented 1 year ago

I'm closing the issue because it's fixed. Note that you can still post comments though, I will be notified. Of course, you can also create issues if you find bugs :p.

gildas-lormeau commented 1 year ago

Update: Hopefully and if the review goes well, SingleFile should be available on iOS as well in the coming days.

gildas-lormeau commented 1 year ago

It's published for iOS :)

Wildphinn commented 1 year ago

Just wanted to say thanks for releasing SingleFile on Safari. It's been the biggest thing I had been missing on that browser. Now I can use it perfectly content!