Add nodeinfo to well known

O01eg
Apr 22, 2022, 10:21 AM
5XW3RJKJK74VHJ2RRB64NL7PYKFLI6RMEUQCJYAU2CLITX5SGNRQC

Dependencies

Change contents

  • replacement in src/pages/well_known.rs at line 21
    [2.3][2.3:45]()
    pub async fn nodeinfo() -> HttpResponse {
    [2.3]
    [2.45]
    pub async fn nodeinfo20() -> HttpResponse {
  • edit in src/pages/well_known.rs at line 49
    [2.784]
    [3.681]
    }
    pub async fn nodeinfo(data: web::Data<WebData<'_>>) -> HttpResponse {
    HttpResponse::Ok()
    .insert_header(("Content-Type", "application/jrd+json"))
    .insert_header((
    "Date",
    chrono::Utc::now()
    .format("%a, %d %b %Y %H:%M:%S GMT")
    .to_string(),
    ))
    .body(format!(
    r#"{{
    "links": [{{
    "rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
    "href": "{}://{}/nodeinfo/2.0"
    }}]
    }}"#,
    data.base_proto, data.base_domain
    ))
  • replacement in src/main.rs at line 180
    [3.1494][2.785:858]()
    .route("/nodeinfo/2.0", web::get().to(well_known::nodeinfo))
    [3.1494]
    [3.1998]
    .route("/nodeinfo/2.0", web::get().to(well_known::nodeinfo20))
    .route("/.well-known/nodeinfo", web::get().to(well_known::nodeinfo))