mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Remove .json from nodeinfo urls, according to spec.
This commit is contained in:
parent
69b4c6647b
commit
cbcd7c43ed
@ -12,15 +12,18 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
/// A description of the nodeinfo endpoint is here:
|
||||||
|
/// https://github.com/jhass/nodeinfo/blob/main/PROTOCOL.md
|
||||||
pub fn config(cfg: &mut web::ServiceConfig) {
|
pub fn config(cfg: &mut web::ServiceConfig) {
|
||||||
cfg
|
cfg
|
||||||
.route(
|
.route(
|
||||||
"/nodeinfo/2.1.json",
|
"/nodeinfo/2.1",
|
||||||
web::get().to(node_info).wrap(cache_1hour()),
|
web::get().to(node_info).wrap(cache_1hour()),
|
||||||
)
|
)
|
||||||
.service(web::redirect("/version", "/nodeinfo/2.1.json"))
|
.service(web::redirect("/version", "/nodeinfo/2.1"))
|
||||||
// For backwards compatibility, can be removed after Lemmy 0.20
|
// For backwards compatibility, can be removed after Lemmy 0.20
|
||||||
.service(web::redirect("/nodeinfo/2.0.json", "/nodeinfo/2.1.json"))
|
.service(web::redirect("/nodeinfo/2.0.json", "/nodeinfo/2.1"))
|
||||||
|
.service(web::redirect("/nodeinfo/2.1.json", "/nodeinfo/2.1"))
|
||||||
.route(
|
.route(
|
||||||
"/.well-known/nodeinfo",
|
"/.well-known/nodeinfo",
|
||||||
web::get().to(node_info_well_known).wrap(cache_3days()),
|
web::get().to(node_info_well_known).wrap(cache_3days()),
|
||||||
@ -32,7 +35,7 @@ async fn node_info_well_known(context: web::Data<LemmyContext>) -> LemmyResult<H
|
|||||||
links: vec![NodeInfoWellKnownLinks {
|
links: vec![NodeInfoWellKnownLinks {
|
||||||
rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.1")?,
|
rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.1")?,
|
||||||
href: Url::parse(&format!(
|
href: Url::parse(&format!(
|
||||||
"{}/nodeinfo/2.1.json",
|
"{}/nodeinfo/2.1",
|
||||||
&context.settings().get_protocol_and_hostname(),
|
&context.settings().get_protocol_and_hostname(),
|
||||||
))?,
|
))?,
|
||||||
}],
|
}],
|
||||||
|
Loading…
Reference in New Issue
Block a user