New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nodeinfo standard compliant, upgrade to nodeinfo 2.1 (fixes #4702) #4706
Conversation
crates/routes/Cargo.toml
Outdated
@@ -34,4 +34,5 @@ once_cell = { workspace = true } | |||
tracing = { workspace = true } | |||
tokio = { workspace = true } | |||
urlencoding = { workspace = true } | |||
serde_with.workspace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this specify workspace the same way the other dependencies do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this way is cleaner, but too much effort rewriting everything by hand.
crates/routes/src/nodeinfo.rs
Outdated
@@ -84,6 +85,7 @@ struct NodeInfoWellKnownLinks { | |||
pub href: Url, | |||
} | |||
|
|||
#[skip_serializing_none] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They aren't allowed to be empty either.
All the fields are required in the spec.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://nodeinfo.diaspora.software/ns/schema/2.0#",
"description": "NodeInfo schema version 2.0.",
"type": "object",
"additionalProperties": false,
"required": [
"version",
"software",
"protocols",
"services",
"openRegistrations",
"usage",
"metadata"
],
...
see http://nodeinfo.diaspora.software/docson/index.html#/ns/schema/2.0#$$expand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are always set by Lemmy, only made optional to be able to receive data from other platforms which may not include them. Like the saying goes, "be conservative in what you send, be liberal in what you accept"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but then I suggest that you return empty protocol list instead of leaving out the field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like protocol, services, and metadata are the other ones that we don't have / send. The first two we could send empty lists, but metadata being required is a strange one.
88467fa
to
c165004
Compare
My previous changes didnt make much sense, Ive rewritten it now so that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still the other required fields mv-gh mentioned.
let protocols = if site_view.local_site.federation_enabled { | ||
Some(vec!["activitypub".to_string()]) | ||
} else { | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd probably be better to make it required, and have this else branch be an empty vector.
Added those required fields as well as |
No description provided.