feat: update NodeInfo 2.0 response to include $schema field and bump version to 0.4.3
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.4.3] — 2026-07-11
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- NodeInfo 2.0 response now includes the required `$schema` field (`http://nodeinfo.diaspora.software/ns/schema/2.0#`). Validators like browser.pub rejected the previous response for missing it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [0.4.2] — 2026-07-10
|
## [0.4.2] — 2026-07-10
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1368,7 +1368,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "k-ap"
|
name = "k-ap"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "k-ap"
|
name = "k-ap"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Generic ActivityPub protocol layer"
|
description = "Generic ActivityPub protocol layer"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use crate::data::FederationData;
|
|||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
const NODEINFO_2_0_REL: &str = "http://nodeinfo.diaspora.software/ns/schema/2.0";
|
const NODEINFO_2_0_REL: &str = "http://nodeinfo.diaspora.software/ns/schema/2.0";
|
||||||
|
const NODEINFO_2_0_SCHEMA: &str = "http://nodeinfo.diaspora.software/ns/schema/2.0#";
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct NodeInfoWellKnown {
|
pub struct NodeInfoWellKnown {
|
||||||
@@ -39,6 +40,8 @@ pub struct NodeInfoUsers {
|
|||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct NodeInfo {
|
pub struct NodeInfo {
|
||||||
|
#[serde(rename = "$schema")]
|
||||||
|
pub schema: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub software: NodeInfoSoftware,
|
pub software: NodeInfoSoftware,
|
||||||
pub protocols: Vec<String>,
|
pub protocols: Vec<String>,
|
||||||
@@ -63,6 +66,7 @@ pub async fn nodeinfo_handler(data: Data<FederationData>) -> Result<Json<NodeInf
|
|||||||
let local_posts = data.content_reader.count_local_posts().await.unwrap_or(0);
|
let local_posts = data.content_reader.count_local_posts().await.unwrap_or(0);
|
||||||
|
|
||||||
Ok(Json(NodeInfo {
|
Ok(Json(NodeInfo {
|
||||||
|
schema: NODEINFO_2_0_SCHEMA.to_string(),
|
||||||
version: "2.0".to_string(),
|
version: "2.0".to_string(),
|
||||||
software: NodeInfoSoftware {
|
software: NodeInfoSoftware {
|
||||||
name: data.software_name.clone(),
|
name: data.software_name.clone(),
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ fn nodeinfo_well_known_serializes_correctly() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn nodeinfo_serializes_camel_case() {
|
fn nodeinfo_serializes_camel_case() {
|
||||||
let doc = NodeInfo {
|
let doc = NodeInfo {
|
||||||
|
schema: "http://nodeinfo.diaspora.software/ns/schema/2.0#".to_string(),
|
||||||
version: "2.0".to_string(),
|
version: "2.0".to_string(),
|
||||||
software: NodeInfoSoftware {
|
software: NodeInfoSoftware {
|
||||||
name: "my-app".to_string(),
|
name: "my-app".to_string(),
|
||||||
@@ -32,6 +33,10 @@ fn nodeinfo_serializes_camel_case() {
|
|||||||
open_registrations: false,
|
open_registrations: false,
|
||||||
};
|
};
|
||||||
let json = serde_json::to_value(&doc).unwrap();
|
let json = serde_json::to_value(&doc).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
json["$schema"],
|
||||||
|
"http://nodeinfo.diaspora.software/ns/schema/2.0#"
|
||||||
|
);
|
||||||
assert_eq!(json["version"], "2.0");
|
assert_eq!(json["version"], "2.0");
|
||||||
assert_eq!(json["software"]["name"], "my-app");
|
assert_eq!(json["software"]["name"], "my-app");
|
||||||
assert_eq!(json["usage"]["users"]["total"], 3);
|
assert_eq!(json["usage"]["users"]["total"], 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user