Add NodeInfo endpoints (fixes #11)
This commit is contained in:
+27
-1
@@ -1,11 +1,12 @@
|
||||
use rocket::{request::Form, response::Redirect};
|
||||
use rocket_contrib::Template;
|
||||
use rocket_contrib::{Json, Template};
|
||||
use serde_json;
|
||||
|
||||
use BASE_URL;
|
||||
use activity_pub::inbox::Inbox;
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
comments::Comment,
|
||||
posts::Post,
|
||||
users::User,
|
||||
instance::*
|
||||
@@ -75,3 +76,28 @@ fn shared_inbox(conn: DbConn, data: String) -> String {
|
||||
instance.received(&*conn, act);
|
||||
String::from("")
|
||||
}
|
||||
|
||||
#[get("/nodeinfo")]
|
||||
fn nodeinfo(conn: DbConn) -> Json {
|
||||
Json(json!({
|
||||
"version": "2.0",
|
||||
"software": {
|
||||
"name": "Plume",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"protocols": ["activitypub"],
|
||||
"services": {
|
||||
"inbound": [],
|
||||
"outbound": []
|
||||
},
|
||||
"openRegistrations": true,
|
||||
"usage": {
|
||||
"users": {
|
||||
"total": User::count_local(&*conn)
|
||||
},
|
||||
"localPosts": Post::count_local(&*conn),
|
||||
"localComments": Comment::count_local(&*conn)
|
||||
},
|
||||
"metadata": {}
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user