all
Some checks failed
Publish Docker Image / build-and-push (push) Failing after 2m13s

This commit is contained in:
Sam Kintop
2026-04-30 09:44:02 -05:00
parent 0a30837e3d
commit bf3870ccca
111 changed files with 8383 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Aternos\Mclogs\Api\Action;
use Aternos\Mclogs\Api\ContentParser;
use Aternos\Mclogs\Api\Response\ApiResponse;
use Aternos\Mclogs\Router\Action;
abstract class ApiAction extends Action
{
abstract protected function runApi(): ApiResponse;
protected function getAllowedOrigin(): string
{
return '*';
}
protected function shouldAllowCredentials(): bool
{
return false;
}
public function run(): bool
{
header('Access-Control-Allow-Origin: ' . $this->getAllowedOrigin());
header('Access-Control-Allow-Headers: *');
if ($this->shouldAllowCredentials()) {
header('Access-Control-Allow-Credentials: true');
}
header("Accept-Encoding: " . implode(",", ContentParser::getSupportedEncodings()));
$response = $this->runApi();
$response->output();
return true;
}
}