Merge branch 'qkqpttgf:master' into master

This commit is contained in:
gd1214b
2021-10-12 08:56:40 +08:00
committed by GitHub
11 changed files with 388 additions and 152 deletions
+100 -36
View File
@@ -182,11 +182,15 @@ function main($path)
if (isset($_POST['password1'])) { if (isset($_POST['password1'])) {
$compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin')); $compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin'));
if ($compareresult=='') { if ($compareresult=='') {
return adminform('admin', adminpass2cookie('admin', getConfig('admin')), $url); $timestamp = time()+7*24*60*60;
$randnum = rand(10, 99999);
$admincookie = adminpass2cookie('admin', getConfig('admin'), $timestamp, $randnum);
$adminlocalstorage = adminpass2storage('admin', getConfig('admin'), $timestamp, $randnum);
return adminform('admin', $admincookie, $adminlocalstorage, $url);
} else return adminform($compareresult); } else return adminform($compareresult);
} else return adminform(); } else return adminform();
} }
if ( isset($_COOKIE['admin'])&&compareadminmd5($_COOKIE['admin'], 'admin', getConfig('admin')) ) { if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) {
$_SERVER['admin']=1; $_SERVER['admin']=1;
$_SERVER['needUpdate'] = needUpdate(); $_SERVER['needUpdate'] = needUpdate();
} else { } else {
@@ -385,7 +389,7 @@ function main($path)
$url = proxy_replace_domain($url, $domainforproxy, $header); $url = proxy_replace_domain($url, $domainforproxy, $header);
} }
return output('', 302, $header); return output('', 302, $header);
} else return output('No ' . $_GET['random'] . 'file', 404); } else return output('No ' . htmlspecialchars($_GET['random']) . 'file', 404);
} else return output('Hidden', 401); } else return output('Hidden', 401);
} }
// is file && not preview mode, download file // is file && not preview mode, download file
@@ -394,6 +398,7 @@ function main($path)
$url = $files['url']; $url = $files['url'];
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']); if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
else { else {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($files['time'])==strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) return output('', 304);
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']); $fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']); $fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
if (!!$fileConduitSize || !!$fileConduitCacheTime) { if (!!$fileConduitSize || !!$fileConduitCacheTime) {
@@ -401,10 +406,27 @@ function main($path)
else $fileConduitSize = 1024*1024; else $fileConduitSize = 1024*1024;
if ($fileConduitCacheTime>1) $fileConduitCacheTime *= 3600; if ($fileConduitCacheTime>1) $fileConduitCacheTime *= 3600;
else $fileConduitCacheTime = 3600; else $fileConduitCacheTime = 3600;
/*if ($_SERVER['HTTP_RANGE']!='') {
$header['Range'] = $_SERVER['HTTP_RANGE'];
$response = curl('GET', $files['url'], '', $header, 1);
//return output($header['Range'] . json_encode($response['returnhead']));
return output(
$response['body'],
$response['stat'],
//$response['returnhead'],
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
false
);
}*/
if ($files['size']<$fileConduitSize) return output( if ($files['size']<$fileConduitSize) return output(
base64_encode(file_get_contents($files['url'])), base64_encode(file_get_contents($files['url'])),
200, 200,
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime], [
'Content-Type' => $files['mime'],
'Cache-Control' => 'max-age=' . $fileConduitCacheTime,
//'Cache-Control' => 'max-age=0',
'Last-Modified' => gmdate('D, d M Y H:i:s T', strtotime($files['time']))
],
true true
); );
} }
@@ -482,20 +504,31 @@ function isreferhost() {
return false; return false;
} }
function adminpass2cookie($name, $pass) function adminpass2cookie($name, $pass, $timestamp)
{ {
$timestamp = time()+7*24*60*60;
return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")"; return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")";
} }
function compareadminmd5($admincookie, $name, $pass) function adminpass2storage($name, $pass, $timestamp, $rand) {
return md5($timestamp . '/' . $pass . '^' . $name . '*' . $rand) . "(" . $rand . ")";
}
function compareadminmd5($name, $pass, $cookie, $storage = 'default')
{ {
$c = splitfirst($admincookie, '('); $c = splitfirst($cookie, '(');
$c_md5 = $c[0]; $c_md5 = $c[0];
$c_time = substr($c[1], 0, -1); $c_time = substr($c[1], 0, -1);
if (!is_numeric($c_time)) return false; if (!is_numeric($c_time)) return false;
if (time() > $c_time) return false; if (time() > $c_time) return false;
if ($storage == 'default') {
if (md5($name . ':' . md5($pass) . '@' . $c_time) == $c_md5) return true; if (md5($name . ':' . md5($pass) . '@' . $c_time) == $c_md5) return true;
else return false; else return false;
} else {
$s = splitfirst($storage, '(');
$s_md5 = $s[0];
$s_rand = substr($s[1], 0, -1);
if (md5($c_time . '/' . $pass . '^' . $name . '*' . $s_rand) == $s_md5) return true;
else return false;
}
return false;
} }
function compareadminsha1($adminsha1, $timestamp, $pass) function compareadminsha1($adminsha1, $timestamp, $pass)
@@ -720,6 +753,7 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
//$response['body'] = curl_exec($ch); //$response['body'] = curl_exec($ch);
if ($returnheader) { if ($returnheader) {
list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch)); list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch));
//echo "HEAD:" . $returnhead;
foreach (explode("\r\n", $returnhead) as $head) { foreach (explode("\r\n", $returnhead) as $head) {
$tmp = explode(': ', $head); $tmp = explode(': ', $head);
$heads[$tmp[0]] = $tmp[1]; $heads[$tmp[0]] = $tmp[1];
@@ -971,15 +1005,19 @@ function time_format($ISO)
return date('Y-m-d H:i:s',strtotime($ISO . " UTC")); return date('Y-m-d H:i:s',strtotime($ISO . " UTC"));
} }
function adminform($name = '', $pass = '', $path = '') function adminform($name = '', $pass = '', $storage = '', $path = '')
{ {
$html = '<html><head><title>' . getconstStr('AdminLogin') . '</title><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"></head>'; $html = '<html><head><title>' . getconstStr('AdminLogin') . '</title><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"></head>';
if ($name=='admin'&&$pass!='') { if ($name=='admin'&&$pass!='') {
$html .= '<meta http-equiv="refresh" content="3;URL=' . $path . '"> $html .= '<meta http-equiv="refresh" content="3;URL=' . $path . '">
<body>' . getconstStr('LoginSuccess') . '</body></html>'; <body>' . getconstStr('LoginSuccess') . '
<script>
localStorage.setItem("admin", "' . $storage . '");
</script>
</body></html>';
$statusCode = 201; $statusCode = 201;
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$_SERVER['Set-Cookie'] = $name . '=' . $pass . '; path=/; expires=' . date(DATE_COOKIE, strtotime('+7day')); $_SERVER['Set-Cookie'] = $name . '=' . $pass . '; path=' . $_SERVER['base_path'] . '; expires=' . date(DATE_COOKIE, strtotime('+7day'));
return output($html, $statusCode); return output($html, $statusCode);
} }
$statusCode = 401; $statusCode = 401;
@@ -1028,7 +1066,18 @@ function adminoperate($path)
$tmpget = $_GET; $tmpget = $_GET;
$tmppost = $_POST; $tmppost = $_POST;
$tmparr['statusCode'] = 0; $tmparr['statusCode'] = 0;
if (isset($tmpget['RefreshCache'])) {
//$path1 = path_format($_SERVER['list_path'] . path_format($path));
//if ($path1!='/'&&substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
savecache('path_' . $path1 . '/?password', '', $_SERVER['disktag'], 1);
savecache('customTheme', '', '', 1);
return message('<meta http-equiv="refresh" content="2;URL=./">
<meta name=viewport content="width=device-width,initial-scale=1">', getconstStr('RefreshCache'), 202);
}
if ( (isset($tmpget['rename_newname'])&&$tmpget['rename_newname']!=$tmpget['rename_oldname'] && $tmpget['rename_newname']!='') || (isset($tmppost['rename_newname'])&&$tmppost['rename_newname']!=$tmppost['rename_oldname'] && $tmppost['rename_newname']!='') ) { if ( (isset($tmpget['rename_newname'])&&$tmpget['rename_newname']!=$tmpget['rename_oldname'] && $tmpget['rename_newname']!='') || (isset($tmppost['rename_newname'])&&$tmppost['rename_newname']!=$tmppost['rename_oldname'] && $tmppost['rename_newname']!='') ) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['rename_newname'])) $VAR = 'tmppost'; if (isset($tmppost['rename_newname'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// rename 重命名 // rename 重命名
@@ -1038,6 +1087,7 @@ function adminoperate($path)
return $drive->Rename($file, ${$VAR}['rename_newname']); return $drive->Rename($file, ${$VAR}['rename_newname']);
} }
if (isset($tmpget['delete_name']) || isset($tmppost['delete_name'])) { if (isset($tmpget['delete_name']) || isset($tmppost['delete_name'])) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['delete_name'])) $VAR = 'tmppost'; if (isset($tmppost['delete_name'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// delete 删除 // delete 删除
@@ -1047,6 +1097,7 @@ function adminoperate($path)
return $drive->Delete($file); return $drive->Delete($file);
} }
if ( (isset($tmpget['operate_action'])&&$tmpget['operate_action']==getconstStr('Encrypt')) || (isset($tmppost['operate_action'])&&$tmppost['operate_action']==getconstStr('Encrypt')) ) { if ( (isset($tmpget['operate_action'])&&$tmpget['operate_action']==getconstStr('Encrypt')) || (isset($tmppost['operate_action'])&&$tmppost['operate_action']==getconstStr('Encrypt')) ) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['operate_action'])) $VAR = 'tmppost'; if (isset($tmppost['operate_action'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// encrypt 加密 // encrypt 加密
@@ -1058,6 +1109,7 @@ function adminoperate($path)
return $drive->Encrypt($folder, getConfig('passfile'), ${$VAR}['encrypt_newpass']); return $drive->Encrypt($folder, getConfig('passfile'), ${$VAR}['encrypt_newpass']);
} }
if (isset($tmpget['move_folder']) || isset($tmppost['move_folder'])) { if (isset($tmpget['move_folder']) || isset($tmppost['move_folder'])) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['move_folder'])) $VAR = 'tmppost'; if (isset($tmppost['move_folder'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// move 移动 // move 移动
@@ -1082,6 +1134,7 @@ function adminoperate($path)
} }
} }
if (isset($tmpget['copy_name']) || isset($tmppost['copy_name'])) { if (isset($tmpget['copy_name']) || isset($tmppost['copy_name'])) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['copy_name'])) $VAR = 'tmppost'; if (isset($tmppost['copy_name'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// copy 复制 // copy 复制
@@ -1091,6 +1144,7 @@ function adminoperate($path)
return $drive->Copy($file); return $drive->Copy($file);
} }
if (isset($tmppost['editfile'])) { if (isset($tmppost['editfile'])) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
// edit 编辑 // edit 编辑
$file['path'] = $path1; $file['path'] = $path1;
$file['name'] = ''; $file['name'] = '';
@@ -1098,6 +1152,7 @@ function adminoperate($path)
return $drive->Edit($file, $tmppost['editfile']); return $drive->Edit($file, $tmppost['editfile']);
} }
if (isset($tmpget['create_name']) || isset($tmppost['create_name'])) { if (isset($tmpget['create_name']) || isset($tmppost['create_name'])) {
if (!compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) return ['statusCode'=>403];
if (isset($tmppost['create_name'])) $VAR = 'tmppost'; if (isset($tmppost['create_name'])) $VAR = 'tmppost';
else $VAR = 'tmpget'; else $VAR = 'tmpget';
// create 新建 // create 新建
@@ -1106,14 +1161,6 @@ function adminoperate($path)
$parent['id'] = ${$VAR}['create_fileid']; $parent['id'] = ${$VAR}['create_fileid'];
return $drive->Create($parent, ${$VAR}['create_type'], ${$VAR}['create_name'], ${$VAR}['create_text']); return $drive->Create($parent, ${$VAR}['create_type'], ${$VAR}['create_name'], ${$VAR}['create_text']);
} }
if (isset($tmpget['RefreshCache'])) {
//$path1 = path_format($_SERVER['list_path'] . path_format($path));
//if ($path1!='/'&&substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
savecache('path_' . $path1 . '/?password', '', $_SERVER['disktag'], 1);
savecache('customTheme', '', '', 1);
return message('<meta http-equiv="refresh" content="2;URL=./">
<meta name=viewport content="width=device-width,initial-scale=1">', getconstStr('RefreshCache'), 202);
}
return $tmparr; return $tmparr;
} }
@@ -1174,7 +1221,7 @@ function EnvOpt($needUpdate = 0)
$envs = substr(json_encode(array_keys ($EnvConfigs)), 1, -1); $envs = substr(json_encode(array_keys ($EnvConfigs)), 1, -1);
$html = '<title>OneManager '.getconstStr('Setup').'</title>'; $html = '<title>OneManager '.getconstStr('Setup').'</title>';
if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) { if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
$response = setConfigResponse(OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch'])); $response = setConfigResponse(OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch']));
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
@@ -1186,8 +1233,8 @@ function EnvOpt($needUpdate = 0)
$title = getconstStr('Setup'); $title = getconstStr('Setup');
return message($html, $title, 202, 1); return message($html, $title, 202, 1);
} }
} } else return message('please login again', 'Need login', 403);
if (isset($_POST['submit1'])) { if (isset($_POST['submit1'])) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
$_SERVER['disk_oprating'] = ''; $_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy') { if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy') {
@@ -1237,8 +1284,8 @@ function EnvOpt($needUpdate = 0)
$title = getconstStr('Setup'); $title = getconstStr('Setup');
return message($html, $title, 200, 1); return message($html, $title, 200, 1);
} }
} } else return message('please login again', 'Need login', 403);
if (isset($_POST['config_b'])) { if (isset($_POST['config_b'])) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
if (!$_POST['pass']) return output("{\"Error\": \"No admin pass\"}", 403); if (!$_POST['pass']) return output("{\"Error\": \"No admin pass\"}", 403);
if (!is_numeric($_POST['timestamp'])) return output("{\"Error\": \"Error time\"}", 403); if (!is_numeric($_POST['timestamp'])) return output("{\"Error\": \"Error time\"}", 403);
if (abs(time() - $_POST['timestamp']/1000) > 5*60) return output("{\"Error\": \"Timeout\"}", 403); if (abs(time() - $_POST['timestamp']/1000) > 5*60) return output("{\"Error\": \"Timeout\"}", 403);
@@ -1295,8 +1342,8 @@ function EnvOpt($needUpdate = 0)
} else { } else {
return output("{\"Error\": \"Admin pass error\"}", 403); return output("{\"Error\": \"Admin pass error\"}", 403);
} }
} } else return message('please login again', 'Need login', 403);
if (isset($_POST['changePass'])) { if (isset($_POST['changePass'])) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
if (!is_numeric($_POST['timestamp'])) return message("Error time<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); if (!is_numeric($_POST['timestamp'])) return message("Error time<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
if (abs(time() - $_POST['timestamp']/1000) > 5*60) return message("Timeout<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); if (abs(time() - $_POST['timestamp']/1000) > 5*60) return message("Timeout<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
if ($_POST['newPass1']==''||$_POST['newPass2']=='') return message("Empty new pass<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); if ($_POST['newPass1']==''||$_POST['newPass2']=='') return message("Empty new pass<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
@@ -1313,7 +1360,7 @@ function EnvOpt($needUpdate = 0)
} else { } else {
return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
} }
} } else return message('please login again', 'Need login', 403);
if (isset($_GET['preview'])) { if (isset($_GET['preview'])) {
$preurl = $_SERVER['PHP_SELF'] . '?preview'; $preurl = $_SERVER['PHP_SELF'] . '?preview';
@@ -1360,7 +1407,8 @@ output:
if ($_GET['setup']==='platform') { if ($_GET['setup']==='platform') {
$frame .= ' $frame .= '
<table border=1 width=100%> <table border=1 width=100%>
<form name="common" action="" method="post">'; <form name="common" action="" method="post">
<input name="_admin" type="hidden" value="">';
foreach ($EnvConfigs as $key => $val) if (isCommonEnv($key) && isShowedEnv($key)) { foreach ($EnvConfigs as $key => $val) if (isCommonEnv($key) && isShowedEnv($key)) {
$frame .= ' $frame .= '
<tr> <tr>
@@ -1420,6 +1468,7 @@ output:
<td> <td>
<form action="" method="post" style="margin: 0" onsubmit="return renametag(this);"> <form action="" method="post" style="margin: 0" onsubmit="return renametag(this);">
<input type="hidden" name="disktag_rename" value="' . $disktag . '"> <input type="hidden" name="disktag_rename" value="' . $disktag . '">
<input name="_admin" type="hidden" value="">
<input type="text" name="disktag_newname" value="' . $disktag . '" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '"> <input type="text" name="disktag_newname" value="' . $disktag . '" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '">
<input type="submit" name="submit1" value="' . getconstStr('RenameDisk') . '"> <input type="submit" name="submit1" value="' . getconstStr('RenameDisk') . '">
</form> </form>
@@ -1431,12 +1480,14 @@ output:
<td> <td>
<form action="" method="post" style="margin: 0" onsubmit="return deldiskconfirm(this);"> <form action="" method="post" style="margin: 0" onsubmit="return deldiskconfirm(this);">
<input type="hidden" name="disktag_del" value="' . $disktag . '"> <input type="hidden" name="disktag_del" value="' . $disktag . '">
<input name="_admin" type="hidden" value="">
<input type="submit" name="submit1" value="' . getconstStr('DelDisk') . '"> <input type="submit" name="submit1" value="' . getconstStr('DelDisk') . '">
</form> </form>
</td> </td>
<td> <td>
<form action="" method="post" style="margin: 0" onsubmit="return cpdiskconfirm(this);"> <form action="" method="post" style="margin: 0" onsubmit="return cpdiskconfirm(this);">
<input type="hidden" name="disktag_copy" value="' . $disktag . '"> <input type="hidden" name="disktag_copy" value="' . $disktag . '">
<input name="_admin" type="hidden" value="">
<input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '"> <input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '">
</form> </form>
</td> </td>
@@ -1464,6 +1515,7 @@ output:
$frame .= ' $frame .= '
<form name="' . $disktag . '" action="" method="post"> <form name="' . $disktag . '" action="" method="post">
<input name="_admin" type="hidden" value="">
<input type="hidden" name="disk" value="' . $disktag . '">'; <input type="hidden" name="disk" value="' . $disktag . '">';
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) { foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
$frame .= ' $frame .= '
@@ -1536,6 +1588,7 @@ output:
<table border=1> <table border=1>
<form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);"> <form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);">
<tr id="sortdisks"> <tr id="sortdisks">
<input name="_admin" type="hidden" value="">
<input type="hidden" name="disktag_sort" value="">'; <input type="hidden" name="disktag_sort" value="">';
$num = 0; $num = 0;
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
@@ -1641,6 +1694,7 @@ output:
} else { } else {
$frame .= ' $frame .= '
<form name="updateform" action="" method="post"> <form name="updateform" action="" method="post">
<input name="_admin" type="hidden" value="">
<input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf"> <input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" size="12" placeholder="project" value="OneManager-php"> <input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
<button name="QueryBranchs" onclick="querybranchs();return false;">' . getconstStr('QueryBranchs') . '</button> <button name="QueryBranchs" onclick="querybranchs();return false;">' . getconstStr('QueryBranchs') . '</button>
@@ -1691,6 +1745,7 @@ output:
<script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script> <script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script>
<table> <table>
<form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);"> <form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
<input name="_admin" type="hidden" value="">
<tr> <tr>
<td>' . getconstStr('OldPassword') . ':</td><td><input type="password" name="oldPass"> <td>' . getconstStr('OldPassword') . ':</td><td><input type="password" name="oldPass">
<input type="hidden" name="timestamp"></td> <input type="hidden" name="timestamp"></td>
@@ -1708,6 +1763,7 @@ output:
</table><br> </table><br>
<table> <table>
<form id="config_f" name="config" action="" method="POST" onsubmit="return false;"> <form id="config_f" name="config" action="" method="POST" onsubmit="return false;">
<input name="_admin" type="hidden" value="">
<tr> <tr>
<td>' . getconstStr('AdminPassword') . ':<input type="password" name="pass"> <td>' . getconstStr('AdminPassword') . ':<input type="password" name="pass">
<button name="config_b" value="export" onclick="exportConfig(this);">' . getconstStr('export') . '</button></td> <button name="config_b" value="export" onclick="exportConfig(this);">' . getconstStr('export') . '</button></td>
@@ -1846,6 +1902,12 @@ output:
</tr> </tr>
</table><br>'; </table><br>';
$html .= $frame; $html .= $frame;
$html .= '<script>
var inputAdminStorage = document.getElementsByName("_admin");
for (i=0;i<inputAdminStorage.length;i++) {
inputAdminStorage[i].value = localStorage.getItem("admin");
}
</script>';
return message($html, getconstStr('Setup')); return message($html, getconstStr('Setup'));
} }
@@ -1860,10 +1922,11 @@ function render_list($path = '', $files = [])
$htmlcontent = get_content(spurlencode(path_format(urldecode($path) . '/index.html'), '/'))['content']; $htmlcontent = get_content(spurlencode(path_format(urldecode($path) . '/index.html'), '/'))['content'];
return output($htmlcontent['body'], $htmlcontent['stat']); return output($htmlcontent['body'], $htmlcontent['stat']);
} }
$path = str_replace('%20','%2520',$path); //$path = str_replace('%20','%2520',$path);
$path = str_replace('+','%2B',$path); $path = str_replace('+','%2B',$path);
$path = str_replace('&','&amp;',path_format(urldecode($path))) ; $path = path_format(urldecode($path));
$path = str_replace('%20',' ',$path); //$path = str_replace('&','&amp;', $path) ;
//$path = str_replace('%20',' ',$path);
$path = str_replace('#','%23',$path); $path = str_replace('#','%23',$path);
$p_path=''; $p_path='';
if ($path !== '/') { if ($path !== '/') {
@@ -2233,8 +2296,8 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--IsFileStart-->', '', $html); $html = str_replace('<!--IsFileStart-->', '', $html);
$html = str_replace('<!--IsFileEnd-->', '', $html); $html = str_replace('<!--IsFileEnd-->', '', $html);
} }
$html = str_replace('<!--FileEncodeUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path))), $html); $html = str_replace('<!--FileEncodeUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
$html = str_replace('<!--FileUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path))), $html); $html = str_replace('<!--FileUrl-->', (path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
$ext = strtolower(substr($path, strrpos($path, '.') + 1)); $ext = strtolower(substr($path, strrpos($path, '.') + 1));
if (in_array($ext, $exts['img'])) $ext = 'img'; if (in_array($ext, $exts['img'])) $ext = 'img';
@@ -2261,11 +2324,12 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html); $html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html);
} }
//while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files['url'], $html); //while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files['url'], $html);
while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', (path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); //echo $path . "<br>\n";
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', (path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path))), $html);
while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html); while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html);
while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files['url']), $html); while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files['url']), $html);
//while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); //while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode($_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
$html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html); $html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html);
$html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html); $html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html);
$html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html); $html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html);
+12 -7
View File
@@ -1,4 +1,7 @@
<?php <?php
// https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
// https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
// https://developer.microsoft.com/zh-cn/graph/graph-explorer
class Onedrive { class Onedrive {
protected $access_token; protected $access_token;
@@ -46,9 +49,6 @@ class Onedrive {
{ {
global $exts; global $exts;
if (!($files = getcache('path_' . $path, $this->disktag))) { if (!($files = getcache('path_' . $path, $this->disktag))) {
// https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
// https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
// https://developer.microsoft.com/zh-cn/graph/graph-explorer
$pos = splitlast($path, '/'); $pos = splitlast($path, '/');
$parentpath = $pos[0]; $parentpath = $pos[0];
if ($parentpath=='') $parentpath = '/'; if ($parentpath=='') $parentpath = '/';
@@ -350,7 +350,8 @@ class Onedrive {
$filename = spurlencode($file['name']); $filename = spurlencode($file['name']);
$filename = path_format($file['path'] . '/' . $filename); $filename = path_format($file['path'] . '/' . $filename);
//echo $filename; //echo $filename;
$result = $this->MSAPI('DELETE', $filename); if ($file['id']) $result = $this->MSAPI('DELETE', "/items/" . $file['id']);
else $result = $this->MSAPI('DELETE', $filename);
if ($result['stat']!=204) $r_body = json_encode($this->files_format(json_decode($result['body'], true))); if ($result['stat']!=204) $r_body = json_encode($this->files_format(json_decode($result['body'], true)));
return output($r_body, $result['stat']); return output($r_body, $result['stat']);
//return output($result['body'], $result['stat']); //return output($result['body'], $result['stat']);
@@ -358,7 +359,7 @@ class Onedrive {
public function Encrypt($folder, $passfilename, $pass) { public function Encrypt($folder, $passfilename, $pass) {
$filename = path_format($folder['path'] . '/' . urlencode($passfilename)); $filename = path_format($folder['path'] . '/' . urlencode($passfilename));
if ($pass==='') { if ($pass==='') {
$result = $this->MSAPI('DELETE', $filename, ''); $result = $this->MSAPI('DELETE', $filename);
} else { } else {
$result = $this->MSAPI('PUT', $filename, $pass); $result = $this->MSAPI('PUT', $filename, $pass);
} }
@@ -372,7 +373,8 @@ class Onedrive {
$filename = spurlencode($file['name']); $filename = spurlencode($file['name']);
$filename = path_format($file['path'] . '/' . $filename); $filename = path_format($file['path'] . '/' . $filename);
$data = '{"parentReference":{"path": "/drive/root:' . $folder['path'] . '"}}'; $data = '{"parentReference":{"path": "/drive/root:' . $folder['path'] . '"}}';
$result = $this->MSAPI('PATCH', $filename, $data); if ($file['id']) $result = $this->MSAPI('PATCH', "/items/" . $file['id'], $data);
else $result = $this->MSAPI('PATCH', $filename, $data);
$path2 = spurlencode($folder['path'], '/'); $path2 = spurlencode($folder['path'], '/');
if ($path2!='/'&&substr($path2, -1)=='/') $path2 = substr($path2, 0, -1); if ($path2!='/'&&substr($path2, -1)=='/') $path2 = substr($path2, 0, -1);
savecache('path_' . $path2, json_decode('{}', true), $this->disktag, 1); savecache('path_' . $path2, json_decode('{}', true), $this->disktag, 1);
@@ -391,7 +393,8 @@ class Onedrive {
$newname = '.' . $namearr[1] . ' (' . date("Ymd\THis\Z") . ')'; $newname = '.' . $namearr[1] . ' (' . date("Ymd\THis\Z") . ')';
} }
$data = '{ "name": "' . $newname . '" }'; $data = '{ "name": "' . $newname . '" }';
$result = $this->MSAPI('copy', $filename, $data); if ($file['id']) $result = $this->MSAPI('copy', "/items/" . $file['id'], $data);
else $result = $this->MSAPI('copy', $filename, $data);
/*$num = 0; /*$num = 0;
while ($result['stat']==409 && json_decode($result['body'], true)['error']['code']=='nameAlreadyExists') { while ($result['stat']==409 && json_decode($result['body'], true)['error']['code']=='nameAlreadyExists') {
$num++; $num++;
@@ -1007,6 +1010,8 @@ class Onedrive {
} else { } else {
if ($path=='' or $path=='/') { if ($path=='' or $path=='/') {
$url .= $method; $url .= $method;
} elseif (substr($path, 0, 6)=="/items") {
$url .= '/' . $method;
} else { } else {
$url .= ':/' . $method; $url .= ':/' . $method;
} }
+1 -1
View File
@@ -108,7 +108,7 @@ function handler($event, $context)
$re = main($path); $re = main($path);
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['body']); return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['isBase64Encoded']?base64_decode($re['body']):$re['body']);
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
// Huawei FG // Huawei FG
+11 -3
View File
@@ -37,13 +37,20 @@ function GetPathSetting($event, $context)
$_SERVER['region'] = $context['region']; $_SERVER['region'] = $context['region'];
$_SERVER['service_name'] = $context['service']['name']; $_SERVER['service_name'] = $context['service']['name'];
$_SERVER['function_name'] = $context['function']['name']; $_SERVER['function_name'] = $context['function']['name'];
$path = urldecode($event['path']); //$path = str_replace('%5D', ']', str_replace('%5B', '[', $event['path']));//%5B
//$path = $event['path'];
$path = $event['requestURI'];
if (strpos($path, '?')) $path = substr($path, 0, strpos($path, '?'));
$tmp = urldecode($event['requestURI']); $tmp = urldecode($event['requestURI']);
if (strpos($tmp, '?')) $tmp = substr($tmp, 0, strpos($tmp, '?')); if (strpos($tmp, '?')) $tmp = substr($tmp, 0, strpos($tmp, '?'));
if ($path=='/'||$path=='') { if ($path=='/'||$path=='') {
$_SERVER['base_path'] = $tmp; $_SERVER['base_path'] = $tmp;
} else { } else {
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1); while ($tmp!=urldecode($tmp)) $tmp = urldecode($tmp);
$tmp1 = urldecode($event['path']);
while ($tmp1!=urldecode($tmp1)) $tmp1 = urldecode($tmp1);
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($tmp1)+1);
//$_SERVER['base_path'] = substr($tmp, 0, strlen(urldecode($event['path'])));
} }
$_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/'); $_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/');
@@ -63,7 +70,8 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0]; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0];
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2'; $_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
return spurlencode($path, '/'); return $path;
//return spurlencode($path, '/');
} }
function getConfig($str, $disktag = '') function getConfig($str, $disktag = '')
+1
View File
@@ -50,6 +50,7 @@ function GetPathSetting($event, $context)
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'];
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7'; $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
return $path; return $path;
} }
+1
View File
@@ -71,6 +71,7 @@ function GetPathSetting($event, $context)
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }
+1
View File
@@ -71,6 +71,7 @@ function GetPathSetting($event, $context)
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }
+2 -1
View File
@@ -56,7 +56,8 @@ function GetPathSetting($event, $context)
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; //$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }
+2 -1
View File
@@ -56,7 +56,8 @@ function GetPathSetting($event, $context)
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; //$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }
+234 -87
View File
@@ -1,136 +1,283 @@
# NOTICE: the release is used as archive. # NOTICE: the release is used as archive.
# 注意:release只是用来存档的。 # 注意:release只是用来存档的。
Please read the descriptions of settings before raising an issue. Please read the descriptions of settings before raising an issue.
请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
> 请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
---
# Deploy to Heroku # Deploy to Heroku
Official: https://heroku.com
Demo: https://herooneindex.herokuapp.com/
How to Install: ### Official
https://heroku.com
### Demo
https://herooneindex.herokuapp.com/
### How to Install
> ~~Click the button [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`) > ~~Click the button [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
>
> Fork this project, create a heroku app, then turn to Deploy tab, deploy via connect to your github fork. > Fork this project, create a heroku app, then turn to Deploy tab, deploy via connect to your github fork.
---
# Deploy to Glitch # Deploy to Glitch
Official: https://glitch.com/
Demo: https://onemanager.glitch.me/
How to Install: New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window. ### Official
https://glitch.com/
### Demo
https://onemanager.glitch.me/
### How to Install
New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window.
---
# Deploy to Vercel # Deploy to Vercel
Official: https://vercel.com/
Demo: null
Notice:
> 1, you must wait 30-50s to make sure deploy READY after change config;
> 2, Vercel limit 100 deploy every day.
How to Install: https://scfonedrive.github.io/Vercel/Deploy.html . ### Official
https://vercel.com/
### Demo
null
### Notice
> 1. you must wait 30-50s to make sure deploy READY after change config;
>
> 2. Vercel limit 100 deploy every day.
### How to Install
https://scfonedrive.github.io/Vercel/Deploy.html .
---
# Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数) # Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数)
Official: https://cloud.tencent.com/product/scf
DEMO: 无
注意:SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘。
How to Install: ### Official
1,进入函数服务,上方选择地区,然后点击新建。
2,输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
3,点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
4,在触发管理中可以看到一个 访问路径,访问它,开始安装。
(重点:勾选集成响应) https://cloud.tencent.com/product/scf
添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。 ### DEMO
暂无
### 注意事项
​ SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘。
### How to Install
1. 进入函数服务,上方选择地区,然后点击新建。
2. 输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
3. 点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
4. 在触发管理中可以看到一个 访问路径,访问它,开始安装。
(重点:**勾选集成响应**)
> **添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。**
----
# Deploy to Huawei cloud Function Graph (FG 华为云函数工作流) # Deploy to Huawei cloud Function Graph (FG 华为云函数工作流)
Official: https://console.huaweicloud.com/functiongraph/
DEMO: 无
注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)。
How to Install: ### Official
1,在函数列表,点右边创建函数
2,输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
3,创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
4,访问触发器给的url,开始安装
5,在触发器界面点触发器名称,跳到API网关管理,右边更多URL,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的编辑,第1页不用改,点下一步,请求Path改成/,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点立即完成,然后去发布生效
https://console.huaweicloud.com/functiongraph/
### DEMO
暂无
### 注意事项
​ FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)。
### How to Install
1. 在函数列表,点右边创建函数
2. 输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
3. 创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
4. 访问触发器给的url,开始安装
5. 在【触发器界面】点【触发器名称】,跳到API网关管理,右边【更多URL】,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的【编辑】,第1页不用改,点【下一步】,**请求Path改成/**,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点【立即完成】,然后去【发布】生效
----
# Deploy to Aliyun Function Compute (FC 阿里云函数计算) # Deploy to Aliyun Function Compute (FC 阿里云函数计算)
Official: https://fc.console.aliyun.com/
DEMO: 无
How to Install: ### Official:
1,新建函数 -- HTTP函数
2,运行环境选择php7.2
3,触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
4,上传代码
5,触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
6,访问你的域名,开始安装
https://fc.console.aliyun.com/
### DEMO
### How to Install
1. 新建函数 -- HTTP函数
2. 运行环境选择php7.2
3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
4. 上传代码
5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
6. 访问你的域名,开始安装
---
# Deploy to Baidu Cloud Function Compute (CFC 百度云函数计算) # Deploy to Baidu Cloud Function Compute (CFC 百度云函数计算)
Official: https://console.bce.baidu.com/cfc/#/cfc/functions
DEMO: 无
自定义域名需要另外使用API网关,并备案。
How to Install: ### Official
1,在函数列表,点创建函数
2,创建方式改为空白函数,点下一步 https://console.bce.baidu.com/cfc/#/cfc/functions
3,输入名称,选择运行时为PHP7.2,点下一步
4,触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交 ### DEMO
5,进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
6,点击右边触发器,复制并访问提供的url,开始安装 暂无
### 注意事项
​ **自定义域名需要另外使用API网关,并备案。**
### How to Install
1. 在函数列表,点创建函数
2. 创建方式改为空白函数,点下一步
3. 输入名称,选择运行时为PHP7.2,点下一步
4. 触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交
5. 进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
6. 点击右边触发器,复制并访问提供的url,开始安装
---
# Deploy to Virtual Private Server (VPS 或空间) # Deploy to Virtual Private Server (VPS 或空间)
DEMO: 无
How to Install:
1.Start web service on your server (httpd or other), make sure you can visit it.
启动web服务器,确保你能访问到。
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
3.Upload code.
上传好代码。
4.Change the file .data/config.php can be read&write (666 is suggested).
使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
5.View the website in chrome or other.
在浏览器中访问。
### DEMO
暂无
### How to Install
1. Start web service on your server (httpd or other), make sure you can visit it.
>启动web服务器,确保你能访问到。
2. Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
>开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
3. Upload code.
>上传好代码。
4. Change the file .data/config.php can be read&write (666 is suggested).
>使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
5. View the website in chrome or other.
>在浏览器中访问。
----
# Features 特性 # Features 特性
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。 When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
When uploading files, the program produce a direct url, visitor upload files to MS OFFICE via the direct url, the server expend a few bandwidth in produce.
上传时,由程序生成上传url,浏览器直接微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。 > 下载时,由程序解析出直链,浏览器直接微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。 When uploading files, the program produce a direct url, visitor upload files to MS OFFICE via the direct url, the server expend a few bandwidth in produce.
LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到 > 上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量
Program will show content of 'readme.md' & 'head.md'.
可以在文件列表显示head.md跟readme.md文件的内容。 The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
guest up path, is a folder that the guest can upload files, but can not be list (exclude admin).
游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录) > 设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径
If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。 LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
点击“时间”、“大小”,可以排序显示,点“文件”恢复原样 > 网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到
Program will show content of 'readme.md' & 'head.md'.
> 可以在文件列表显示head.md跟readme.md文件的内容。
guest up path, is a folder that the guest can upload files, but can not be list (exclude admin).
> 游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
> 如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
> 点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
----
# Functional files 功能性文件 # Functional files 功能性文件
### favicon.ico ### favicon.ico
put it in the showing home folder of FIRST disk (maybe not root of onedrive). 放在第一个盘的显示目录(不一定是onedrive根目录)。
put it in the showing home folder of FIRST disk (maybe not root of onedrive).
> 放在第一个盘的显示目录(不一定是onedrive根目录)。
### index.html ### index.html
show content of index.html as html. 将index.html以静态网页显示出来。
### head.md readme.md show content of index.html as html.
it will showed at top or bottom as markdown. 以MD语法显示在顶部或底部。
### head.omf foot.omf > 将index.html以静态网页显示出来。
it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。
### head.md
### readme.md
it will showed at top or bottom as markdown.
> 以MD语法显示在顶部或底部。
### head.omf
### foot.omf
it will showed at top or bottom as html (javascript works!).
> 以html显示在顶部或底部(可以跑js)。
----
# A cup of coffee # A cup of coffee
https://paypal.me/qkqpttgf https://paypal.me/qkqpttgf
-----
# Chat # Chat
QQ Group: 212088653 (请看完上面的中英双语再加群,谢谢!)
Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw **请看完上面的中英双语再加群,谢谢!**
### QQ Group:
212088653
### Telegram Group
https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
+15 -8
View File
@@ -94,12 +94,12 @@
</ul></li> </ul></li>
<!--AdminEnd--> <!--AdminEnd-->
&nbsp; &nbsp;
<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)"> <!--<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
<option value="">Language</option> <option value="">Language</option>
<!--SelectLanguageStart--> <!--SelectLanguageStart-->
<option value="<!--SelectLanguageKey-->" <!--SelectLanguageSelected-->><!--SelectLanguageValue--></option> <option value="<!--SelectLanguageKey-->" <!--SelectLanguageSelected-->><!--SelectLanguageValue--></option>
<!--SelectLanguageEnd--> <!--SelectLanguageEnd-->
</select> </select>-->
</div> </div>
<!--NeedUpdateStart--> <!--NeedUpdateStart-->
<div style='position:absolute;'><font color='red'><!--constStr@NeedUpdate--></font></div> <div style='position:absolute;'><font color='red'><!--constStr@NeedUpdate--></font></div>
@@ -202,6 +202,7 @@
<div id="txt"> <div id="txt">
<!--AdminStart--> <!--AdminStart-->
<form id="txt-form" action="" method="POST"> <form id="txt-form" action="" method="POST">
<input name="_admin" type="hidden" value="">
<a onclick="document.getElementById('txt-a').readOnly='';document.getElementById('txt-save').style.display='';document.getElementById('txt-editbutton').style.display='none';document.getElementById('txt-cancelbutton').style.display='';" id="txt-editbutton"><ion-icon name="create"></ion-icon><!--constStr@ClicktoEdit--></a> <a onclick="document.getElementById('txt-a').readOnly='';document.getElementById('txt-save').style.display='';document.getElementById('txt-editbutton').style.display='none';document.getElementById('txt-cancelbutton').style.display='';" id="txt-editbutton"><ion-icon name="create"></ion-icon><!--constStr@ClicktoEdit--></a>
<a onclick="document.getElementById('txt-a').readOnly='readonly';document.getElementById('txt-save').style.display='none';document.getElementById('txt-editbutton').style.display='';document.getElementById('txt-cancelbutton').style.display='none';" id="txt-cancelbutton" style="display:none"><ion-icon name="close"></ion-icon><!--constStr@CancelEdit--></a>&nbsp;&nbsp;&nbsp; <a onclick="document.getElementById('txt-a').readOnly='readonly';document.getElementById('txt-save').style.display='none';document.getElementById('txt-editbutton').style.display='';document.getElementById('txt-cancelbutton').style.display='none';" id="txt-cancelbutton" style="display:none"><ion-icon name="close"></ion-icon><!--constStr@CancelEdit--></a>&nbsp;&nbsp;&nbsp;
<a id="txt-save" style="display:none"><ion-icon name="save"></ion-icon><!--constStr@Save--></a> <a id="txt-save" style="display:none"><ion-icon name="save"></ion-icon><!--constStr@Save--></a>
@@ -209,6 +210,12 @@
<textarea id="txt-a" name="editfile" readonly style="width: 100%; margin-top: 2px;" <!--AdminStart-->onchange="document.getElementById('txt-save').onclick=function(){document.getElementById('txt-form').submit();}"<!--AdminEnd--> ><!--TxtContent--></textarea> <textarea id="txt-a" name="editfile" readonly style="width: 100%; margin-top: 2px;" <!--AdminStart-->onchange="document.getElementById('txt-save').onclick=function(){document.getElementById('txt-form').submit();}"<!--AdminEnd--> ><!--TxtContent--></textarea>
<!--AdminStart--> <!--AdminStart-->
</form> </form>
<script>
var inputAdminStorage = document.getElementsByName("_admin");
for (i=0;i<inputAdminStorage.length;i++) {
inputAdminStorage[i].value = localStorage.getItem("admin");
}
</script>
<!--AdminEnd--> <!--AdminEnd-->
</div> </div>
<!--IstxtFileEnd--> <!--IstxtFileEnd-->
@@ -988,7 +995,7 @@
delete uploading[upbigfilename]; delete uploading[upbigfilename];
} }
} }
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5); xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5 + '&_admin=' + localStorage.getItem("admin"));
<!--GuestStart--> <!--GuestStart-->
} }
} }
@@ -1239,7 +1246,7 @@
getuplink(i); getuplink(i);
}*/ }*/
} }
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize); xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
} }
} }
} }
@@ -1325,7 +1332,7 @@
} }
delete uploading[filename]; delete uploading[filename];
} }
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag'])); xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']) + '&_admin=' + localStorage.getItem("admin"));
} else { } else {
var binary = this.result; var binary = this.result;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
@@ -1396,7 +1403,7 @@
} }
delete uploading[filename]; delete uploading[filename];
} }
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag'])); xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']) + '&_admin=' + localStorage.getItem("admin"));
// uploadbuttonshow(); // uploadbuttonshow();
} else { } else {
readblob(asize); readblob(asize);
@@ -1439,7 +1446,7 @@
var expd = new Date(); var expd = new Date();
expd.setTime(expd.getTime()+1000); expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString(); var expires = "expires="+expd.toGMTString();
document.cookie = "admin=; path=/; "+expires; document.cookie = "admin=; path=<!--base_path-->; "+expires;
location.href = location.href; location.href = location.href;
} }
/*for some mobile browser*/ /*for some mobile browser*/
@@ -1533,7 +1540,7 @@
document.getElementById(str+'_div').style.display='none'; document.getElementById(str+'_div').style.display='none';
document.getElementById('mask').style.display='none'; document.getElementById('mask').style.display='none';
} }
xhr.send(serializeForm(str+'_form')); xhr.send(serializeForm(str+'_form') + '&_admin=' + localStorage.getItem("admin"));
return false; return false;
} }
function addelement(html) { function addelement(html) {