1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-05 16:17:28 +02:00

refactor: implement middleware chain (#4240)

* refactor: implement middleware chain

* refactor
This commit is contained in:
Dag
2024-08-30 00:07:58 +02:00
committed by GitHub
parent e7ae06dcf0
commit 39952c2d95
7 changed files with 128 additions and 61 deletions

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
class MaintenanceMiddleware implements Middleware
{
public function __invoke(Request $request, $next): Response
{
if (!Configuration::getConfig('system', 'enable_maintenance_mode')) {
return $next($request);
}
return new Response(render(__DIR__ . '/../templates/error.html.php', [
'title' => '503 Service Unavailable',
'message' => 'RSS-Bridge is down for maintenance.',
]), 503);
}
}