Add "instances" endpoints
This is something I've been thinking about for a while but haven't had time to do yet, so I wanted to write some thoughts.
We can now view instance timelines, and there are some AdminAPI actions that work on instances:
- GET
/api/v1/timelines/public?instance=lain.com
- get instance timeline - GET
/api/v1/pleroma/amin/instances/:instance/statuses
- AdminAPI: get instance statuses - DELETE
/api/v1/pleroma/amin/instances/:instance
- AdminAPI: delete an instance (proposed by !3483 (merged))
Now I would like the ability to get information about instances through the API.
/api/v1/pleroma/instances/:host
GET Response:
-
id
- primary key of the instance in theinstances
table of the database -
host
- the instance hostname -
favicon
- URL to the instance favicon, if favicon scraping is enabled -
federation_restrictions
- a map of MRF policies with boolean fields
Example response:
{
"id": "A9eWMGiX7eOMbHk4lE",
"host": "gleasonator.com",
"favicon": "https://gleasonator.com/favicon.png",
"federation_restrictions": {
"simple_policy": {
"accept": false,
"avatar_removal": false,
"banner_removal": false,
"federated_timeline_removal": false,
"followers_only": false,
"media_nsfw" :false,
"media_removal": false,
"reject": false,
"reject_deletes": false,
"report_removal": false
},
"quarantined": false
}
}
This would make it easier to display an "instance" as an entity through the frontend. Some information like the instance favicon are just impossible to retrieve without trying to extract it from users of that instance, and having an endpoint would solve it.
In the future, I could imagine expanding this to display more data about the remote instance. For example, it may be possible to retrieve information like a display name, description, and stats.