HangarMC / Hangar

A plugin repository used for paper plugins
https://hangar.papermc.io/
MIT License
253 stars 64 forks source link

Add an endpoint for reverse searching projects based on jar files #1286

Closed TekExplorer closed 4 months ago

TekExplorer commented 1 year ago

Is your feature request related to a problem?

Right now, there's no way to find a resource on hangar based on a jar file.

This can be useful for plugin managers that want to be able to "discover" manually added plugins, or simply dont want to have to track what plugins are installed in a separate, easily desynced, database.

Describe the solution you'd like.

All uploaded files already have sha256Hash keys, so maybe add an endpoint that allows reverse searching based on that (it wont work for external jars, but since i cant exactly curl those i'll ignore it)

Modrinth has this in their api with getVersionFromHash and its multi-search siblings

Describe alternatives you've considered.

One alternative is to go the ore route and force all plugins to include the slug in their jar somewhere (in ore's case, the modid is the slug) but unfortunately, i think at this point Hangar has too many resources to feasibly do this retroactively without injecting the value into the jars... which could be viable.

alternatively, have the requirement from now on and simply dont present the un-tagged jars, or perhaps do the injection on those? maybe not automatically - perhaps as an option for authors to ensure full availability?

Other

As a side note, i think that external jars should simply be removed entirely. I get it, but also why? As devs, being able to programmatically download stuff is basically half of what we do with apis! Additionally, external downloads means that a resource could just.. stop existing and we wont be able to ever get those files again. That actively goes against what a distribution platform should advocate.

Perhaps I should make an issue for that 🤔

kennytv commented 4 months ago

https://github.com/HangarMC/Hangar/commit/060d99b60fe60a8a33fe958496b5715db2f092f8