Open qlur opened 2 years ago
Hey thank you! I'm curious, why do you want a standalone web version of Unclutter?
There is some complexity with modifying cross-origin webpages inside of iframes -- you need to proxy every network request from the domain the rest of the code is hosted and rewrite relative URLs in the HTML to work around CORS security restrictions. I actually worked on an Nginx server for this before, potentially I could reactivate it (but then it wouldn't be completely hostable on Netlify).
Otherwise the most straightforward implementation would be to make the article iframe 100% of the window height and width. Then we possibly could inject the entire source/content-script/enhance.ts script into the iframe just as the browser does now on the extension icon click.
We would also need to change source/background/events.ts to use window.postMessage instead of browser.runtime.onMessage
and browser.runtime.sendMessage
(plus run it outside the iframe) and change browser.storage.sync
references to window.localStorage
(see this). Maybe some of this code could be removed or simplified though if there's no need for extension lifecycle hooks or user settings.
Hey @phgn0, I agree. As long as we can replicate that kind of standalone [Nginx server running it should probably be just as fine].
I went through and tried to implement with iframe as a quick hack but I ran into multiple issues. It would be great if you could create a separate repo like lindylearn/unclutter-standalone. :)
And definitely, we can make it as minimal as possible by removing all the user settings, extension lifecycles but still relies on same functionality of unclutter. Something like lindylearn/unclutter-core
And lindylearn/unclutter-standalone can use that core and so can the lindylearn/unclutter extension as dependencies. This way they still share the same lindylearn/unclutter-core core algorithm.
@saulamsal What issues did you run into specifically? Related to the extension build process or incomprehensible code organization / mixed dependencies?
Separating out the core uncluttering logic makes sense, but maybe we could also do that all in this repo? So one folder for the page modifications and helper functions, and one each for the extension and website roots.
Moving the code around sounds doable, but I'm sure it will require some changes. Unfortunately I don't have much time currently to work on this, but I'll try to get it done. Thank you!
Yeah, extension build process basically. It was totally tied to extensions last time I tried. Would be great to see it in same repo or new one, either way works.
Thanks!
Hi, This extension is fantastic! I'd be happy to contribute and provide suggestions often as I've been looking for something like this for some time. But I'm wondering if it is possible to host on something like Netlify or Vercel without the need to create extensions. For example:
Something like that should load the unclutter version of that page?