diff options
Diffstat (limited to 'app/Controller/Webhook.php')
-rw-r--r-- | app/Controller/Webhook.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index dcd66a1a..1ae3b0a4 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -57,7 +57,27 @@ class Webhook extends Base $result = $this->githubWebhook->parsePayload( $this->request->getHeader('X-Github-Event'), - $this->request->getJson() + $this->request->getJson() ?: array() + ); + + echo $result ? 'PARSED' : 'IGNORED'; + } + + /** + * Handle Gitlab webhooks + * + * @access public + */ + public function gitlab() + { + if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + $this->response->text('Not Authorized', 401); + } + + $this->gitlabWebhook->setProjectId($this->request->getIntegerParam('project_id')); + + $result = $this->gitlabWebhook->parsePayload( + $this->request->getJson() ?: array() ); echo $result ? 'PARSED' : 'IGNORED'; |