Update common.php

This commit is contained in:
qkqpttgf 2020-03-04 17:13:36 +08:00 committed by GitHub
parent a30eb7650f
commit 5a60104ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -38,6 +38,7 @@ $CommonEnv = [
'function_name', // used in heroku.
'language',
'passfile',
'proxydownload',
'sitename',
'theme',
];
@ -54,6 +55,7 @@ $ShowedCommonEnv = [
//'function_name', // used in heroku.
'language',
'passfile',
'proxydownload',
'sitename',
'theme',
];
@ -616,7 +618,14 @@ function main($path)
$files = list_files($path);
if (isset($files['file']) && !$_GET['preview']) {
// is file && not preview mode
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]);
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) {
if (getConfig('proxydownload')) {
$header = [];
if (isset($_SERVER['headers']['range'])) $header = [ 'Range' => $_SERVER['headers']['range'] ];
$response = curl_request( $files['@microsoft.graph.downloadUrl'], '', $header );
return output( base64_encode($response['body']), $response['stat'], ['Content-Type' => 'application/octet-stream'], true );
} else return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]);
}
}
if ( isset($files['folder']) || isset($files['file']) ) {
return render_list($path, $files);