mastodonapi.php aktualisiert

This commit is contained in:
simonpipe 2025-08-13 16:53:55 +02:00
parent ff79613156
commit f1707f96c6

View file

@ -1,4 +1,7 @@
<?php <?php
// MastodonAPI extension, https://codeberg.org/simonpipe/yellow-mastodonapi
// Yellow CMS Plugin for Mastodon & GoToSocial
class YellowMastodonAPI { class YellowMastodonAPI {
const VERSION = "0.6"; const VERSION = "0.6";
public $yellow; public $yellow;
@ -269,9 +272,15 @@ MD;
private function sendResponse($message, $statusCode = 200) { private function sendResponse($message, $statusCode = 200) {
if (!headers_sent()) { if (!headers_sent()) {
header("HTTP/1.1 $statusCode"); header("HTTP/1.1 $statusCode");
header("Content-Type: text/html"); header("Content-Type: text/html; charset=UTF-8");
} }
echo "<h1>" . htmlspecialchars($message) . "</h1>"; $redirectUrl = rtrim(dirname($_SERVER['REQUEST_URI']), '/'); // geht eine Ebene hoch
echo "<!DOCTYPE html><html><head>";
echo "<meta http-equiv='refresh' content='5;url={$redirectUrl}'>";
echo "<title>Mastodon/GoToSocial API</title></head><body>";
echo "<p>" . htmlspecialchars($message) . "</p>";
echo "<p>Du wirst in 5 Sekunden weitergeleitet…</p>";
echo "</body></html>";
exit; exit;
} }
} }