LittleBigRefresh / Refresh

A second-generation custom server for LittleBigPlanet that focuses on quality of life features and improving user experience.
https://lbp.littlebigrefresh.com
GNU Affero General Public License v3.0
68 stars 25 forks source link

Custom website badges #305

Open Beyley opened 9 months ago

Beyley commented 9 months ago

Summary

Instance hosters should be able to set custom badges for users on the site, eg. Winner of Level Competition X, which should display on their profile as an icon, and show a title + description when hovered over

badges will comprise of this data structure

{
    "id": "GUID_HERE",
    "icon": "https://url.png",
    "title": "Winner of Level Competition X",
    "description": "Created [level](https://levelurl), which recieved the most votes during Level Competition X",
}

Description should support markdown/bbcode to allow for links/formatting

API Endpoints

POST => /api/v3/badges/create, takes a body of the above datastructure without the ID, returns the full data structure with the newly generated ID PATCH => /api/v3/badges/id/{id}, takes a body of the above datastructure, updates the badge at that ID with the new information DELETE => /api/v3/badges/id/{id}, deletes the badge at that ID, removing it from all users which had it GET => /api/v3/badges/id/{id}, returns the badge datastructure with that specific GUID POST => /api/v3/badges/add/{id}/{user_id}, adds the specified badge to the specified user POST => /api/v3/badges/remove/{id}/{user_id}, removes the specified badge from the specified user

Existing user endpoints like /api/v3/users/name/{username} will also have a badges field, which is an array of badge GUIDs (or maybe full badge data structures to reduce the amount of requests needed?)

Questions

This is tangentially related to #20, but i think this covers a different usecase than the current roles implementation provides

Should this just be an extension to the current roles system? eg. badge information is associated with a role you give to players rather than its own data object which is assigned

jvyden commented 5 months ago

Badges should be completely separate than roles - they're more like rewards.