badges / shields

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

Badge Request: Spigot badge support #5368

Open Andre601 opened 4 years ago

Andre601 commented 4 years ago

:clipboard: Description

Support for the Spigot XenforoResourceManagerAPI Unlike the Spiget API which Shields currently supports does this API allow to retrieve information from premium resources (Such checks are blocked for Spiget making requests either fail or to be outdated).

It current supports to get resource info by id, resource info by author (Array of resources) and get author by id.

Example response for resource by id

Note that all depicted values are always given. Some values (i.e. premium.price and premium.currency) will default to specific values (empty strings or specific text)

{
  "id": "2",
  "title": "HubKick",
  "tag": "Send players to lobby on kick. /lobby / hub",
  "current_version": "1.7.1",
  "author": {
    "id": "106",
    "username": "LaxWasHere"
  },
  "premium": {
    "price": "0.00",
    "currency": ""
  },
  "stats": {
    "downloads": "6387",
    "updates": "22",
    "reviews": "9",
    "rating": "5"
  }
}

Example response for resources by author id

[
  {
    "id": "201",
    "title": "XenPermissions",
    "tag": "Hook your permissions into Xenforo!",
    "current_version": "2013-09-28",
    "author": {
      "id": "1",
      "username": "md_5"
    },
    "premium": {
      "price": "0.00",
      "currency": ""
    },
    "stats": {
      "downloads": "939",
      "updates": "0",
      "reviews": "4",
      "rating": "4.5"
    }
  },
  {
    "id": "342",
    "title": "iTag",
    "tag": "Performant and Reliable TagAPI Replacement",
    "current_version": "22",
    "author": {
      "id": "1",
      "username": "md_5"
    },
    "premium": {
      "price": "0.00",
      "currency": ""
    },
    "stats": {
      "downloads": "23573",
      "updates": "2",
      "reviews": "17",
      "rating": "4.41176"
    }
  }
]

Example response for resource author by id

{
  "id": "1",
  "username": "md_5",
  "resource_count": "12",
  "identities": {
    "twitter": "md__5"
  },
  "avatar": {
    "info": "1545025664",
    "hash": "b53fd878a84d268da2b6456e0b96cae5"
  }
}

Example Badges

Type Badge
Version downloads
Price (premium) downloads
Price (Free) downloads
Downloads downloads
Updates downloads
Reviews downloads
Ratings downloads
downloads
downloads
downloads
downloads
downloads

:link: Data

The API does not require any Auth key or similar. Any normal GET request with a proper User-Agent should be valid.

Documentation: https://github.com/SpigotMC/XenforoResourceManagerAPI

:microphone: Motivation

Spigot does no longer allow lookups of premium resources using Robot User-Agents, which Spiget uses according to some. This has essentially broke the Spiget API for premium resources, making already cached ones only display outdated information and new premium resources not working (Give back an error).

The new dedicated Spigot API allows to request information of Spigot premium resources.

PyvesB commented 4 years ago

Hello @Andre601,

Thanks for pointing this out. XenforoResourceManagerAPI is part of the Spigot API, so in that sense it's an official API unlike the Spiget alternative we're currently using.

Do you know if there are any rate limits involved? Our existing badges return the download size and support server versions for Spigot resources, is this information available through the new API?

Andre601 commented 4 years ago

Do you know if there are any rate limits involved?

I'm not aware of any.

Our existing badges return the download size and support server versions for Spigot resources, is this information available through the new API?

Sadly not. The API only returns the info I posted above, but it could be suggested on their github.

PyvesB commented 4 years ago

it could be suggested on their github.

Could you please raise the feature requests? It would be ideal if we could migrate all existing badges to the new official API, rather than having to maintain two separate integrations.

Andre601 commented 4 years ago

Already did so.

PyvesB commented 4 years ago

Already did so.

I think we would still be missing the download size!

Andre601 commented 4 years ago

To be fairly honest here: I really don't expect any answer from Spigot's end as they are - to put it simple - lazy on implementing new feature requests, both in their software and their Forum API.

So I highly doubt that there will be any update on this in the next weeks if not even months.

PyvesB commented 4 years ago

Having myself worked on Spigot plugins for several years now, I don't know if I would use the word "lazy", but I definitely agree that a lot of feature requests and fixes tend to be implemented very slowly, or never. It's not surprising that the community is quite fragmented and that there have been several Spigot forks over the years.

It probably doesn't hurt to leave this issue around for when/if the new API meets all our requirements, so I suggest we keep our eyes open and hope for the best. :wink: