1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-09-02 20:52:44 +02:00

feat: enable bridges using env var (#3428)

* refactor: bridgefactory, add tests

* refactor: move defaultly enabled bridges to config

* refactor

* refactor

* feat: add support for enabling bridges with env var
This commit is contained in:
Dag
2023-06-11 03:16:03 +02:00
committed by GitHub
parent d9490c6518
commit 0a8fe57003
19 changed files with 179 additions and 182 deletions

View File

@@ -18,20 +18,13 @@ class DisplayAction implements ActionInterface
{
$bridgeFactory = new BridgeFactory();
$bridgeClassName = null;
if (isset($request['bridge'])) {
$bridgeClassName = $bridgeFactory->sanitizeBridgeName($request['bridge']);
}
if ($bridgeClassName === null) {
throw new \InvalidArgumentException('Bridge name invalid!');
}
$bridgeClassName = $bridgeFactory->createBridgeClassName($request['bridge'] ?? '');
$format = $request['format'] ?? null;
if (!$format) {
throw new \Exception('You must specify a format!');
}
if (!$bridgeFactory->isWhitelisted($bridgeClassName)) {
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
throw new \Exception('This bridge is not whitelisted');
}