Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Version 4.x Beta #164

Closed
quoid opened this issue Nov 14, 2021 · 8 comments
Closed

macOS Version 4.x Beta #164

quoid opened this issue Nov 14, 2021 · 8 comments

Comments

@quoid
Copy link
Owner

quoid commented Nov 14, 2021

Currently the macOS version 4.x beta is in Testflight review. If you have time and would like to test out the new features please sign up here: https://forms.gle/cUDtKg1ip4Vc9Xhc7

Testflight will be needed to test the macOS app. Version 4.x will only be distributed through the app store (not my decision) and will only be available for users running macOS 12.0+.

I will update this issue soon to include more details about the new features, but for now, here's a quick list:

  • extension rebuilt WebExtension api
  • popup now has rich functionality
  • custom api methods like openTab and closeTab (more to come)
  • context menu scripts
  • many misc. code and style updates
@quoid quoid added the beta label Nov 14, 2021
@quoid quoid pinned this issue Nov 14, 2021
@quoid
Copy link
Owner Author

quoid commented Nov 16, 2021

Here's some screenshots to try and lure some people into testing 😄 🙏

New Popup
Screen Shot 2021-11-14 at 3 55 07 PM

Same UI for the Editor
Screen Shot 2021-11-14 at 3 56 07 PM

@v7rzlhb3xg
Copy link

v7rzlhb3xg commented Dec 1, 2021

This is more of a general question, but where are things like saved settings or preferences for particular user scripts stored? Is that something that the Userscripts app determines? I ask because I've noticed that the preferences I've saved for user scripts don't persist if I just clear my recent (past hour, for example) Safari browsing history. Not a huge problem as it's pretty trivial to export/import my preferences in the case they do get wiped, but just wondering if there's a way this can be mitigated.

@quoid
Copy link
Owner Author

quoid commented Dec 2, 2021

@v7rzlhb3xg

but where are things like saved settings or preferences for particular user scripts stored?

Can you elaborate on this and give me an example of a setting/preference for a specific user script? The only settings for the app/extension are in the settings modal and those are app/extension specific settings (not scoped to the individual userscript).

I ask because I've noticed that the preferences I've saved for user scripts don't persist if I just clear my recent (past hour, for example) Safari browsing history.

I'll know more about this when you give me the example mentioned above, but just to note on the app/extension settings - those are not stored in the browser, but rather in a json file in your file system at <User>/Library/Containers/Userscripts/Data/Documents/manifest.json (for beta v4+). Also note, if that file is manually edited, it could mess things up 😄

@v7rzlhb3xg
Copy link

Sure! Here's a script I'm experiencing the issue with: https://github.com/ccd0/4chan-x

Steps to replicate:

  1. Install 4chan-X userscript
  2. Go to https://lainchan.org/music/catalog.html -- if the userscript's preferences panel isn't already open, click the 'wrench' icon at the right of the user script's toolbar at the top of the page.

Screen Shot 2021-12-01 at 8 08 31 PM

  1. Enable/disable whichever preferences you'd like and refresh page to take effect. It's not really important what you change, as long as you note what you've changed so you can see that it doesn't persist.

Screen Shot 2021-12-01 at 8 09 08 PM

  1. Menu Bar > Safari > History > Clear History... > Clear the last hour
  2. Revisit https://lainchan.org/music/catalog.html and observe that the previous preferences did not persist, and the userscript is set back to its default settings.

Let me know if there's anything else you need!

@quoid
Copy link
Owner Author

quoid commented Dec 2, 2021

@v7rzlhb3xg

I think it's important to point out that all of that functionality and settings/saving with that userscript has to do with that userscript and not this app/extension. That being said I will take a shot and why that might be happening - I am not intimately familiar with it's codebase, so keep that in mind.

That userscript is using GM.setValue - which is a new api feature included in this extension. I assume this is how 4chan-X is saving data between sessions. GM.setValue stores data in a WebExtension's localStorage (for this extension) and with other extension either localStorage or an IndexedDB. With both localStorage or IndexedDB when you clear "website data" in Safari (settings > privacy > Manage Website Data... > Remove) it will clear those values for webpages.

For WebExtensions, like this one, the storage api is used. This should protect the saved data when a user removes data as mentioned above.

I digressed a little bit, but I just wanted to give you some background.

If I am correct about the method that 4chan-X uses to save data, then it should not be cleared when you clear your browsing history. I am persisting data in a userscript and did what you described in the steps above, and the data was not cleared, so I am unsure why you would be experiencing that with 4chan-X - I am not yet convinced this is an with this app/extension, but it could turn out to be.

Would it be possible to open an issue on the 4chan-X repository and try to find out how those settings are saved? That might lead to more clues to what is going.


Also note, that userscript is using quite a few different userscript api methods that are not yet supported in this extension, along with some older methods like GM_setValue, which is the synchronous counterpart to GM.setValue and not supported in this app/extension.

  • GM_addValueChangeListener is also used and not suported
  • GM_xmlhttpRequest is also used and not supported

However the code looks like it accounts for unsupported methods quite well actually so I don't know if this actually impacts anything.

@phw
Copy link

phw commented Jan 3, 2022

Thanks for this huge update. I was mostly interested in seeing how the implementation of GM.xmlhttpRequest works and if it would make my user script at https://github.com/phw/musicbrainz-magic-tagger-button/ work. The speciality of this user script is that it needs to make requests against localhost using HTTP from a website loaded via HTTPS, but when using plain XHR those got blocked by Safari. Now I implemented support for GM.xmlhttpRequest and tested with this beta version, and everything is working fine just as with other browsers.

Also in general this beta works really well.

It's a pity this update will only be available for macOS 12 or later, but I understand that Apple is pushing us developers to update applications to their latest requirements.

@quoid
Copy link
Owner Author

quoid commented Jan 3, 2022

@phw

It's a pity this update will only be available for macOS 12 or later

Before I submit to the app store I am going to double check on the required versions. I think the major requirements is Safari 14.1, so it might be possible to support older versions of macOS, however to use Testflight one must have macOS 12.

Without Testflight it's seemingly impossible to reliably test on older versions of macOS because Safari WebExtensions can not be distributed outside of the App Store. Up until this past version I have also provided the .app directly for users who wish to circumvent the App Store, but that will also be no longer be possible - check out this issue: #154

If it's possible to include older macOS versions, I will, but I am not sure they will be totally "supported" since I don't have any way to testing on those older versions.

@quoid
Copy link
Owner Author

quoid commented Jan 6, 2022

Version 4.x is approved for the app store. It will target macOS 11+. Unfortunately versions under macOS 12 have not been thoroughly tested, so let's hope for the best for those users.

I really appreciate everyone who has helped test and improvements will continue to come in the future!

I am closing this thread and the version 4.x version should show up on the app store later this week, probably on Friday-ish.

@quoid quoid closed this as completed Jan 6, 2022
@quoid quoid unpinned this issue Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants