From edc49ec9b4653d9ab64294904f81fc72a76ae4f2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 23 Jul 2022 13:21:44 -0400 Subject: [PATCH] Add expected "users" property to NodeInfo usage property for all versions --- src/Model/Nodeinfo.php | 1 + src/Module/NodeInfo110.php | 8 ++------ src/Module/NodeInfo120.php | 8 ++------ src/Module/NodeInfo210.php | 8 ++------ 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php index 047fe0e58..84a14a294 100644 --- a/src/Model/Nodeinfo.php +++ b/src/Model/Nodeinfo.php @@ -79,6 +79,7 @@ class Nodeinfo $config = DI::config(); $usage = new stdClass(); + $usage->users = []; if (!empty($config->get('system', 'nodeinfo'))) { $usage->users = [ diff --git a/src/Module/NodeInfo110.php b/src/Module/NodeInfo110.php index 9935e9089..a308f8e6f 100644 --- a/src/Module/NodeInfo110.php +++ b/src/Module/NodeInfo110.php @@ -63,8 +63,8 @@ class NodeInfo110 extends BaseModule 'friendica' ], ], - 'services' => [], - 'usage' => [], + 'services' => Nodeinfo::getServices(), + 'usage' => Nodeinfo::getUsage(), 'openRegistrations' => intval($this->config->get('config', 'register_policy')) !== Register::CLOSED, 'metadata' => [ 'nodeName' => $this->config->get('config', 'sitename'), @@ -81,10 +81,6 @@ class NodeInfo110 extends BaseModule $nodeinfo['protocols']['outbound'][] = 'gnusocial'; } - $nodeinfo['usage'] = Nodeinfo::getUsage(); - - $nodeinfo['services'] = Nodeinfo::getServices(); - $nodeinfo['metadata']['protocols'] = $nodeinfo['protocols']; $nodeinfo['metadata']['protocols']['outbound'][] = 'atom1.0'; $nodeinfo['metadata']['protocols']['inbound'][] = 'atom1.0'; diff --git a/src/Module/NodeInfo120.php b/src/Module/NodeInfo120.php index 34bff3742..3e6a69b74 100644 --- a/src/Module/NodeInfo120.php +++ b/src/Module/NodeInfo120.php @@ -56,8 +56,8 @@ class NodeInfo120 extends BaseModule 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, ], 'protocols' => ['dfrn', 'activitypub'], - 'services' => [], - 'usage' => [], + 'services' => Nodeinfo::getServices(), + 'usage' => Nodeinfo::getUsage(), 'openRegistrations' => intval($this->config->get('config', 'register_policy')) !== Register::CLOSED, 'metadata' => [ 'nodeName' => $this->config->get('config', 'sitename'), @@ -72,10 +72,6 @@ class NodeInfo120 extends BaseModule $nodeinfo['protocols'][] = 'ostatus'; } - $nodeinfo['usage'] = Nodeinfo::getUsage(); - - $nodeinfo['services'] = Nodeinfo::getServices(); - if (Addon::isEnabled('twitter')) { $nodeinfo['services']['inbound'][] = 'twitter'; } diff --git a/src/Module/NodeInfo210.php b/src/Module/NodeInfo210.php index 7e9291b49..723736a61 100644 --- a/src/Module/NodeInfo210.php +++ b/src/Module/NodeInfo210.php @@ -59,9 +59,9 @@ class NodeInfo210 extends BaseModule ], 'organization' => Nodeinfo::getOrganization($this->config), 'protocols' => ['dfrn', 'activitypub'], - 'services' => [], + 'services' => Nodeinfo::getServices(), 'openRegistrations' => intval($this->config->get('config', 'register_policy')) !== Register::CLOSED, - 'usage' => [], + 'usage' => Nodeinfo::getUsage(true), ]; if (!empty($this->config->get('system', 'diaspora_enabled'))) { @@ -72,10 +72,6 @@ class NodeInfo210 extends BaseModule $nodeinfo['protocols'][] = 'ostatus'; } - $nodeinfo['usage'] = Nodeinfo::getUsage(true); - - $nodeinfo['services'] = Nodeinfo::getServices(); - if (Addon::isEnabled('twitter')) { $nodeinfo['services']['inbound'][] = 'twitter'; }