[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
This commit is contained in:
parent
48b42c539c
commit
7027633ed5
@ -89,7 +89,8 @@ class WebHooks extends Plugin
|
|||||||
$json = str_replace('"activity":"%activity%"', '"activity":' . \Plugin\ActivityPub\Util\Model\Activity::toJson($activity), json_encode($data));
|
$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]]);
|
Log::debug("WebHooks: POST {$target} on behalf of actor {$actor->getId()} ({$actor->getNickname()})", [$data, ['json' => $json]]);
|
||||||
try {
|
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) {
|
} catch (Exception $e) {
|
||||||
Log::debug("WebHooks: Failed POST {$target} on behalf of actor {$actor->getId()} ({$actor->getNickname()})", [$e]);
|
Log::debug("WebHooks: Failed POST {$target} on behalf of actor {$actor->getId()} ({$actor->getNickname()})", [$e]);
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,9 @@ parameters:
|
|||||||
max_px: 64000
|
max_px: 64000
|
||||||
max_file_size: 4000000
|
max_file_size: 4000000
|
||||||
|
|
||||||
|
plugin_webhooks:
|
||||||
|
method: post
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
server:
|
server:
|
||||||
ssl:
|
ssl:
|
||||||
|
Loading…
Reference in New Issue
Block a user