]> git.mxchange.org Git - friendica.git/commitdiff
Fix for profile limitation / configurable list of limited servers
authorMichael <heluecht@pirati.ca>
Fri, 22 Dec 2023 17:16:10 +0000 (17:16 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 22 Dec 2023 17:16:10 +0000 (17:16 +0000)
src/Protocol/ActivityPub.php
src/Protocol/ActivityPub/Transmitter.php
static/defaults.config.php

index c27506ec1ef310501a6a377fef39d4b248f3d190..a9ede518ed49b413e91af75ef2d6761ddc3aa755 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Protocol;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
+use Friendica\DI;
 use Friendica\Model\APContact;
 use Friendica\Model\Contact;
 use Friendica\Model\User;
@@ -305,6 +306,15 @@ class ActivityPub
                        return false;
                }
 
+               $limited = DI::config()->get('system', 'limited_servers');
+               if (!empty($limited)) {
+                       $servers = explode(',', str_replace(' ', '', $limited));
+                       $host = parse_url($contact['baseurl'], PHP_URL_HOST);
+                       if (!empty($host) && in_array($host, $servers)) {
+                               return false;
+                       }
+               }
+
                // @todo Look for user blocked domains
 
                Logger::debug('Server is an accepted requester', ['uid' => $uid, 'id' => $apcontact['gsid'], 'url' => $apcontact['baseurl'], 'signer' => $signer, 'called_by' => $called_by]);
index c15ee42dfe33248a31556562d0153940622b7e47..94655eead17a095d54cbca40f0ca799eddb94501 100644 (file)
@@ -373,9 +373,9 @@ class Transmitter
                }
 
                $data['preferredUsername'] = $owner['nick'];
-               $data['name'] = $owner['name'];
+               $data['name'] = $full ? $owner['name'] : $owner['nick'];
 
-               if (!$full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
+               if ($full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
                        $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
                                'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
                }
index 3eedd8a901412cd0d61681213ec3fbd9256ca162..b33b30b562065e47abee6860b02912fa033397a4 100644 (file)
@@ -325,6 +325,10 @@ return [
                // Don't update the "commented" value of an item when it is liked.
                'like_no_comment' => false,
 
+               // limited_servers (String)
+               // A comma separated list of server hostnames that should get limited profile data
+               'limited_servers' => '',
+
                // local_tags (Boolean)
                // If activated, all hashtags will point to the local server.
                'local_tags' => true,