diff --git a/common.php b/common.php index eb9428f..e5ac8f2 100644 --- a/common.php +++ b/common.php @@ -5,6 +5,8 @@ $Base64Env = [ //'Region', // used in SCF. //'SecretId', // used in SCF. //'SecretKey', // used in SCF. + //'AccessKeyID', // used in FC. + //'AccessKeySecret', // used in FC. //'admin', //'adminloginpage', 'background', @@ -33,6 +35,7 @@ $Base64Env = [ //'sharecookie', 'shareapiurl', //'siteid', + 'domainforproxy', 'public_path', //'refresh_token', //'token_expires', @@ -43,6 +46,8 @@ $CommonEnv = [ 'Region', // used in SCF. 'SecretId', // used in SCF. 'SecretKey', // used in SCF. + 'AccessKeyID', // used in FC. + 'AccessKeySecret', // used in FC. 'admin', 'adminloginpage', 'background', @@ -64,6 +69,8 @@ $ShowedCommonEnv = [ //'Region', // used in SCF. //'SecretId', // used in SCF. //'SecretKey', // used in SCF. + //'AccessKeyID', // used in FC. + //'AccessKeySecret', // used in FC. //'admin', 'adminloginpage', 'background', @@ -95,6 +102,7 @@ $InnerEnv = [ 'shareurl', //'sharecookie', 'shareapiurl', + 'domainforproxy', 'public_path', 'refresh_token', 'token_expires', @@ -115,6 +123,7 @@ $ShowedInnerEnv = [ //'shareurl', //'sharecookie', //'shareapiurl', + 'domainforproxy', 'public_path', //'refresh_token', //'token_expires', @@ -332,7 +341,17 @@ function main($path) } if (isset($files['file']) && !isset($_GET['preview'])) { // is file && not preview mode - if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files[$_SERVER['DownurlStrName']] ]); + if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) { + $url = $files[$_SERVER['DownurlStrName']]; + $domainforproxy = ''; + $domainforproxy = getConfig('domainforproxy'); + if ($domainforproxy!='') { + $tmp = splitfirst($url, '//')[1]; + $tmp = splitfirst($tmp, '/')[0]; + $url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp; + } + return output('', 302, [ 'Location' => $url ]); + } } if ( isset($files['folder']) || isset($files['file']) ) { return render_list($path, $files); @@ -802,8 +821,17 @@ function get_thumbnails_url($path = '/', $location = 0) } } if ($thumb_url!='') { - if ($location) return output('', 302, [ 'Location' => $thumb_url ]); - else return output($thumb_url); + if ($location) { + $url = $thumb_url; + $domainforproxy = ''; + $domainforproxy = getConfig('domainforproxy'); + if ($domainforproxy!='') { + $tmp = splitfirst($url, '//')[1]; + $tmp = splitfirst($tmp, '/')[0]; + $url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp; + } + return output('', 302, [ 'Location' => $url ]); + } else return output($thumb_url); } return output('', 404); } @@ -1675,10 +1703,9 @@ function EnvOpt($needUpdate = 0) } else { $html .= '