Improved server detection / new servers added to federation statistics (#13793)
authorMichael Vogel <icarus@dabo.de>
Tue, 2 Jan 2024 19:12:37 +0000 (20:12 +0100)
committerGitHub <noreply@github.com>
Tue, 2 Jan 2024 19:12:37 +0000 (20:12 +0100)
* Improved server detection / new servers added to federation statistics

* Fix wrong color code

src/Model/GServer.php
src/Module/Admin/Federation.php
src/Util/JsonLD.php
static/did-v1.jsonld [new file with mode: 0644]

index e00facd..b8c76ca 100644 (file)
@@ -1247,6 +1247,11 @@ class GServer
                        }
                }
 
+               // Special treatment for NextCloud, since there you can freely define your software name
+               if (!empty($nodeinfo['rootUrl']) && in_array(parse_url($nodeinfo['rootUrl'], PHP_URL_PATH), ['/index.php/apps/social', '/apps/social'])) {
+                       $server['platform'] = 'nextcloud';
+               }
+
                if (!empty($nodeinfo['metadata']['nodeName'])) {
                        $server['site_name'] = $nodeinfo['metadata']['nodeName'];
                }
@@ -1565,7 +1570,7 @@ class GServer
                }
 
                foreach ($tags as $tag) {
-                       if ((($tag['as:name'] ?? '') == 'Protocol') && (($tag['sc:value'] ?? '') == 'nomad')) {
+                       if ((($tag['as:name'] ?? '') == 'Protocol') && in_array('nomad', [$tag['sc:value'] ?? '', $tag['as:content'] ?? ''])) {
                                return true;
                        }
                }
index 7263057..8f05ec4 100644 (file)
@@ -45,14 +45,16 @@ class Federation extends BaseAdmin
                        'castopod'     => ['name' => 'Castopod', 'color' => '#00564a'], // Background color from the page
                        'diaspora'     => ['name' => 'Diaspora', 'color' => '#a1a1a1'], // logo is black and white, makes a gray
                        'calckey'      => ['name' => 'firefish (Calckey)', 'color' => '#1c4a5c'], // Color from the page
+                       'sharkey'      => ['name' => 'Sharkey', 'color' => 'lightpink'], // Font color from the homepage
                        'foundkey'     => ['name' => 'Foundkey', 'color' => '#609926'], // Some random color from the repository
                        'funkwhale'    => ['name' => 'Funkwhale', 'color' => '#4082B4'], // From the homepage
                        'gancio'       => ['name' => 'Gancio', 'color' => '#7253ed'], // Fontcolor from the page
                        'gnusocial'    => ['name' => 'GNU Social/Statusnet', 'color' => '#a22430'], // dark red from the logo
                        'gotosocial'   => ['name' => 'GoToSocial', 'color' => '#df8958'], // Some color from their mascot
                        'hometown'     => ['name' => 'Hometown', 'color' => '#1f70c1'], // Color from the Patreon page
-                       'honk'         => ['name' => 'Honk', 'color' => '##0d0d0d'], // Background color from the page
+                       'honk'         => ['name' => 'Honk', 'color' => '#0d0d0d'], // Background color from the page
                        'hubzilla'     => ['name' => 'Hubzilla/Red Matrix', 'color' => '#43488a'], // blue from the logo
+                       'iceshrimp'    => ['name' => 'iceshrimp', 'color' => 'mediumslateblue'], // Color that is used in their software
                        'kbin'         => ['name' => 'kbin', 'color' => '#61366b'], // Color from their main instance
                        'lemmy'        => ['name' => 'Lemmy', 'color' => '#00c853'], // Green from the page
                        'mastodon'     => ['name' => 'Mastodon', 'color' => '#1a9df9'], // blue from the Mastodon logo
@@ -66,8 +68,10 @@ class Federation extends BaseAdmin
                        'pixelfed'     => ['name' => 'Pixelfed', 'color' => '#11da47'], // One of the logo colors
                        'pleroma'      => ['name' => 'Pleroma', 'color' => '#E46F0F'], // Orange from the text that is used on Pleroma instances
                        'plume'        => ['name' => 'Plume', 'color' => '#7765e3'], // From the homepage
+                       'postmarks'    => ['name' => 'Postmarks', 'color' => 'darkblue'], // Header color from the homepage
                        'relay'        => ['name' => 'ActivityPub Relay', 'color' => '#888888'], // Grey like the second color of the ActivityPub logo
                        'socialhome'   => ['name' => 'SocialHome', 'color' => '#52056b'], // lilac from the Django Image used at the Socialhome homepage
+                       'snac'         => ['name' => 'Snac', 'color' => '#2966a8'], // Color from one of their themes
                        'takahe'       => ['name' => 'TakahÄ“', 'color' => '#26323c'], // Background color of the homepage
                        'wildebeest'   => ['name' => 'Wildebeest', 'color' => '#0055dc'], // Color of the mascot
                        'wordpress'    => ['name' => 'WordPress', 'color' => '#016087'], // Background color of the homepage
index 5bf6593..e8cddbe 100644 (file)
@@ -58,6 +58,9 @@ class JsonLD
                        case 'https://www.w3.org/ns/activitystreams':
                                $url = DI::basePath() . '/static/activitystreams.jsonld';
                                break;
+                       case 'https://www.w3.org/ns/did/v1':
+                               $url = DI::basePath() . '/static/did-v1.jsonld';
+                               break;
                        case 'https://funkwhale.audio/ns':
                                $url = DI::basePath() . '/static/funkwhale.audio.jsonld';
                                break;
diff --git a/static/did-v1.jsonld b/static/did-v1.jsonld
new file mode 100644 (file)
index 0000000..ea65773
--- /dev/null
@@ -0,0 +1,54 @@
+{
+  "@context": {
+    "alsoKnownAs": {
+      "@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs",
+      "@type": "@id"
+    },
+    "assertionMethod": {
+      "@id": "https://w3id.org/security#assertionMethod",
+      "@type": "@id",
+      "@container": "@set"
+    },
+    "authentication": {
+      "@id": "https://w3id.org/security#authenticationMethod",
+      "@type": "@id",
+      "@container": "@set"
+    },
+    "capabilityDelegation": {
+      "@id": "https://w3id.org/security#capabilityDelegationMethod",
+      "@type": "@id",
+      "@container": "@set"
+    },
+    "capabilityInvocation": {
+      "@id": "https://w3id.org/security#capabilityInvocationMethod",
+      "@type": "@id",
+      "@container": "@set"
+    },
+    "controller": {
+      "@id": "https://w3id.org/security#controller",
+      "@type": "@id"
+    },
+    "keyAgreement": {
+      "@id": "https://w3id.org/security#keyAgreementMethod",
+      "@type": "@id",
+      "@container": "@set"
+    },
+    "service": {
+      "@id": "https://www.w3.org/ns/did#service",
+      "@type": "@id",
+      "@context": {
+        "@protected": true,
+        "id": "@id",
+        "type": "@type",
+        "serviceEndpoint": {
+          "@id": "https://www.w3.org/ns/did#serviceEndpoint",
+          "@type": "@id"
+        }
+      }
+    },
+    "verificationMethod": {
+      "@id": "https://w3id.org/security#verificationMethod",
+      "@type": "@id"
+    }
+  }
+}