Files
emailtemplate.it/api/index.php
2026-02-09 01:38:39 +01:00

25 lines
738 B
PHP
Executable File

<?php
declare(strict_types=1);
/**
* Public API front controller for api.(staging.)emailtemplate.it
* Routes requests to the shared ApiKernel but marks the scope as "external".
*/
// Force scope flag so ApiKernel can limit available actions if needed
$_GET['scope'] = $_GET['scope'] ?? 'external';
// Map /external/render requests to the correct ApiKernel action when no action is given
$reqPath = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH);
if (
empty($_GET['action'])
&& empty($_POST['action'])
&& is_string($reqPath)
&& preg_match('~^/external/render/?$~', $reqPath)
) {
$_POST['action'] = 'external.render';
}
// Re-use the existing kernel bootstrap
require_once __DIR__ . '/../public/api.php';