mirror of
https://gitlab.crans.org/elkmaennchen/gitscord-webhook
synced 2025-10-11 02:00:04 +02:00
check if the request come from Gitlab
This commit is contained in:
parent
d0fa8493e7
commit
86e2d641b7
1 changed files with 34 additions and 29 deletions
|
@ -41,6 +41,7 @@ if ($plainJSON != '') {
|
|||
// process Gitlab data
|
||||
$JSON = json_decode($plainJSON, true);
|
||||
if (is_array($JSON)) { // valid JSON
|
||||
if (isset($_SERVER['HTTP_X_GITLAB_EVENT'])) { // comming from a gitlab instance
|
||||
switch ($JSON['object_kind']){ // type of event
|
||||
case "push": // push event
|
||||
$messageJSON = push_layout($messageJSON,$JSON,$lang,$mhl_color);
|
||||
|
@ -71,6 +72,10 @@ if ($plainJSON != '') {
|
|||
default:
|
||||
send_error($url,"Unknown type of event");
|
||||
}
|
||||
}
|
||||
else {
|
||||
send_error($url,"Unknown git manager. Gitscord only support Gitlab.");
|
||||
}
|
||||
// sending post request to Discord
|
||||
send_to_discord($url,$messageJSON);
|
||||
exit;
|
||||
|
|
Loading…
Reference in a new issue