mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-12 23:14:43 +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:
parent
d9490c6518
commit
0a8fe57003
19 changed files with 179 additions and 182 deletions
|
@ -23,17 +23,10 @@ class SetBridgeCacheAction 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'] ?? '');
|
||||
|
||||
// whitelist control
|
||||
if (!$bridgeFactory->isWhitelisted($bridgeClassName)) {
|
||||
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
|
||||
throw new \Exception('This bridge is not whitelisted', 401);
|
||||
die;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue