forked from alemi/upub
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:
parent
6dd140a413
commit
5b22c0c33b
2 changed files with 25 additions and 0 deletions
22
src/routes/mastodon/instance.rs
Normal file
22
src/routes/mastodon/instance.rs
Normal 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,
|
||||||
|
}))
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
|
pub mod instance;
|
||||||
|
|
||||||
use axum::{http::StatusCode, routing::{delete, get, patch, post}, Router};
|
use axum::{http::StatusCode, routing::{delete, get, patch, post}, Router};
|
||||||
use crate::server::Context;
|
use crate::server::Context;
|
||||||
|
@ -70,6 +71,8 @@ impl MastodonRouter for Router<Context> {
|
||||||
.route("/profile/avatar", delete(todo))
|
.route("/profile/avatar", delete(todo))
|
||||||
.route("/profile/header", delete(todo))
|
.route("/profile/header", delete(todo))
|
||||||
.route("/statuses", post(todo))
|
.route("/statuses", post(todo))
|
||||||
|
// ...
|
||||||
|
.route("/instance", get(mas::instance::get))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue