From 5f074bc4e7534f91d61f76faec06e736b8005221 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 19 Nov 2022 19:55:01 -0500 Subject: [PATCH] Add support for Mastodon /authorize_interaction route - It is used by Fedifind to follow people who set their Webfinger address in their Twitter bio --- src/Module/Contact/Follow.php | 4 +++- static/routes.config.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Module/Contact/Follow.php b/src/Module/Contact/Follow.php index c27476940..f8b88c05f 100644 --- a/src/Module/Contact/Follow.php +++ b/src/Module/Contact/Follow.php @@ -88,7 +88,9 @@ class Follow extends BaseModule } $uid = $this->session->getLocalUserId(); - $url = Probe::cleanURI(trim($request['url'] ?? '')); + + // uri is used by the /authorize_interaction Mastodon route + $url = Probe::cleanURI(trim($request['uri'] ?? $request['url'] ?? '')); // Issue 6874: Allow remote following from Peertube if (strpos($url, 'acct:') === 0) { diff --git a/static/routes.config.php b/static/routes.config.php index 5f5c238e0..9adc8ec1d 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -342,6 +342,10 @@ return [ '/acctlink' => [Module\Acctlink::class, [R::GET]], '/apps' => [Module\Apps::class, [R::GET]], '/attach/{item:\d+}' => [Module\Attach::class, [R::GET]], + + // Mastodon route used by Fedifind to follow people who set their Webfinger address in their Twitter bio + '/authorize_interaction' => [Module\Contact\Follow::class, [R::GET, R::POST]], + '/babel' => [Module\Debug\Babel::class, [R::GET, R::POST]], '/debug/ap' => [Module\Debug\ActivityPubConversion::class, [R::GET, R::POST]],