mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-05 00:59:35 +00:00
yuop (#4193)
This commit is contained in:
parent
401cc187b7
commit
6ec9193546
@ -19,7 +19,7 @@ class ConnectivityAction implements ActionInterface
|
|||||||
$this->bridgeFactory = new BridgeFactory();
|
$this->bridgeFactory = new BridgeFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
if (!Debug::isEnabled()) {
|
if (!Debug::isEnabled()) {
|
||||||
return new Response('This action is only available in debug mode!', 403);
|
return new Response('This action is only available in debug mode!', 403);
|
||||||
@ -27,7 +27,7 @@ class ConnectivityAction implements ActionInterface
|
|||||||
|
|
||||||
$bridgeName = $request->get('bridge');
|
$bridgeName = $request->get('bridge');
|
||||||
if (!$bridgeName) {
|
if (!$bridgeName) {
|
||||||
return render_template('connectivity.html.php');
|
return new Response(render_template('connectivity.html.php'));
|
||||||
}
|
}
|
||||||
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($bridgeName);
|
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($bridgeName);
|
||||||
if (!$bridgeClassName) {
|
if (!$bridgeClassName) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class DetectAction implements ActionInterface
|
class DetectAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$url = $request->get('url');
|
$url = $request->get('url');
|
||||||
$format = $request->get('format');
|
$format = $request->get('format');
|
||||||
|
@ -11,7 +11,7 @@ class DisplayAction implements ActionInterface
|
|||||||
$this->logger = RssBridge::getLogger();
|
$this->logger = RssBridge::getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$bridgeName = $request->get('bridge');
|
$bridgeName = $request->get('bridge');
|
||||||
$format = $request->get('format');
|
$format = $request->get('format');
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
class FindfeedAction implements ActionInterface
|
class FindfeedAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$url = $request->get('url');
|
$url = $request->get('url');
|
||||||
$format = $request->get('format');
|
$format = $request->get('format');
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
final class FrontpageAction implements ActionInterface
|
final class FrontpageAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$messages = [];
|
$messages = [];
|
||||||
$activeBridges = 0;
|
$activeBridges = 0;
|
||||||
@ -26,13 +26,13 @@ final class FrontpageAction implements ActionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo: cache this renderered template?
|
// todo: cache this renderered template?
|
||||||
return render(__DIR__ . '/../templates/frontpage.html.php', [
|
return new Response(render(__DIR__ . '/../templates/frontpage.html.php', [
|
||||||
'messages' => $messages,
|
'messages' => $messages,
|
||||||
'admin_email' => Configuration::getConfig('admin', 'email'),
|
'admin_email' => Configuration::getConfig('admin', 'email'),
|
||||||
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
|
'admin_telegram' => Configuration::getConfig('admin', 'telegram'),
|
||||||
'bridges' => $body,
|
'bridges' => $body,
|
||||||
'active_bridges' => $activeBridges,
|
'active_bridges' => $activeBridges,
|
||||||
'total_bridges' => count($bridgeClassNames),
|
'total_bridges' => count($bridgeClassNames),
|
||||||
]);
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
class HealthAction implements ActionInterface
|
class HealthAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$response = [
|
$response = [
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class ListAction implements ActionInterface
|
class ListAction implements ActionInterface
|
||||||
{
|
{
|
||||||
public function execute(Request $request)
|
public function __invoke(Request $request): Response
|
||||||
{
|
{
|
||||||
$list = new \stdClass();
|
$list = new \stdClass();
|
||||||
$list->bridges = [];
|
$list->bridges = [];
|
||||||
|
@ -2,8 +2,5 @@
|
|||||||
|
|
||||||
interface ActionInterface
|
interface ActionInterface
|
||||||
{
|
{
|
||||||
/**
|
public function __invoke(Request $request): Response;
|
||||||
* @return string|Response
|
|
||||||
*/
|
|
||||||
public function execute(Request $request);
|
|
||||||
}
|
}
|
||||||
|
@ -100,11 +100,8 @@ final class RssBridge
|
|||||||
$className = '\\' . $actionName;
|
$className = '\\' . $actionName;
|
||||||
$actionObject = new $className();
|
$actionObject = new $className();
|
||||||
|
|
||||||
$response = $actionObject->execute($request);
|
$response = $actionObject($request);
|
||||||
|
|
||||||
if (is_string($response)) {
|
|
||||||
$response = new Response($response);
|
|
||||||
}
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user