From 7027633ed5a413ac493240eaa0cc86f398ec4eaf Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Thu, 24 Mar 2022 00:50:27 +0000 Subject: [PATCH] [PLUGIN][WebHooks] Make request method configurable This way, PUT can be used, which doesn't seem to be the standard, so isn't the default, but which makes sense to me, as it doesn't have a response, which we don't care about anyway --- plugins/WebHooks/WebHooks.php | 3 ++- social.yaml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/WebHooks/WebHooks.php b/plugins/WebHooks/WebHooks.php index ca13aa061d..e5bd175ef3 100644 --- a/plugins/WebHooks/WebHooks.php +++ b/plugins/WebHooks/WebHooks.php @@ -89,7 +89,8 @@ class WebHooks extends Plugin $json = str_replace('"activity":"%activity%"', '"activity":' . \Plugin\ActivityPub\Util\Model\Activity::toJson($activity), json_encode($data)); Log::debug("WebHooks: POST {$target} on behalf of actor {$actor->getId()} ({$actor->getNickname()})", [$data, ['json' => $json]]); try { - HTTPClient::post($target, ['body' => $json, 'headers' => ['content-type' => 'application/json', 'user-agent' => 'GNU social']]); + $method = Common::config('plugin_webhooks', 'method'); + HTTPClient::{$method}($target, ['body' => $json, 'headers' => ['content-type' => 'application/json', 'user-agent' => 'GNU social']]); } catch (Exception $e) { Log::debug("WebHooks: Failed POST {$target} on behalf of actor {$actor->getId()} ({$actor->getNickname()})", [$e]); } diff --git a/social.yaml b/social.yaml index 30adae1620..e4eff3d6b2 100644 --- a/social.yaml +++ b/social.yaml @@ -135,6 +135,9 @@ parameters: max_px: 64000 max_file_size: 4000000 + plugin_webhooks: + method: post + theme: server: ssl: