+ /**
+ * Detect if the given actor is a nomad account
+ *
+ * @param array $actor
+ * @return boolean
+ */
+ private static function isNomad(array $actor): bool
+ {
+ $tags = JsonLD::fetchElementArray($actor, 'as:tag');
+ if (empty($tags)) {
+ return false;
+ }
+
+ foreach ($tags as $tag) {
+ if ((($tag['as:name'] ?? '') == 'Protocol') && (($tag['sc:value'] ?? '') == 'nomad')) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Fetch the name of Nomad implementation
+ *
+ * @param string $url
+ * @return string
+ */
+ private static function getNomadName(string $url): string
+ {
+ $name = 'nomad';
+ $curlResult = DI::httpClient()->get($url . '/manifest', 'application/manifest+json');
+ if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
+ return $name;
+ }
+
+ $data = json_decode($curlResult->getBody(), true);
+ if (empty($data)) {
+ return $name;
+ }
+
+ return $data['name'] ?? $name;
+ }
+
+ /**
+ * Fetch the version of the Nomad installation
+ *
+ * @param string $url
+ * @return string
+ */
+ private static function getNomadVersion(string $url): string
+ {
+ $curlResult = DI::httpClient()->get($url . '/api/z/1.0/version', HttpClientAccept::JSON);
+ if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
+ return '';
+ }
+
+ $data = json_decode($curlResult->getBody(), true);
+ if (empty($data)) {
+ return '';
+ }
+ return $data ?? '';
+ }
+