switch, can downloaded or not while encrpyt

pull/98/head
qkqpttgf 2020-03-04 10:42:01 +08:00 committed by GitHub
parent 4aff58c777
commit be2f353639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -8,7 +8,9 @@ $Base64Env = [
//'admin', //'admin',
//'adminloginpage', //'adminloginpage',
'background', 'background',
'diskname',
//'disktag', //'disktag',
//'downloadencrypt',
//'function_name', // used in heroku. //'function_name', // used in heroku.
//'language', //'language',
//'passfile', //'passfile',
@ -19,7 +21,6 @@ $Base64Env = [
'client_secret', 'client_secret',
'domain_path', 'domain_path',
'guestup_path', 'guestup_path',
'diskname',
'public_path', 'public_path',
//'refresh_token', //'refresh_token',
//'token_expires', //'token_expires',
@ -61,9 +62,10 @@ $InnerEnv = [
'Onedrive_ver', 'Onedrive_ver',
'client_id', 'client_id',
'client_secret', 'client_secret',
'domain_path',
'guestup_path',
'diskname', 'diskname',
'domain_path',
'downloadencrypt',
'guestup_path',
'public_path', 'public_path',
'refresh_token', 'refresh_token',
'token_expires', 'token_expires',
@ -73,9 +75,10 @@ $ShowedInnerEnv = [
//'Onedrive_ver', //'Onedrive_ver',
//'client_id', //'client_id',
//'client_secret', //'client_secret',
'domain_path',
'guestup_path',
'diskname', 'diskname',
'domain_path',
'downloadencrypt',
'guestup_path',
'public_path', 'public_path',
//'refresh_token', //'refresh_token',
//'token_expires', //'token_expires',
@ -613,7 +616,7 @@ function main($path)
$files = list_files($path); $files = list_files($path);
if (isset($files['file']) && !$_GET['preview']) { if (isset($files['file']) && !$_GET['preview']) {
// is file && not preview mode // is file && not preview mode
if ($_SERVER['ishidden']<4) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); if ( $_SERVER['ishidden']<4 || (getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]);
} }
if ( isset($files['folder']) || isset($files['file']) ) { if ( isset($files['folder']) || isset($files['file']) ) {
return render_list($path, $files); return render_list($path, $files);
@ -628,8 +631,8 @@ function list_files($path)
$path = path_format($path); $path = path_format($path);
if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) {
$files = json_decode('{"folder":{}}', true); $files = json_decode('{"folder":{}}', true);
} elseif ($_SERVER['ishidden']==4) { } elseif (!getConfig('downloadencrypt')) {
$files = json_decode('{"folder":{}}', true); if ($_SERVER['ishidden']==4) $files = json_decode('{"folder":{}}', true);
} else { } else {
$files = fetch_files($path); $files = fetch_files($path);
} }