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

Userscripts async API support #170

Closed
ameshkov opened this issue Feb 5, 2018 · 1 comment
Closed

Userscripts async API support #170

ameshkov opened this issue Feb 5, 2018 · 1 comment

Comments

@ameshkov
Copy link
Member

ameshkov commented Feb 5, 2018

Update by @sfionov based on discussions:

Instead of implementing full async API, currently we need only presence of functioning GM object, so we may wrap GM_ functions into it.

Original proposal by @ameshkov:

First of all, we need to provide GM4 async API support:
https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html

That is possible to implement on the javascript side already, but along with that, we would like to improve the current approach.

First of all, I'd like to get rid of the GM properties pre-compiled into the userscript.

Solution: separate properties set by the async API (GM_setValue) from properties set by the new async API (GM.setValue). The former will be pre-loaded, while the latter will be always requested asynchronously.

The second issue we would like to be solved is pre-compiling all the resources. This can be avoided if we make GM_getResourceUrl and GM.getResourceUrl return an URL to local.adguard.com instead of a blob. However, we should be cautious with that as we still may need to pre-compile resources if userscript uses the synchronous GM_getResourceText function.

Solution: pre-compile resources if userscript uses GM_getResourceText only.

@ameshkov
Copy link
Member Author

From the discussion with @seanl-adg

Q2: And regarding the resources loading, we can supply a list of resources identifiers to the userscript wrapper and it then will build urls like local.adguard.com/userscript/resource/HERE_GOES_ID Would you like to change/improve it somehow?

automatic transpilation would be beneficial for some users, we may use a transpiled userscript for some 'Filtered Apps' like IE or Maxton. What I can't answer is whether it is doable.
We may provide some checkbox like 'run this userscript in a compatibility mode'
local.adguard.com/userscript/resource/HERE_GOES_ID
I just want HERE_GOES_ID part to be sufficiently randomized so that third-party scripts can't guess what userscripts the user have enabled.

uuid generated at runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants