Improved templating engine wrapping.

This commit is contained in:
flash 2025-04-03 14:37:19 +00:00
parent e4c3e4c052
commit ceb6bece09
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
86 changed files with 784 additions and 515 deletions
public

View file

@ -27,12 +27,9 @@ if(is_file($msz->dbCtx->getMigrateLockPath())) {
}
$request = \Index\Http\HttpRequest::fromRequest();
$msz->registerRequestRoutes($request);
// order for these two currently matters i think: it shouldn't.
$router = $msz->createRouting($request);
$msz->startTemplating();
if($msz->domainRoles->hasRole($request->getHeaderLine('Host'), 'main')) {
if($msz->routingCtx->domainRoles->hasRole($request->getHeaderLine('Host'), 'main')) {
$mszRequestPath = substr($request->requestTarget, 1);
$mszLegacyPathPrefix = Misuzu::PATH_PUBLIC_LEGACY . '/';
$mszLegacyPath = $mszLegacyPathPrefix . $mszRequestPath;
@ -41,7 +38,7 @@ if($msz->domainRoles->hasRole($request->getHeaderLine('Host'), 'main')) {
$mszLegacyPathReal = realpath($mszLegacyPath);
if($mszLegacyPath === $mszLegacyPathReal || $mszLegacyPath === $mszLegacyPathReal . '/') {
// this is here so filters can run...
$router->router->route(RouteInfo::exact(
$msz->routingCtx->router->route(RouteInfo::exact(
$request->method,
$request->requestTarget,
#[Before('authz:cookie')]
@ -50,7 +47,7 @@ if($msz->domainRoles->hasRole($request->getHeaderLine('Host'), 'main')) {
return 403;
},
));
$response = $router->router->handle($request);
$response = $msz->routingCtx->router->handle($request);
if($response->getBody()->getSize() > 0) {
Router::output($response);
exit;
@ -112,4 +109,4 @@ if($msz->domainRoles->hasRole($request->getHeaderLine('Host'), 'main')) {
}
}
$router->dispatch($request);
$msz->routingCtx->dispatch($request);