mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 06:08:27 +01:00
refactor: display action (#3508)
This commit is contained in:
parent
c1c8304fc0
commit
8b996e3056
@ -38,22 +38,22 @@ class DisplayAction implements ActionInterface
|
||||
$bridge = $bridgeFactory->create($bridgeClassName);
|
||||
$bridge->loadConfiguration();
|
||||
|
||||
$noproxy = array_key_exists('_noproxy', $request) && filter_var($request['_noproxy'], FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (Configuration::getConfig('proxy', 'url') && Configuration::getConfig('proxy', 'by_bridge') && $noproxy) {
|
||||
$noproxy = $request['_noproxy'] ?? null;
|
||||
if (
|
||||
Configuration::getConfig('proxy', 'url')
|
||||
&& Configuration::getConfig('proxy', 'by_bridge')
|
||||
&& $noproxy
|
||||
) {
|
||||
// This const is only used once in getContents()
|
||||
define('NOPROXY', true);
|
||||
}
|
||||
|
||||
if (array_key_exists('_cache_timeout', $request)) {
|
||||
if (! Configuration::getConfig('cache', 'custom_timeout')) {
|
||||
unset($request['_cache_timeout']);
|
||||
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) . '?' . http_build_query($request);
|
||||
return new Response('', 301, ['Location' => $uri]);
|
||||
}
|
||||
|
||||
$cache_timeout = filter_var($request['_cache_timeout'], FILTER_VALIDATE_INT);
|
||||
$cacheTimeout = $request['_cache_timeout'] ?? null;
|
||||
if (Configuration::getConfig('cache', 'custom_timeout') && $cacheTimeout) {
|
||||
$cacheTimeout = (int) $cacheTimeout;
|
||||
} else {
|
||||
$cache_timeout = $bridge->getCacheTimeout();
|
||||
// At this point the query argument might still be in the url but it won't be used
|
||||
$cacheTimeout = $bridge->getCacheTimeout();
|
||||
}
|
||||
|
||||
// Remove parameters that don't concern bridges
|
||||
@ -99,7 +99,7 @@ class DisplayAction implements ActionInterface
|
||||
|
||||
if (
|
||||
$mtime
|
||||
&& (time() - $cache_timeout < $mtime)
|
||||
&& (time() - $cacheTimeout < $mtime)
|
||||
&& !Debug::isEnabled()
|
||||
) {
|
||||
// At this point we found the feed in the cache and debug mode is disabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user