From b5d01337d9ef3f616829956b059ba55a4642798f Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 31 Oct 2022 17:58:04 +0100 Subject: [PATCH] Move Follow to `/contact` namespace --- src/Model/APContact.php | 2 +- src/Model/Profile.php | 2 +- src/Module/Contact/Follow.php | 2 +- src/Module/Xrd.php | 6 +++--- src/Network/Probe.php | 2 +- static/routes.config.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 7b49bab8ab..742efcf190 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -62,7 +62,7 @@ class APContact 'addr' => $local_owner['addr'], 'baseurl' => $local_owner['baseurl'], 'url' => $local_owner['url'], - 'subscribe' => $local_owner['baseurl'] . '/follow?url={uri}']; + 'subscribe' => $local_owner['baseurl'] . '/contact/follow?url={uri}']; if (!empty($local_owner['alias']) && ($local_owner['url'] != $local_owner['alias'])) { $data['alias'] = $local_owner['alias']; diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b73b235385..29f6b29376 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -341,7 +341,7 @@ class Profile if ($visitor_is_following) { $unfollow_link = $visitor_base_path . '/contact/unfollow?url=' . urlencode($profile_url) . '&auto=1'; } else { - $follow_link = $visitor_base_path . '/follow?url=' . urlencode($profile_url) . '&auto=1'; + $follow_link = $visitor_base_path .'/contact/follow?url=' . urlencode($profile_url) . '&auto=1'; } } diff --git a/src/Module/Contact/Follow.php b/src/Module/Contact/Follow.php index 7504501d41..fe523f491e 100644 --- a/src/Module/Contact/Follow.php +++ b/src/Module/Contact/Follow.php @@ -202,7 +202,7 @@ class Follow extends BaseModule protected function process(string $url) { - $returnPath = 'follow?rul=' . urlencode($url); + $returnPath = 'follow?url=' . urlencode($url); $result = Contact::createFromProbeForUser($this->app->getLoggedInUserId(), $url); diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 098c1574ea..4e4603fbdb 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -122,7 +122,7 @@ class Xrd extends BaseModule ], [ 'rel' => 'http://ostatus.org/schema/1.0/subscribe', - 'template' => $baseURL . '/follow?url={uri}', + 'template' => $baseURL . '/contact/follow?url={uri}', ], [ 'rel' => ActivityNamespace::FEED, @@ -212,7 +212,7 @@ class Xrd extends BaseModule ], [ 'rel' => 'http://ostatus.org/schema/1.0/subscribe', - 'template' => $baseURL . '/follow?url={uri}', + 'template' => $baseURL . '/contact/follow?url={uri}', ], [ 'rel' => 'magic-public-key', @@ -312,7 +312,7 @@ class Xrd extends BaseModule '11:link' => [ '@attributes' => [ 'rel' => 'http://ostatus.org/schema/1.0/subscribe', - 'template' => $baseURL . '/follow?url={uri}' + 'template' => $baseURL . '/contact/follow?url={uri}' ] ], '12:link' => [ diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 43f1dca66f..45b838da21 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -2185,7 +2185,7 @@ class Probe 'xmpp' => $owner['xmpp'], 'matrix' => $owner['matrix'], 'hide' => !$owner['net-publish'], 'batch' => '', 'notify' => $owner['notify'], 'poll' => $owner['poll'], 'request' => $owner['request'], 'confirm' => $owner['confirm'], - 'subscribe' => $approfile['generator']['url'] . '/follow?url={uri}', 'poco' => $owner['poco'], + 'subscribe' => $approfile['generator']['url'] . '/contact/follow?url={uri}', 'poco' => $owner['poco'], 'following' => $approfile['following'], 'followers' => $approfile['followers'], 'inbox' => $approfile['inbox'], 'outbox' => $approfile['outbox'], 'sharedinbox' => $approfile['endpoints']['sharedInbox'], 'network' => Protocol::DFRN, diff --git a/static/routes.config.php b/static/routes.config.php index 072ee93878..d21e9efae5 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -387,6 +387,7 @@ return [ '/hidden' => [Module\Contact::class, [R::GET]], '/ignored' => [Module\Contact::class, [R::GET]], '/hovercard' => [Module\Contact\Hovercard::class, [R::GET]], + '/follow[/{url}]' => [Module\Contact\Follow::class, [R::GET, R::POST]], '/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]], ], @@ -418,7 +419,6 @@ return [ '/filed' => [Module\Search\Filed::class, [R::GET]], '/filer[/{id:\d+}]' => [Module\Filer\SaveTag::class, [R::GET]], '/filerm/{id:\d+}' => [Module\Filer\RemoveTag::class, [R::GET, R::POST]], - '/follow[/{url}]' => [Module\Contact\Follow::class, [R::GET, R::POST]], '/follow_confirm' => [Module\FollowConfirm::class, [R::GET, R::POST]], '/followers/{nickname}' => [Module\ActivityPub\Followers::class, [R::GET]], '/following/{nickname}' => [Module\ActivityPub\Following::class, [R::GET]],