modify filters

This commit is contained in:
Mateusz Pieła 2021-05-15 11:26:20 +02:00
parent 096f91cd74
commit e4c80782f8
4 changed files with 114 additions and 12 deletions

View file

@ -77,8 +77,8 @@ class app
private function handleIncomingData(): void
{
$post = file_get_contents("php://input");
$filter = $this->checkIfFilterNeeded();
$wh = new Webhook($post,$filter);
$comp = $this->checkIfCompatibilityClassNeeded();
$wh = new Webhook($post,$comp);
$xmpp = new Xmpp();
$xmpp->start();
@ -87,13 +87,19 @@ class app
$xmpp->disconnect();
}
private function checkIfFilterNeeded()
private function checkIfCompatibilityClassNeeded()
{
if(array_key_exists("HTTP_X_GITEA_DELIVERY",$_SERVER))
{
return 'gitea';
}
if(isset($_SERVER['User-Agent']) && $_SERVER['User-Agent'] === "Grafana")
{
return 'grafana';
}
return false;
}
@ -115,4 +121,4 @@ class app
return $ip;
}
}
}