Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/worker/HeraldWebhookWorker.php
Show First 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | foreach ($xactions as $xaction) { | ||||
); | ); | ||||
} | } | ||||
$payload = array( | $payload = array( | ||||
'triggers' => array(), | 'triggers' => array(), | ||||
'object' => array( | 'object' => array( | ||||
'phid' => $object->getPHID(), | 'phid' => $object->getPHID(), | ||||
), | ), | ||||
'action' => array( | |||||
'test' => $request->getIsTestAction(), | |||||
'silent' => $request->getIsSilentAction(), | |||||
'secure' => $request->getIsSecureAction(), | |||||
), | |||||
'transactions' => $xaction_data, | 'transactions' => $xaction_data, | ||||
); | ); | ||||
$payload = phutil_json_encode($payload); | $payload = id(new PhutilJSON())->encodeFormatted($payload); | ||||
$key = $hook->getHmacKey(); | $key = $hook->getHmacKey(); | ||||
$signature = PhabricatorHash::digestHMACSHA256($payload, $key); | $signature = PhabricatorHash::digestHMACSHA256($payload, $key); | ||||
$uri = $hook->getWebhookURI(); | $uri = $hook->getWebhookURI(); | ||||
$future = id(new HTTPSFuture($uri)) | $future = id(new HTTPSFuture($uri)) | ||||
->setMethod('POST') | ->setMethod('POST') | ||||
->addHeader('Content-Type', 'application/json') | ->addHeader('Content-Type', 'application/json') | ||||
->addHeader('X-Phabricator-Webhook-Signature', $signature) | ->addHeader('X-Phabricator-Webhook-Signature', $signature) | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |