kernal clean-up

This commit is contained in:
root
2025-12-21 19:33:47 -05:00
parent 3ffabfe3a3
commit 658a319ded
22 changed files with 832 additions and 334 deletions

View File

@@ -2,24 +2,23 @@
namespace KTXC\Controllers;
use DI\Attribute\Inject;
use KTXC\Http\Response\Response;
use KTXC\Http\Response\FileResponse;
use KTXC\Http\Response\JsonResponse;
use KTXC\Http\Response\RedirectResponse;
use KTXC\Server;
use KTXF\Controller\ControllerAbstract;
use KTXF\Routing\Attributes\AnonymousRoute;
use KTXC\Service\SecurityService;
use KTXC\SessionIdentity;
use KTXC\SessionTenant;
use KTXC\Http\Request\Request;
class DefaultController extends ControllerAbstract
{
public function __construct(
private readonly SecurityService $securityService,
private readonly SessionTenant $tenant,
private readonly SessionIdentity $identity,
#[Inject('rootDir')] private readonly string $rootDir,
) {}
#[AnonymousRoute('/', name: 'root', methods: ['GET'])]
@@ -28,7 +27,7 @@ class DefaultController extends ControllerAbstract
// If an authenticated identity is available, serve the private app
if ($this->identity->identifier()) {
return new FileResponse(
Server::runtimeRootLocation() . '/public/private.html',
$this->rootDir . '/public/private.html',
Response::HTTP_OK,
['Content-Type' => 'text/html']
);
@@ -37,7 +36,7 @@ class DefaultController extends ControllerAbstract
// User is not authenticated - serve the public app
// If there's an accessToken cookie present but invalid, clear it
$response = new FileResponse(
Server::runtimeRootLocation() . '/public/public.html',
$this->rootDir . '/public/public.html',
Response::HTTP_OK,
['Content-Type' => 'text/html']
);
@@ -57,7 +56,7 @@ class DefaultController extends ControllerAbstract
public function login(): Response
{
return new FileResponse(
Server::runtimeRootLocation() . '/public/public.html',
$this->rootDir . '/public/public.html',
Response::HTTP_OK,
['Content-Type' => 'text/html']
);
@@ -119,7 +118,7 @@ class DefaultController extends ControllerAbstract
// If an authenticated identity is available, serve the private app
if ($this->identity->identifier()) {
return new FileResponse(
Server::runtimeRootLocation() . '/public/private.html',
$this->rootDir . '/public/private.html',
Response::HTTP_OK,
['Content-Type' => 'text/html']
);
@@ -127,7 +126,7 @@ class DefaultController extends ControllerAbstract
// User is not authenticated - serve the public app
$response = new FileResponse(
Server::runtimeRootLocation() . '/public/public.html',
$this->rootDir . '/public/public.html',
Response::HTTP_OK,
['Content-Type' => 'text/html']
);