Skip to content
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

Merged
merged 2 commits into from May 14, 2024

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented May 6, 2024

No description provided.

@@ -34,4 +34,5 @@ once_cell = { workspace = true }
tracing = { workspace = true }
tokio = { workspace = true }
urlencoding = { workspace = true }
serde_with.workspace = true
Copy link
Member

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?

Copy link
Member Author

@Nutomic Nutomic May 7, 2024

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.

@@ -84,6 +85,7 @@ struct NodeInfoWellKnownLinks {
pub href: Url,
}

#[skip_serializing_none]
Copy link
Contributor

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

Copy link
Member Author

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"

Copy link
Contributor

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.

Copy link
Member

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.

@Nutomic Nutomic changed the title Use skip_serializing_none for webfinger (fixes #4702) Always set activitypub protocol in nodeinfo response (fixes #4702) May 8, 2024
@Nutomic
Copy link
Member Author

Nutomic commented May 8, 2024

My previous changes didnt make much sense, Ive rewritten it now so that protocols are always sent, even if federation is disabled. Doesnt make much sense to me but seems the only way to be standard compliant.

Copy link
Member

@dessalines dessalines left a 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
Copy link
Member

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.

@Nutomic Nutomic changed the title Always set activitypub protocol in nodeinfo response (fixes #4702) Make nodeinfo standard compliant, upgrade to nodeinfo 2.1 (fixes #4702) May 13, 2024
@Nutomic
Copy link
Member Author

Nutomic commented May 13, 2024

Added those required fields as well as software.repository and software.homepage.

@dessalines dessalines merged commit 8b6a4c0 into main May 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants