mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-16 06:26:24 +02:00
refactor: general code base refactor (#2950)
* refactor * fix: bug in previous refactor * chore: exclude phpcompat sniff due to bug in phpcompat * fix: do not leak absolute paths * refactor/fix: batch extensions checking, fix DOS issue
This commit is contained in:
28
index.php
28
index.php
@ -2,16 +2,19 @@
|
||||
|
||||
require_once __DIR__ . '/lib/rssbridge.php';
|
||||
|
||||
Configuration::verifyInstallation();
|
||||
Configuration::loadConfiguration();
|
||||
|
||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||
|
||||
define('CUSTOM_CACHE_TIMEOUT', Configuration::getConfig('cache', 'custom_timeout'));
|
||||
|
||||
Authentication::showPromptIfNeeded();
|
||||
|
||||
try {
|
||||
Configuration::verifyInstallation();
|
||||
Configuration::loadConfiguration();
|
||||
|
||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||
|
||||
define('CUSTOM_CACHE_TIMEOUT', Configuration::getConfig('cache', 'custom_timeout'));
|
||||
|
||||
$authenticationMiddleware = new AuthenticationMiddleware();
|
||||
if (Configuration::getConfig('authentication', 'enable')) {
|
||||
$authenticationMiddleware();
|
||||
}
|
||||
|
||||
if (isset($argv)) {
|
||||
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
|
||||
$request = $cliArgs;
|
||||
@ -20,12 +23,7 @@ try {
|
||||
}
|
||||
foreach ($request as $key => $value) {
|
||||
if (! is_string($value)) {
|
||||
http_response_code(400);
|
||||
print render('error.html.php', [
|
||||
'title' => '400 Bad Request',
|
||||
'message' => "Query parameter \"$key\" is not a string.",
|
||||
]);
|
||||
exit(1);
|
||||
throw new \Exception("Query parameter \"$key\" is not a string.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user