autoJumpFirstDisk

pull/128/head
qkqpttgf 2020-08-17 17:31:51 +08:00 committed by GitHub
parent 127febb75d
commit 267b17102c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -19,6 +19,7 @@ $Base64Env = [
//'HW_secret', // used in FG. //'HW_secret', // used in FG.
//'admin', //'admin',
//'adminloginpage', //'adminloginpage',
//'autoJumpFirstDisk',
'background', 'background',
'backgroundm', 'backgroundm',
'diskname', 'diskname',
@ -64,6 +65,7 @@ $CommonEnv = [
'HW_secret', // used in FG. 'HW_secret', // used in FG.
'admin', 'admin',
'adminloginpage', 'adminloginpage',
'autoJumpFirstDisk',
'background', 'background',
'backgroundm', 'backgroundm',
'disktag', 'disktag',
@ -91,6 +93,7 @@ $ShowedCommonEnv = [
//'HW_secret', // used in FG. //'HW_secret', // used in FG.
//'admin', //'admin',
'adminloginpage', 'adminloginpage',
'autoJumpFirstDisk',
'background', 'background',
'backgroundm', 'backgroundm',
//'disktag', //'disktag',
@ -255,16 +258,17 @@ function main($path)
// echo 'count$disk:'.count($disktags); // echo 'count$disk:'.count($disktags);
if (count($disktags)>1) { if (count($disktags)>1) {
if ($path=='/'||$path=='') { if ($path=='/'||$path=='') {
if ($_GET['json']) {
// return a json
$files['folder']['childCount'] = count($disktags); $files['folder']['childCount'] = count($disktags);
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
$files['children'][$disktag]['folder'] = 1; $files['children'][$disktag]['folder'] = 1;
$files['children'][$disktag]['name'] = $disktag; $files['children'][$disktag]['name'] = $disktag;
} }
if ($_GET['json']) {
// return a json
return files_json($files); return files_json($files);
} // else return render_list($path, $files); }
return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
return render_list($path, $files);
} }
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/'); //$pos = strpos($path, '/');