Add support for running rss-bridge from the CLI
This commit is contained in:
parent
77657a9154
commit
e30ad3feb4
1 changed files with 12 additions and 6 deletions
18
index.php
18
index.php
|
@ -28,6 +28,14 @@ define('CACHE_DIR', __DIR__ . '/cache');
|
||||||
// Specify path for whitelist file
|
// Specify path for whitelist file
|
||||||
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
|
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Move the CLI arguments to the $_GET array, in order to be able to use
|
||||||
|
rss-bridge from the command line
|
||||||
|
*/
|
||||||
|
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
|
||||||
|
$params = array_merge($_GET, $cliArgs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a file named 'DEBUG' for enabling debug mode.
|
Create a file named 'DEBUG' for enabling debug mode.
|
||||||
For further security, you may put whitelisted IP addresses in the file,
|
For further security, you may put whitelisted IP addresses in the file,
|
||||||
|
@ -124,8 +132,8 @@ try {
|
||||||
$whitelist_selection = array_map('strtolower', $whitelist_selection);
|
$whitelist_selection = array_map('strtolower', $whitelist_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = filter_input(INPUT_GET, 'action');
|
$action = $params['action'];
|
||||||
$bridge = filter_input(INPUT_GET, 'bridge');
|
$bridge = $params['bridge'];
|
||||||
|
|
||||||
if($action === 'display' && !empty($bridge)) {
|
if($action === 'display' && !empty($bridge)) {
|
||||||
// DEPRECATED: 'nameBridge' scheme is replaced by 'name' in bridge parameter values
|
// DEPRECATED: 'nameBridge' scheme is replaced by 'name' in bridge parameter values
|
||||||
|
@ -134,7 +142,7 @@ try {
|
||||||
$bridge = substr($bridge, 0, $pos);
|
$bridge = substr($bridge, 0, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = filter_input(INPUT_GET, 'format')
|
$format = $params['format']
|
||||||
or returnClientError('You must specify a format!');
|
or returnClientError('You must specify a format!');
|
||||||
|
|
||||||
// DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values
|
// DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values
|
||||||
|
@ -152,13 +160,11 @@ try {
|
||||||
// Data retrieval
|
// Data retrieval
|
||||||
$bridge = Bridge::create($bridge);
|
$bridge = Bridge::create($bridge);
|
||||||
|
|
||||||
$noproxy = filter_input(INPUT_GET, '_noproxy', FILTER_VALIDATE_BOOLEAN);
|
$noproxy = filter_var($params['_noproxy'], FILTER_VALIDATE_BOOLEAN);
|
||||||
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
|
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
|
||||||
define('NOPROXY', true);
|
define('NOPROXY', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = $_GET;
|
|
||||||
|
|
||||||
// Initialize cache
|
// Initialize cache
|
||||||
$cache = Cache::create('FileCache');
|
$cache = Cache::create('FileCache');
|
||||||
$cache->setPath(CACHE_DIR);
|
$cache->setPath(CACHE_DIR);
|
||||||
|
|
Loading…
Reference in a new issue