openstyles / stylus

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

[Question] What would you expect from a userstyles API ? #1191

Closed KaKi87 closed 3 years ago

KaKi87 commented 3 years ago

Hello @tophf,

As I'm planning to create a new userstyles sharing platform as a replacement for the currently leading but slowly dying userstyles.org, I was wondering if I could get your feedback, on what specs would you want, for an API, which could, at some point, be integrated into the Stylus extension.

This integration would include inline search and automated updates, maybe more if you have ideas.

Thanks !


Related message by narcolepticinsomniac#7875 on the Open Styles Discord guild :

Inline search was implemented by tophf, so I imagine he'd be fairly particular. You could always open an issue and ask him

tophf commented 3 years ago

I don't have any experience in API design so I'll just tell what Stylus needs (and uses now).

KaKi87 commented 3 years ago

This is so much interesting, thank you, a lot.

Can you explain how does this index file work ?

tophf commented 3 years ago

It's trivially an array of all style descriptions, see also isResultMatching.

KaKi87 commented 3 years ago

I understand.

What is you favorite option between an index and an API ?

tophf commented 3 years ago

If the index file is small (a few MB gzipped) then it's a) much simpler because we only need to download it once when the search UI is shown and b) much faster afterwards as it's literally instantaneous. If you don't import styles from USO your index won't be big for quite a while.

KaKi87 commented 3 years ago

Alright, do you think an Etag for the index itself would be useful to check for updates ?

tophf commented 3 years ago

We check styles individually as they may come from different servers. Theoretically you could implement an endpoint that receives an object/array consisting of id:hash (or id:etag) pairs and returns a similarly formed response about their updatability.

KaKi87 commented 3 years ago

Yes, I was actually talking about checking if the index itself was updated, e.g. a userstyle was added or removed.

tophf commented 3 years ago

Checking etag on the index would be helpful only if the content on your site is updated like once a day. But if the site gets popular it may be updated every minute.

Mottie commented 3 years ago

I don't know if we still have the OpenUserCSS integration in place, but that might be a place to start?

Also, OpenUserCSS already has a lot of work put into it, but the owner ran out of time/motivation. Maybe you can message him and pick it back up, that is if you don't want to start from scratch.

narcolepticinsomniac commented 3 years ago

Holy hell @Mottie, we made the 'wonderful people' section in that README. I'm glad we're both finally getting the kinda recognition we deserve. =)

Pretty sure I only ever pointed out all the flaws with that site, which never even got fixed.

Maybe you can message him and pick it back up, that is if you don't want to start from scratch.

Fixing all the bugs may very well be easier than starting from square one. If so, it's GPL3, so that's not a huge issue. Maybe the domain would be nice, if he even still owns it, but it could always be switched up.

If the goal is to maximize submissions, you also might consider supporting traditional moz-format, and advanced settings. It'd be easier to migrate traditional styles, and for the presumably significant amount of users who still write non-usercss styles, it's far easier to simply export and paste to publish. I suppose, ideally, even those could be converted to usercss for install.

narcolepticinsomniac commented 3 years ago

Pre-redesign USO might also be worth a look to somebody.

KaKi87 commented 3 years ago

@tophf Tank you very much for your feedback, I'm closing this issue since you answered my original question. 🙂

KaKi87 commented 3 years ago

@Mottie

I actually would like to start from scratch.

Before writing a single line of code for this project :

All of this, to gather all devs and users expectations for this platform, while I'm writing draft specs summarizing feedback submissions.

Once the feedback gathering will be done :

If I do get final approval, the development will start right away, if not, the project will be canceled.

The point is, I want to create this platform with everybody's requirements in mind, in the first place, so it will have the highest possible probability of success.

Thanks.