Prototype gitea filter

This commit is contained in:
Mateusz Pieła 2021-04-27 09:06:56 +02:00
parent db60346a8c
commit 0daf2494d2
4 changed files with 51 additions and 2 deletions

View file

@ -77,7 +77,8 @@ class app
private function handleIncomingData(): void
{
$post = file_get_contents("php://input");
$wh = new Webhook($post);
$filter = $this->checkIfFilterNeeded();
$wh = new Webhook($post,$filter);
$xmpp = new Xmpp();
$xmpp->start();
@ -86,6 +87,15 @@ class app
$xmpp->disconnect();
}
private function checkIfFilterNeeded()
{
if(in_array("X-Gitea",$_SERVER))
{
return 'gitea';
}
return false;
}
private function getRealIPAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))