feat: added /api/v1/instance in mastodon api

because aode relay blasts me of requests on that endpoint... aode you
should limit how many fetches you do!!!!!!!!!!
This commit is contained in:
əlemi 2024-05-11 15:59:35 +02:00
parent 6dd140a413
commit 5b22c0c33b
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,22 @@
use axum::{extract::State, Json};
use crate::server::Context;
pub async fn get(
State(ctx): State<Context>,
) -> crate::Result<Json<mastodon_async_entities::instance::Instance>> {
Ok(Json(mastodon_async_entities::instance::Instance {
uri: ctx.domain().to_string(),
title: "μpub".to_string(),
description: "micro social network, federated".to_string(),
email: "me@alemi.dev".to_string(),
version: crate::VERSION.to_string(),
urls: None,
stats: None,
thumbnail: None,
languages: None,
contact_account: None,
max_toot_chars: None,
}))
}

View file

@ -1,4 +1,5 @@
pub mod accounts;
pub mod instance;
use axum::{http::StatusCode, routing::{delete, get, patch, post}, Router};
use crate::server::Context;
@ -70,6 +71,8 @@ impl MastodonRouter for Router<Context> {
.route("/profile/avatar", delete(todo))
.route("/profile/header", delete(todo))
.route("/statuses", post(todo))
// ...
.route("/instance", get(mas::instance::get))
)
}
}