openstyles / stylus

Stylus - Userstyles Manager
https://add0n.com/stylus.html
GNU General Public License v3.0
5.41k stars 304 forks source link

Integration with greasyfork.org #842

Closed JasonBarnabe closed 4 years ago

JasonBarnabe commented 4 years ago

Greasy Fork now supports user CSS.

When users visit Greasy Fork with Tampermonkey, Tampermonkey makes available some information on the installed scripts, which lets Greasy Fork change the UI (e.g. if you already have the script installed, the button will be updated to reflect whether it would be an upgrade/downgrade/reinstall).

Is something like this possible with Stylus? Are there other useful integrations that can be done?

tophf commented 4 years ago

Judging by the source code, currently GF can detect script status by querying window.external.Tampermonkey.isInstalled(name, namespace, callback): void.

Violentmonkey exposes window.external.Violentmonkey.isInstalled(name, namespace): Promise which will be used soon as well, apparently.

I'd say Stylus could certainly expose isInstalled (the Promise version, perhaps), but some of our users may dislike the fact that it can be used to expose the status or even the entire list of installed styles (theoretically possible even if not implemented by GF now) so maybe it would make sense to offer an option to disable this GF communication feature completely or, alternatively, just ignore the subsequent calls to the internal API even if the site saves isInstalled function reference and calls it directly.

What else? Well, greasyfork might want to implement a config UI for style settings if that makes sense so in that case an additional interface function can be exposed to inform the site of current user settings. On the other hand, Stylus (and supposedly other similar extensions) have their own style config UI so this feature doesn't seem particularly useful.

JasonBarnabe commented 4 years ago

Does Stylus record where the style was installed from? If so, you could limit the API to only return results that were installed from the same domain.