diff --git a/classes/webhook_comp/discord.php b/classes/webhook_comp/discord.php index 6f04c07..d54730b 100644 --- a/classes/webhook_comp/discord.php +++ b/classes/webhook_comp/discord.php @@ -21,15 +21,17 @@ class discord return $this->json->content; } - if(!empty($this->json->embeds->title)) + $this->readable .= PHP_EOL; + + if(!empty($this->json->embeds[0]->title)) { - $this->readable .= $this->json->embeds->title . PHP_EOL; + $this->readable .= $this->json->embeds[0]->title . PHP_EOL; } - if(!empty($this->json->embeds->description)) + if(!empty($this->json->embeds[0]->description)) { - $this->readable .= preg_replace("/(?:__|[*#])|\[(.*?)\]\(.*?\)/"," ",$this->json->embeds->description) . PHP_EOL; - $this->readable .= $this->json->embeds->url; + $this->readable .= preg_replace("/(?:__|[*#])|\[(.*?)\]\(.*?\)/"," ",$this->json->embeds[0]->description) . PHP_EOL; + $this->readable .= $this->json->embeds[0]->url; } return $this->readable; diff --git a/includes/app.php b/includes/app.php index 987e5fd..6715e55 100644 --- a/includes/app.php +++ b/includes/app.php @@ -89,13 +89,13 @@ class app private function checkIfCompatibilityClassNeeded() { - - if(array_key_exists("HTTP_X_GITEA_DELIVERY",$_SERVER)) + $comp = $_GET["comp"] ?? ""; + if(array_key_exists("HTTP_X_GITEA_DELIVERY",$_SERVER) || $comp === "gitea") { return 'gitea'; } - if(isset($_SERVER['User-Agent']) && $_SERVER['User-Agent'] === "Grafana") + if(isset($_SERVER['User-Agent']) && $_SERVER['User-Agent'] === "Grafana" || $comp === "Grafana") { return 'grafana'; }