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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badge request: Sponge plugin #4565

Open
pie-flavor opened this issue Jan 24, 2020 · 4 comments
Open

Badge request: Sponge plugin #4565

pie-flavor opened this issue Jan 24, 2020 · 4 comments
Labels
service-badge Accepted and actionable changes, features, and bugs

Comments

@pie-flavor
Copy link

pie-flavor commented Jan 24, 2020

馃搵 Description

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

馃敆 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: https://ore.spongepowered.org/api/v2/projects/luckperms

{
  "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"
}

馃帳 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.

@pie-flavor pie-flavor added the service-badge Accepted and actionable changes, features, and bugs label Jan 24, 2020
@calebcartwright
Copy link
Member

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
Copy link
Author

pie-flavor commented Jan 25, 2020

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
Copy link
Member

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
Copy link
Member

PyvesB commented Feb 15, 2020

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. 馃槈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

4 participants