Update common.php

pull/73/head
qkqpttgf 2020-06-04 13:37:12 +08:00 committed by GitHub
parent 7e422a250e
commit d57733743b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 9 deletions

View File

@ -5,6 +5,8 @@ $Base64Env = [
//'Region', // used in SCF. //'Region', // used in SCF.
//'SecretId', // used in SCF. //'SecretId', // used in SCF.
//'SecretKey', // used in SCF. //'SecretKey', // used in SCF.
//'AccessKeyID', // used in FC.
//'AccessKeySecret', // used in FC.
//'admin', //'admin',
//'adminloginpage', //'adminloginpage',
'background', 'background',
@ -33,6 +35,7 @@ $Base64Env = [
//'sharecookie', //'sharecookie',
'shareapiurl', 'shareapiurl',
//'siteid', //'siteid',
'domainforproxy',
'public_path', 'public_path',
//'refresh_token', //'refresh_token',
//'token_expires', //'token_expires',
@ -43,6 +46,8 @@ $CommonEnv = [
'Region', // used in SCF. 'Region', // used in SCF.
'SecretId', // used in SCF. 'SecretId', // used in SCF.
'SecretKey', // used in SCF. 'SecretKey', // used in SCF.
'AccessKeyID', // used in FC.
'AccessKeySecret', // used in FC.
'admin', 'admin',
'adminloginpage', 'adminloginpage',
'background', 'background',
@ -64,6 +69,8 @@ $ShowedCommonEnv = [
//'Region', // used in SCF. //'Region', // used in SCF.
//'SecretId', // used in SCF. //'SecretId', // used in SCF.
//'SecretKey', // used in SCF. //'SecretKey', // used in SCF.
//'AccessKeyID', // used in FC.
//'AccessKeySecret', // used in FC.
//'admin', //'admin',
'adminloginpage', 'adminloginpage',
'background', 'background',
@ -95,6 +102,7 @@ $InnerEnv = [
'shareurl', 'shareurl',
//'sharecookie', //'sharecookie',
'shareapiurl', 'shareapiurl',
'domainforproxy',
'public_path', 'public_path',
'refresh_token', 'refresh_token',
'token_expires', 'token_expires',
@ -115,6 +123,7 @@ $ShowedInnerEnv = [
//'shareurl', //'shareurl',
//'sharecookie', //'sharecookie',
//'shareapiurl', //'shareapiurl',
'domainforproxy',
'public_path', 'public_path',
//'refresh_token', //'refresh_token',
//'token_expires', //'token_expires',
@ -332,7 +341,17 @@ function main($path)
} }
if (isset($files['file']) && !isset($_GET['preview'])) { if (isset($files['file']) && !isset($_GET['preview'])) {
// is file && not preview mode // 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']) ) { if ( isset($files['folder']) || isset($files['file']) ) {
return render_list($path, $files); return render_list($path, $files);
@ -802,8 +821,17 @@ function get_thumbnails_url($path = '/', $location = 0)
} }
} }
if ($thumb_url!='') { if ($thumb_url!='') {
if ($location) return output('', 302, [ 'Location' => $thumb_url ]); if ($location) {
else return output($thumb_url); $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); return output('', 404);
} }
@ -1675,10 +1703,9 @@ function EnvOpt($needUpdate = 0)
} else { } else {
$html .= ' $html .= '
<form name="updateform" action="" method="post"> <form name="updateform" action="" method="post">
<input type="text" name="auth" placeholder="auth" value="qkqpttgf"> <input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" placeholder="project" value="OneManager-php"> <input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
<button onclick="querybranchs();return false">'.getconstStr('QueryBranchs').'</button> <button name="QueryBranchs" onclick="querybranchs();return false">'.getconstStr('QueryBranchs').'</button>
<!--<input type="text" name="branch" placeholder="branch" value="master">-->
<select name="branch"> <select name="branch">
<option value="master">master</option> <option value="master">master</option>
</select> </select>
@ -1687,7 +1714,6 @@ function EnvOpt($needUpdate = 0)
<script> <script>
function querybranchs() function querybranchs()
{ {
//alert(document.updateform.auth.value);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.github.com/repos/"+document.updateform.auth.value+"/"+document.updateform.project.value+"/branches"); xhr.open("GET", "https://api.github.com/repos/"+document.updateform.auth.value+"/"+document.updateform.project.value+"/branches");
//xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager"); //xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager");
@ -1697,10 +1723,10 @@ function EnvOpt($needUpdate = 0)
if (xhr.status==200) { if (xhr.status==200) {
document.updateform.branch.options.length=0; document.updateform.branch.options.length=0;
JSON.parse(xhr.responseText).forEach( function (e) { JSON.parse(xhr.responseText).forEach( function (e) {
//alert(e.name);
document.updateform.branch.options.add(new Option(e.name,e.name)); document.updateform.branch.options.add(new Option(e.name,e.name));
if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true; if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true;
}); });
document.updateform.QueryBranchs.style.display="none";
} else { } else {
alert(xhr.responseText+"\n"+xhr.status); alert(xhr.responseText+"\n"+xhr.status);
} }