From 6342fe28b2922fb48012c4d2135d0b75249a9f83 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 1 Nov 2024 13:16:31 +1100 Subject: [PATCH] Revert "Force posting to matrix to use IPv4 resolution" This might not be required afterall This reverts commit 881449a1702b5a49905500364e5abc6c9122e56f. --- app/Notifications/Matrix/Echomail.php | 18 ++++++------------ composer.json | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/Notifications/Matrix/Echomail.php b/app/Notifications/Matrix/Echomail.php index eef8f0b..2beb611 100644 --- a/app/Notifications/Matrix/Echomail.php +++ b/app/Notifications/Matrix/Echomail.php @@ -45,18 +45,12 @@ class Echomail extends Matrix $user = sprintf('@%s:%s',$username,config('matrix.server')); - // @todo We need to force IP4 as running clrghouz in a container without a proper IPv6 address is problematic - $matrix = Http::withToken(config('matrix.as_token')) - ->withOptions([ - CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, - ]); - // Set topic if it is different: - $subject = $matrix + $subject = Http::withToken(config('matrix.as_token')) ->get(sprintf('https://%s/_matrix/client/v3/rooms/%s/state/m.room.topic',config('matrix.server'),$room)); if (($x=preg_replace('/^RE:\s*/i','',$this->o->subject)) !== $subject->json('topic','Message from Matrix')) { - $topic = $matrix + $topic = Http::withToken(config('matrix.as_token')) ->put(sprintf('https://%s/_matrix/client/v3/rooms/%s/state/m.room.topic',config('matrix.server'),$room),[ 'topic'=>$x, ]); @@ -67,7 +61,7 @@ class Echomail extends Matrix $omsg = preg_replace("/\r---.*$/U",'',$this->o->msg); - $msg = $matrix + $msg = Http::withToken(config('matrix.as_token')) ->withQueryParameters(['user_id'=>$user]) ->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/send/m.room.message',config('matrix.server'),$room),[ 'msgtype'=>'m.text', @@ -87,7 +81,7 @@ class Echomail extends Matrix // If the user doesnt exist in matrix yet if (str_starts_with($msg->json('error'),'Application service has not registered this user')) { // Register user - $msg = $matrix + $msg = Http::withToken(config('matrix.as_token')) ->post(sprintf('https://%s/_matrix/client/v3/register',config('matrix.server')),[ 'type'=>'m.login.application_service', 'username'=>$username, @@ -100,7 +94,7 @@ class Echomail extends Matrix // @todo Test that the user has been invited // Invite user - $msg = $matrix + $msg = Http::withToken(config('matrix.as_token')) //->withQueryParameters(['user_id'=>$user]) ->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/invite',config('matrix.server'),$room),[ 'user_id'=>$user, @@ -112,7 +106,7 @@ class Echomail extends Matrix } // Join as user - $msg = $matrix + $msg = Http::withToken(config('matrix.as_token')) ->withQueryParameters(['user_id'=>$user]) ->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/join',config('matrix.server'),$room),[ 'user_id'=>$user, diff --git a/composer.json b/composer.json index 7819077..b69c651 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "require": { "php": "^8.2|8.3", "ext-bz2": "*", - "ext-curl": "*", "ext-pcntl": "*", "ext-sockets": "*", "ext-zip": "*",