mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 14:18:35 +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 = $bridgeFactory->create($bridgeClassName);
|
||||||
$bridge->loadConfiguration();
|
$bridge->loadConfiguration();
|
||||||
|
|
||||||
$noproxy = array_key_exists('_noproxy', $request) && filter_var($request['_noproxy'], FILTER_VALIDATE_BOOLEAN);
|
$noproxy = $request['_noproxy'] ?? null;
|
||||||
|
if (
|
||||||
if (Configuration::getConfig('proxy', 'url') && Configuration::getConfig('proxy', 'by_bridge') && $noproxy) {
|
Configuration::getConfig('proxy', 'url')
|
||||||
|
&& Configuration::getConfig('proxy', 'by_bridge')
|
||||||
|
&& $noproxy
|
||||||
|
) {
|
||||||
|
// This const is only used once in getContents()
|
||||||
define('NOPROXY', true);
|
define('NOPROXY', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('_cache_timeout', $request)) {
|
$cacheTimeout = $request['_cache_timeout'] ?? null;
|
||||||
if (! Configuration::getConfig('cache', 'custom_timeout')) {
|
if (Configuration::getConfig('cache', 'custom_timeout') && $cacheTimeout) {
|
||||||
unset($request['_cache_timeout']);
|
$cacheTimeout = (int) $cacheTimeout;
|
||||||
$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);
|
|
||||||
} else {
|
} 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
|
// Remove parameters that don't concern bridges
|
||||||
@ -99,7 +99,7 @@ class DisplayAction implements ActionInterface
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
$mtime
|
$mtime
|
||||||
&& (time() - $cache_timeout < $mtime)
|
&& (time() - $cacheTimeout < $mtime)
|
||||||
&& !Debug::isEnabled()
|
&& !Debug::isEnabled()
|
||||||
) {
|
) {
|
||||||
// At this point we found the feed in the cache and debug mode is disabled
|
// At this point we found the feed in the cache and debug mode is disabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user