badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.01k stars 5.47k forks source link

Badge request: Sponge plugin #4565

Open pie-flavor opened 4 years ago

pie-flavor commented 4 years ago

:clipboard: Description

These badges would be for Sponge plugins via Ore. They would be in the following formats (taking LuckPerms as an example):

:link: Data

Ore's public API is documented here. There's no API key required, although it requires a session to be created.

LuckPerms's API response looks like this: URL: ``` { "created_at": "2017-02-01T18:58:17.19", "plugin_id": "luckperms", "name": "LuckPerms", "namespace": { "owner": "Luck", "slug": "LuckPerms" }, "promoted_versions": [ { "version": "4.2.17", "tags": [ { "name": "Sponge", "data": "8.0.0-SNAPSHOT", "display_data": "8.0", "minecraft_version": null, "color": { "foreground": "#333333", "background": "#F7Cf0D" } } ] }, { "version": "4.1.7", "tags": [ { "name": "Sponge", "data": "6.0.0", "display_data": "6.0", "minecraft_version": null, "color": { "foreground": "#333333", "background": "#F7Cf0D" } } ] }, { "version": "3.0.14", "tags": [ { "name": "Sponge", "data": "5.0.0", "display_data": "5.0", "minecraft_version": null, "color": { "foreground": "#333333", "background": "#F7Cf0D" } } ] } ], "stats": { "views": 56378, "downloads": 20231, "stars": 81 }, "category": "admin_tools", "description": "An advanced permissions plugin", "last_updated": "2019-12-27T23:50:23.984", "visibility": "public", "user_actions": { "starred": false, "watching": false }, "settings": { "homepage": null, "issues": "https://github.com/lucko/LuckPerms/issues", "sources": "https://github.com/lucko/LuckPerms", "support": null, "license": { "name": "MIT", "url": "https://github.com/lucko/LuckPerms/blob/master/LICENSE.txt" }, "forum_sync": true }, "icon_url": "https://ore.spongepowered.org/Luck/LuckPerms/icon" } ```

:microphone: Motivation

Sponge is a platform for server-side modding of Minecraft servers, and is Spigot's main competitor in that field. shields.io already has great badges for Spigot plugins via Spiget, but no such badges for Sponge plugins via Ore (the official plugin repository). This would allow Sponge plugin developers to display information in badge format about their Sponge plugins on GitHub or a documentation site.

calebcartwright commented 4 years ago

Thanks for the request and detailed info @pie-flavor!

There's no API key required

Are you sure that's the case? It seems like an API key is required as part of the authentication call to create the session

https://ore.spongepowered.org/api#/Authentification/authenticate

pie-flavor commented 4 years ago

Yes, it says:

to create a public session, don't pass an Authorization header.

If you run from PowerShell:

$session = (irm https://ore.spongepowered.org/api/v2/authenticate -method post).session
$project = irm https://ore.spongepowered.org/api/v2/projects/luckperms -headers @{Authorization="OreApi session=`"$session`""}

then you will get LuckPerms's project info with no API token required.

chris48s commented 4 years ago

I think if we were going to implement this, we'd want to find a way to cache the session so that we don't have to make 2 API requests to render every badge.

PyvesB commented 4 years ago

Sessions seem to last for three hours, so it would indeed be beneficial to cache them. Storing the session key as property in the service class and getting a new one when it expires could be a simple way of handling this!

@pie-flavor would you like to give this a go? We've got a nice little tutorial to get you going. 😉