79 Commits
Author SHA1 Message Date
qkqpttgfandGitHub 3d67d57ded show Environment<4K error 2021-08-18 05:14:16 +00:00
qkqpttgfandGitHub 7e5fc7c502 Update version 2021-08-17 20:34:16 +08:00
root f2ee21b683 add WaitFunction in operate 2021-08-17 11:51:17 +00:00
qkqpttgfandGitHub 729e1e1176 chang SCF update 2021-08-17 19:37:00 +08:00
qkqpttgfandGitHub 12494b62ed change dontBasicAuth to useBasicAuth 2021-08-09 04:27:25 +00:00
qkqpttgfandGitHub 54e38b5f67 change dontBasicAuth to useBasicAuth 2021-08-09 04:25:18 +00:00
qkqpttgfandGitHub b079891a1e try2 fix [500 Parse Error: Expected HTTP/] in Vercel 2021-08-07 20:56:41 +08:00
qkqpttgfandGitHub ee33e30cbf try fix [500 Parse Error: Expected HTTP/] in Vercel 2021-08-07 20:30:45 +08:00
qkqpttgfandGitHub c862409072 pay me 2021-08-06 18:29:33 +08:00
qkqpttgfandGitHub 0a20505798 add How to deploy to Vercel 2021-08-05 18:14:47 +08:00
qkqpttgfandGitHub 29e9fea562 try fix bug 2021-08-05 18:13:37 +08:00
qkqpttgfandGitHub 80d93cb852 temp fix add driver error 2021-08-05 18:11:46 +08:00
qkqpttgfandGitHub b2b5703977 fix: base_path error, read {} as object 2021-08-05 16:05:37 +08:00
qkqpttgfandGitHub 21d7d5d007 Update version 2021-08-04 15:46:16 +08:00
qkqpttgfandGitHub e06065a95c add platform Vercel 2021-08-04 15:30:19 +08:00
qkqpttgfandGitHub e58502f0be add platform Vercel 2021-08-04 15:28:58 +08:00
qkqpttgfandGitHub 9ff6e6bfe4 add platform Vercel 2021-08-04 15:26:13 +08:00
qkqpttgfandGitHub 52de7975c4 background (or other) based on width/height not only width 2021-08-04 15:19:50 +08:00
qkqpttgfandGitHub 638d8b09e3 fix bug 2021-08-04 15:17:17 +08:00
qkqpttgfandGitHub 244fbf747c rename use file id 2021-08-04 15:16:08 +08:00
qkqpttgfandGitHub 47bf9705bb Merge pull request #392 from yareiy/yareiy-patch-1
fix: ionicons svg 404 error and Cannot read property 'focus' of null
2021-08-04 09:09:50 +08:00
夜棂依andGitHub 23bf6fa38f fix: Cannot read property 'focus' of null 2021-08-03 21:42:07 +08:00
夜棂依andGitHub e2494ff385 fix: ionicons svg 404 error 2021-08-03 21:37:34 +08:00
夜棂依andGitHub 353222fc47 fix: ionicons svg 404 error 2021-08-03 21:34:14 +08:00
qkqpttgfandGitHub ba6aa0e9a1 Merge pull request #391 from yareiy/yareiy-patch-1
fix svg 404
2021-08-03 09:11:57 +08:00
夜棂依andGitHub 00422380d4 fix svg 404 2021-08-03 02:27:12 +08:00
qkqpttgfandGitHub 82f4d1b247 Merge pull request #383 from wendaleruan/patch-1
fix svg 404
2021-07-26 11:08:24 +08:00
wendaleandGitHub 21d96bb838 fix svg 404 2021-07-26 10:41:37 +08:00
qkqpttgfandGitHub 31b64cf4ba try fix: ionicons svg 404 error 2021-07-26 10:23:03 +08:00
qkqpttgfandGitHub fc5cdab36b try fix: custom domain in glitch, force https 2021-07-16 13:57:52 +08:00
qkqpttgfandGitHub c0d3afcaa4 Merge pull request #368 from BingoKingo/patch-1
tfo theme 20210711
2021-07-12 08:53:13 +08:00
BingoKingoandGitHub 1a5a6ee0e8 tfo theme 20210711 2021-07-11 19:47:54 +08:00
qkqpttgfandGitHub bc4a300cf7 Update readme.md 2021-07-06 20:41:16 +08:00
qkqpttgfandGitHub 8732de4047 Heroku Policy 2021-07-01 16:23:45 +08:00
qkqpttgfandGitHub 3249934f36 MSAPI, headers 2021-06-24 15:55:24 +08:00
qkqpttgfandGitHub c6e93168af fix: readme hidden 2021-06-23 16:11:13 +08:00
qkqpttgfandGitHub 74bb87ef15 fix: get hidden filename via json 2021-06-20 17:57:08 +08:00
qkqpttgfandGitHub 86ba05b5be MSAPI, GET 2021-06-17 17:18:44 +08:00
qkqpttgfandGitHub 7e4bf448e3 fix: guest upload >5 files. change: chunk size change with speed, operate box in middle. 2021-06-03 14:28:00 +08:00
qkqpttgfandGitHub 1737477aed Update readme.md 2021-05-28 15:55:30 +08:00
qkqpttgfandGitHub 33e464f991 try fix: image too long 2021-05-28 13:27:13 +08:00
qkqpttgfandGitHub dec313c0c7 fix: dont load disk cache in check rewrite 2021-05-25 18:25:29 +08:00
qkqpttgfandGitHub 0adcec4cf4 Update readme.md 2021-05-25 09:29:23 +08:00
qkqpttgfandGitHub 4de09d0a15 add nginx rewrite when used in Subdirectory 2021-05-24 17:55:28 +08:00
qkqpttgfandGitHub 5d7b4deeb7 dont load disk cache in check rewrite 2021-05-24 17:29:49 +08:00
qkqpttgfandGitHub 3498d8862e Merge pull request #327 from Sansui233/master
add theme flatcard
2021-05-18 19:35:35 +08:00
Sansui233 e9c3125194 add theme flatcard 2021-05-18 18:40:30 +08:00
qkqpttgfandGitHub 6030c320c5 Merge pull request #324 from kizx/onemoeTheme
更新onemoe主题
2021-05-17 10:43:05 +08:00
qkqpttgfandGitHub dd1250b0f0 try fix & and &amp; in path 2021-05-16 20:12:17 +08:00
kizx d03423bb5f 更新onemoe主题 2021-05-16 17:47:47 +08:00
qkqpttgfandGitHub 77d8147405 try fix & in path 2021-05-16 12:50:39 +08:00
qkqpttgfandGitHub 52d765a27f margin in foot of preview 2021-05-14 14:41:16 +08:00
qkqpttgfandGitHub 41d37f6bb4 Merge pull request #321 from qkqpttgf/GBKpreview
GBKpreview
2021-05-14 14:28:56 +08:00
qkqpttgfandGitHub 57fc272939 more files 2021-05-13 15:13:08 +08:00
qkqpttgfandGitHub fa7b27a878 try fix GBK txt preview 2021-05-13 13:59:36 +08:00
qkqpttgfandGitHub 279055b3bb try fix GBK txt preview 2021-05-13 13:58:43 +08:00
qkqpttgfandGitHub 741044e5ea try fix GBK txt preview 2021-05-13 13:57:24 +08:00
qkqpttgfandGitHub 13b70a4252 fix the last folder name is the number it in list 2021-05-13 09:54:52 +08:00
qkqpttgfandGitHub 57f5a1cdd2 try Aliyundrive norefer in output 2021-05-13 09:43:57 +08:00
qkqpttgfandGitHub 3b084f9544 Update version 2021-05-12 16:55:17 +08:00
qkqpttgfandGitHub 72e08c886a hide "login" 2021-05-12 16:39:19 +08:00
root e131588680 forceHttps 2021-05-12 08:35:34 +00:00
qkqpttgfandGitHub d33578ad57 fix: continue upload after stop 2021-04-25 11:07:55 +08:00
qkqpttgfandGitHub 388f08a9b0 Merge pull request #303 from jssycszyj/master
修复文件夹名包含%导致文件夹下文件400错误
2021-04-22 14:04:16 +08:00
jssycszyj 398fa02063 Update common.php 2021-04-21 23:45:18 +08:00
jssycszyj a630f9cbe7 Update common.php 2021-04-21 23:36:14 +08:00
jssycszyj 04908da5a4 Update common.php 2021-04-21 22:46:07 +08:00
qkqpttgfandGitHub 1da82abb95 fix: can not edit disk when disktag is 'home' 2021-04-20 19:11:38 +08:00
qkqpttgfandGitHub b545056787 theme only for guest 2021-04-19 20:46:30 +08:00
qkqpttgfandGitHub f33564258d fix: back color of container 2021-04-19 19:42:27 +08:00
qkqpttgfandGitHub a4fe802689 fix: radius 2021-04-19 19:35:54 +08:00
qkqpttgfandGitHub 98d5b4d63f mv TagSort to top 2021-04-19 19:03:52 +08:00
qkqpttgfandGitHub bd682db3b9 try fix: delete button hidden at last line 2021-04-19 18:23:04 +08:00
qkqpttgfandGitHub f993264e91 fix: sharepoint change to another sharepoint 2021-04-11 22:15:01 +08:00
qkqpttgfandGitHub a8e3d2ad15 Merge pull request #294 from qkqpttgf/qkqpttgf-patch-1
try fix: can not click operate in Safari
2021-04-11 21:46:07 +08:00
qkqpttgfandGitHub ef1748ba15 Update classic.html 2021-04-11 21:33:35 +08:00
qkqpttgfandGitHub e116b1224e try fix: preview office files 2021-04-09 10:44:56 +08:00
qkqpttgfandGitHub 55c9805cc0 try fix some error in import 2021-04-07 21:16:37 +08:00
qkqpttgfandGitHub 99d3d4c2ee fix: 500 error in setting new app 2021-04-07 20:07:30 +08:00
25 changed files with 3684 additions and 589 deletions
+5
View File
@@ -9,6 +9,11 @@ RewriteRule ^(.*) index.php?/$1 [L]
### nginx ### nginx
# rewrite ^/(?!.well-known)(.*)$ /index.php?/$1 last; # rewrite ^/(?!.well-known)(.*)$ /index.php?/$1 last;
# #
### nginx Subdirectory 在子目录中使用
# location /OneManager2/ {
# rewrite ^/(.*)$ /OneManager2/index.php?/$1 last;
# }
#
### caddy ### caddy
# rewrite { # rewrite {
# to index.php?/$1 # to index.php?/$1
+212 -103
View File
@@ -35,8 +35,9 @@ $EnvConfigs = [
'customCss' => 0b011, 'customCss' => 0b011,
'customTheme' => 0b011, 'customTheme' => 0b011,
'theme' => 0b010, 'theme' => 0b010,
'dontBasicAuth' => 0b010, 'useBasicAuth' => 0b010,
'referrer' => 0b011, 'referrer' => 0b011,
'forceHttps' => 0b010,
'Driver' => 0b100, 'Driver' => 0b100,
'client_id' => 0b100, 'client_id' => 0b100,
@@ -133,6 +134,19 @@ function main($path)
if (strpos(__DIR__, ':')) $slash = '\\'; if (strpos(__DIR__, ':')) $slash = '\\';
$_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);
if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
if ($_GET) {
$tmp = '';
foreach ($_GET as $k => $v) {
if ($v===true) $tmp .= '&' . $k;
else $tmp .= '&' . $k . '=' . $v;
}
$tmp = substr($tmp, 1);
if ($tmp!='') $param = '?' . $tmp;
}
return output('visit via https.', 302, [ 'Location' => 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $param ]);
}
if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) { if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) {
$constStr['language'] = $_SERVER['firstacceptlanguage']; $constStr['language'] = $_SERVER['firstacceptlanguage'];
} else { } else {
@@ -150,8 +164,6 @@ 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['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
if (getConfig('admin')=='') return install(); if (getConfig('admin')=='') return install();
if (getConfig('adminloginpage')=='') { if (getConfig('adminloginpage')=='') {
@@ -186,6 +198,13 @@ function main($path)
$url = path_format($_SERVER['PHP_SELF'] . '/'); $url = path_format($_SERVER['PHP_SELF'] . '/');
return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]); return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
} }
if (isset($_GET['WaitFunction'])) {
$response = WaitFunction($_GET['WaitFunction']);
//var_dump($response);
if ($response===true) return output("ok", 200);
elseif ($response===false) return output("", 206);
else return $response;
}
$_SERVER['sitename'] = getConfig('sitename'); $_SERVER['sitename'] = getConfig('sitename');
if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
@@ -283,6 +302,7 @@ function main($path)
return $drive->bigfileupload($path1); return $drive->bigfileupload($path1);
} }
} }
if ($_SERVER['admin']) { if ($_SERVER['admin']) {
$tmp = adminoperate($path); $tmp = adminoperate($path);
if ($tmp['statusCode'] > 0) { if ($tmp['statusCode'] > 0) {
@@ -304,12 +324,13 @@ function main($path)
if ($thumb_url!='') { if ($thumb_url!='') {
if ($_GET['location']) { if ($_GET['location']) {
$url = $thumb_url; $url = $thumb_url;
$header['Location'] = $url;
$domainforproxy = ''; $domainforproxy = '';
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']); $domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
if ($domainforproxy!='') { if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy); $url = proxy_replace_domain($url, $domainforproxy, $header);
} }
return output('', 302, [ 'Location' => $url ]); return output('', 302, $header);
} else return output($thumb_url); } else return output($thumb_url);
} }
return output('', 404); return output('', 404);
@@ -337,6 +358,11 @@ function main($path)
if ($_GET['json']) { if ($_GET['json']) {
// return a json // return a json
if ($files['type']=='folder' && !$_SERVER['admin']) {
foreach ($files['list'] as $k => $v) {
if (isHideFile($k)) unset($files['list'][$k]);
}
}
return output(json_encode($files), 200, ['Content-Type' => 'application/json']); return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
} }
// random file // random file
@@ -350,12 +376,13 @@ function main($path)
if (count($tmp)>0) { if (count($tmp)>0) {
$url = $tmp[rand(0, count($tmp)-1)]; $url = $tmp[rand(0, count($tmp)-1)];
if (isset($_GET['url'])) return output($url, 200); if (isset($_GET['url'])) return output($url, 200);
$header['Location'] = $url;
$domainforproxy = ''; $domainforproxy = '';
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']); $domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
if ($domainforproxy!='') { if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy); $url = proxy_replace_domain($url, $domainforproxy, $header);
} }
return output('', 302, [ 'Location' => $url ]); return output('', 302, $header);
} else return output('No ' . $_GET['random'] . 'file', 404); } else return output('No ' . $_GET['random'] . 'file', 404);
} else return output('Hidden', 401); } else return output('Hidden', 401);
} }
@@ -363,15 +390,15 @@ function main($path)
if ($files['type']=='file' && !isset($_GET['preview'])) { if ($files['type']=='file' && !isset($_GET['preview'])) {
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt', $_SERVER['disktag'])&&$files['name']!=getConfig('passfile')) ) { if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt', $_SERVER['disktag'])&&$files['name']!=getConfig('passfile')) ) {
$url = $files['url']; $url = $files['url'];
$domainforproxy = '';
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy);
}
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']); if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
else { else {
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE']; if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
$header['Location'] = $url; $header['Location'] = $url;
$domainforproxy = '';
$domainforproxy = getConfig('domainforproxy', $_SERVER['disktag']);
if ($domainforproxy!='') {
$url = proxy_replace_domain($url, $domainforproxy, $header);
}
return output('', 302, $header); return output('', 302, $header);
} }
} }
@@ -454,6 +481,7 @@ function compareadminmd5($admincookie, $name, $pass)
if (md5($name . ':' . md5($pass) . '@' . $c_time) == $c_md5) return true; if (md5($name . ':' . md5($pass) . '@' . $c_time) == $c_md5) return true;
else return false; else return false;
} }
function compareadminsha1($adminsha1, $timestamp, $pass) function compareadminsha1($adminsha1, $timestamp, $pass)
{ {
if (!is_numeric($timestamp)) return 'Timestamp not Number'; if (!is_numeric($timestamp)) return 'Timestamp not Number';
@@ -465,8 +493,9 @@ function compareadminsha1($adminsha1, $timestamp, $pass)
else return 'Error password'; else return 'Error password';
} }
function proxy_replace_domain($url, $domainforproxy) function proxy_replace_domain($url, $domainforproxy, &$header)
{ {
global $drive;
$tmp = splitfirst($url, '//'); $tmp = splitfirst($url, '//');
$http = $tmp[0]; $http = $tmp[0];
$tmp = splitfirst($tmp[1], '/'); $tmp = splitfirst($tmp[1], '/');
@@ -475,10 +504,14 @@ function proxy_replace_domain($url, $domainforproxy)
if (substr($domainforproxy, 0, 7)=='http://' || substr($domainforproxy, 0, 8)=='https://') $aim = $domainforproxy; if (substr($domainforproxy, 0, 7)=='http://' || substr($domainforproxy, 0, 8)=='https://') $aim = $domainforproxy;
else $aim = $http . '//' . $domainforproxy; else $aim = $http . '//' . $domainforproxy;
if (substr($aim, -1)=='/') $aim = substr($aim, 0, -1); if (substr($aim, -1)=='/') $aim = substr($aim, 0, -1);
//$header['Location'] = $aim . '/' . $uri;
//return $aim . '/' . $uri;
if (strpos($url, '?')>0) $sp = '&'; if (strpos($url, '?')>0) $sp = '&';
else $sp = '?'; else $sp = '?';
$aim .= '/' . $uri . $sp . 'Origindomain=' . $domain;
if ($drive->show_base_class()=='Aliyundrive') $aim .= '&Aliyundrive';
$header['Location'] = $aim;
return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain; return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
//$url = str_replace($tmp, $domainforproxy, $url).'&Origindomain='.$tmp;
} }
function isHideFile($name) function isHideFile($name)
@@ -489,6 +522,7 @@ function isHideFile($name)
'head.omf', 'head.omf',
'foot.omf', 'foot.omf',
'favicon.ico', 'favicon.ico',
'robots.txt',
'index.html', 'index.html',
]; ];
@@ -701,7 +735,7 @@ function comppass($pass)
return 2; return 2;
} }
if ($_COOKIE['password'] !== '') if ($_COOKIE['password'] === $pass ) return 3; if ($_COOKIE['password'] !== '') if ($_COOKIE['password'] === $pass ) return 3;
if (!getConfig('dontBasicAuth')) { if (getConfig('useBasicAuth')) {
// use Basic Auth // use Basic Auth
//$_SERVER['PHP_AUTH_USER'] //$_SERVER['PHP_AUTH_USER']
if ($_SERVER['PHP_AUTH_PW'] !== '') if (md5($_SERVER['PHP_AUTH_PW']) === $pass ) { if ($_SERVER['PHP_AUTH_PW'] !== '') if (md5($_SERVER['PHP_AUTH_PW']) === $pass ) {
@@ -717,7 +751,7 @@ function comppass($pass)
function encode_str_replace($str) function encode_str_replace($str)
{ {
$str = str_replace('%','%25',$str); $str = str_replace('%','%25',$str);
$str = str_replace('&','&amp;',$str); if (strpos($str, '&amp;')) $str = str_replace('&amp;', '&amp;amp;', $str);
$str = str_replace('+','%2B',$str); $str = str_replace('+','%2B',$str);
$str = str_replace('#','%23',$str); $str = str_replace('#','%23',$str);
return $str; return $str;
@@ -774,9 +808,9 @@ function get_timezone($timezone = '8')
return $timezones[$timezone]; return $timezones[$timezone];
} }
function message($message, $title = 'Message', $statusCode = 200) function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
{ {
return output(' $html = '
<html lang="' . $_SERVER['language'] . '"> <html lang="' . $_SERVER['language'] . '">
<html> <html>
<meta charset=utf-8> <meta charset=utf-8>
@@ -784,14 +818,61 @@ function message($message, $title = 'Message', $statusCode = 200)
<body> <body>
<h1>' . $title . '</h1> <h1>' . $title . '</h1>
<a href="' . $_SERVER['base_path'] . '">' . getconstStr('Back') . getconstStr('Home') . '</a> <a href="' . $_SERVER['base_path'] . '">' . getconstStr('Back') . getconstStr('Home') . '</a>
<p> <div id="dis" style="display: none;">
' . $message . ' ' . $message . '
</p> </div>';
if ($wainstat) {
$html .= '
<div id="err"></div>
<script>
var dis = document.getElementById("dis");
var errordiv = document.getElementById("err");
//var deployTime = new Date().getTime();
dis.style.display = "none";
var x = "";
var min = 0;
function getStatus() {
x += ".";
min++;
var xhr = new XMLHttpRequest();
var url = "?WaitFunction" + (status!=""?"=" + status:"");
xhr.open("GET", url);
//xhr.setRequestHeader("Authorization", "Bearer ");
xhr.onload = function(e) {
if (xhr.status==200) {
//var deployStat = JSON.parse(xhr.responseText).readyState;
if (xhr.responseText=="ok") {
errordiv.innerHTML = "";
dis.style.display = "";
} else {
errordiv.innerHTML = "ERROR<br>" + xhr.responseText;
//setTimeout(function() { getStatus() }, 1000);
}
} else if (xhr.status==206) {
errordiv.innerHTML = min + "<br>' . getconstStr('Wait') . '" + x;
setTimeout(function() { getStatus() }, 1000);
} else {
errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
console.log(xhr.status);
console.log(xhr.responseText);
}
}
xhr.send(null);
}
getStatus();
//setTimeout(function() { getStatus() }, 3000);
</script>';
} else {
$html .= '
<script>document.getElementById("dis").style.display = "";</script>';
}
$html .= '
</body> </body>
</html> </html>
', $statusCode); ';
return output($html, $statusCode);
} }
function needUpdate() function needUpdate()
@@ -823,8 +904,9 @@ function needUpdate()
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false) function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
{ {
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie']; if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
$headers['Referrer-Policy'] = 'no-referrer'; //$headers['Referrer-Policy'] = 'same-origin'; if (baseclassofdrive()=='Aliyundrive') $headers['Referrer-Policy'] = 'no-referrer';
$headers['X-Frame-Options'] = 'sameorigin'; //$headers['Referrer-Policy'] = 'same-origin';
//$headers['X-Frame-Options'] = 'sameorigin';
return [ return [
'isBase64Encoded' => $isBase64Encoded, 'isBase64Encoded' => $isBase64Encoded,
'statusCode' => $statusCode, 'statusCode' => $statusCode,
@@ -1082,12 +1164,13 @@ function EnvOpt($needUpdate = 0)
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
$title = 'Error'; $title = 'Error';
return message($html, $title, 400);
} else { } else {
//WaitSCFStat(); //WaitSCFStat();
$html .= getconstStr('UpdateSuccess') . '<br><a href="">' . getconstStr('Back') . '</a>'; $html .= getconstStr('UpdateSuccess') . '<br><a href="">' . getconstStr('Back') . '</a><script>var status = "' . $response['status'] . '";</script>';
$title = getconstStr('Setup'); $title = getconstStr('Setup');
return message($html, $title, 202, 1);
} }
return message($html, $title);
} }
if (isset($_POST['submit1'])) { if (isset($_POST['submit1'])) {
$_SERVER['disk_oprating'] = ''; $_SERVER['disk_oprating'] = '';
@@ -1100,11 +1183,11 @@ function EnvOpt($needUpdate = 0)
$f = substr($v, 0, 1); $f = substr($v, 0, 1);
if (strlen($v)==1) $v .= '_'; if (strlen($v)==1) $v .= '_';
if (isCommonEnv($v)) { if (isCommonEnv($v)) {
return message('Do not input ' . $envs . '<br><a href="">' . getconstStr('Back') . '</a>', 'Error', 201); return message('Do not input ' . $envs . '<br><a href="">' . getconstStr('Back') . '</a>', 'Error', 400);
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) { } elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
return message('<a href="">' . getconstStr('Back') . '</a>', 'Please start with letters', 201); return message('<a href="">' . getconstStr('Back') . '</a>', 'Please start with letters', 400);
} elseif (getConfig($v)) { } elseif (getConfig($v)) {
return message('<a href="">' . getconstStr('Back') . '</a>', 'Same tag', 201); return message('<a href="">' . getconstStr('Back') . '</a>', 'Same tag', 400);
} else { } else {
$tmp[$k] = $v; $tmp[$k] = $v;
} }
@@ -1112,7 +1195,7 @@ function EnvOpt($needUpdate = 0)
if ($k=='disktag_sort') { if ($k=='disktag_sort') {
$td = implode('|', json_decode($v)); $td = implode('|', json_decode($v));
if (strlen($td)==strlen(getConfig('disktag'))) $tmp['disktag'] = $td; if (strlen($td)==strlen(getConfig('disktag'))) $tmp['disktag'] = $td;
else return message('Something wrong.'); else return message('Something wrong.', 'ERROR', 400);
} }
if ($k == 'disk') $_SERVER['disk_oprating'] = $v; if ($k == 'disk') $_SERVER['disk_oprating'] = $v;
} }
@@ -1129,12 +1212,16 @@ function EnvOpt($needUpdate = 0)
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
$title = 'Error'; $title = 'Error';
return message($html, $title, 409);
} else { } else {
$html .= getconstStr('Success') . '!<br> $html .= getconstStr('Success') . '!<br>
<a href="">' . getconstStr('Back') . '</a>'; <a href="">' . getconstStr('Back') . '</a>
<script>
var status = "' . $response['status'] . '";
</script>';
$title = getconstStr('Setup'); $title = getconstStr('Setup');
return message($html, $title, 200, 1);
} }
return message($html, $title);
} }
if (isset($_POST['config_b'])) { if (isset($_POST['config_b'])) {
if (!$_POST['pass']) return output("{\"Error\": \"No admin pass\"}", 403); if (!$_POST['pass']) return output("{\"Error\": \"No admin pass\"}", 403);
@@ -1151,7 +1238,7 @@ function EnvOpt($needUpdate = 0)
} }
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
$d = getConfig($disktag); $d = getConfig($disktag);
if ($d === '') { if ($d == '') {
$d = ''; $d = '';
} elseif (gettype($d)=='array') { } elseif (gettype($d)=='array') {
$tmp[$disktag] = $d; $tmp[$disktag] = $d;
@@ -1168,7 +1255,7 @@ function EnvOpt($needUpdate = 0)
$c = splitlast($c, '}')[0] . '}'; $c = splitlast($c, '}')[0] . '}';
$tmp = json_decode($c, true); $tmp = json_decode($c, true);
if (!!!$tmp) return output("{\"Error\": \"Config input error. " . $c . "\"}", 403); if (!!!$tmp) return output("{\"Error\": \"Config input error. " . $c . "\"}", 403);
$tmptag = $tmp['disktag']; if (isset($tmp['disktag'])) $tmptag = $tmp['disktag'];
foreach ($EnvConfigs as $env => $v) { foreach ($EnvConfigs as $env => $v) {
if (isCommonEnv($env)) { if (isCommonEnv($env)) {
if (isShowedEnv($env)) { if (isShowedEnv($env)) {
@@ -1178,11 +1265,11 @@ function EnvOpt($needUpdate = 0)
} }
} }
} }
foreach ($disktags as $disktag) { if ($disktags) foreach ($disktags as $disktag) {
if (!isset($tmp[$disktag])) $tmp[$disktag] = ''; if ($disktag!=''&&!isset($tmp[$disktag])) $tmp[$disktag] = '';
} }
$tmp['disktag'] = $tmptag; if ($tmptag) $tmp['disktag'] = $tmptag;
$response = setConfigResponse( setConfig($tmp, $_SERVER['disk_oprating']) ); $response = setConfigResponse( setConfig($tmp) );
if (api_error($response)) { if (api_error($response)) {
return output("{\"Error\": \"" . api_error_msg($response) . "\"}", 500); return output("{\"Error\": \"" . api_error_msg($response) . "\"}", 500);
} else { } else {
@@ -1206,7 +1293,7 @@ function EnvOpt($needUpdate = 0)
if (api_error($response)) { if (api_error($response)) {
return message(api_error_msg($response) . "<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); return message(api_error_msg($response) . "<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
} else { } else {
return message("Success<a href=\"\">" . getconstStr('Back') . "</a>", "Success", 200); return message("Success<a href=\"\">" . getconstStr('Back') . "</a><script>var status = \"" . $response['status'] . "\";</script>", "Success", 200, 1);
} }
} else { } else {
return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403); return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
@@ -1221,7 +1308,7 @@ function EnvOpt($needUpdate = 0)
$html .= ' $html .= '
<a href="' . $preurl . '">' . getconstStr('Back') . '</a><br> <a href="' . $preurl . '">' . getconstStr('Back') . '</a><br>
'; ';
if (isset($_GET['frame'])&&$_GET['frame']=='platform') { if ($_GET['setup']==='platform') {
$frame .= ' $frame .= '
<table border=1 width=100%> <table border=1 width=100%>
<form name="common" action="" method="post">'; <form name="common" action="" method="post">';
@@ -1274,8 +1361,8 @@ function EnvOpt($needUpdate = 0)
<tr><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td><td></td></tr> <tr><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td><td></td></tr>
</form> </form>
</table><br>'; </table><br>';
} elseif (isset($_GET['frame'])&&in_array($_GET['frame'], $disktags)) { } elseif (isset($_GET['disktag'])&&in_array($_GET['disktag'], $disktags)) {
$disktag = $_GET['frame']; $disktag = $_GET['disktag'];
$disk_tmp = null; $disk_tmp = null;
$diskok = driveisfine($disktag, $disk_tmp); $diskok = driveisfine($disktag, $disk_tmp);
$frame .= ' $frame .= '
@@ -1289,6 +1376,22 @@ function EnvOpt($needUpdate = 0)
</form> </form>
</td> </td>
</tr> </tr>
</table><br>
<table>
<tr>
<td>
<form action="" method="post" style="margin: 0" onsubmit="return deldiskconfirm(this);">
<input type="hidden" name="disktag_del" value="' . $disktag . '">
<input type="submit" name="submit1" value="' . getconstStr('DelDisk') . '">
</form>
</td>
<td>
<form action="" method="post" style="margin: 0" onsubmit="return cpdiskconfirm(this);">
<input type="hidden" name="disktag_copy" value="' . $disktag . '">
<input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '">
</form>
</td>
</tr>
</table> </table>
<table border=1 width=100%> <table border=1 width=100%>
<tr> <tr>
@@ -1330,23 +1433,8 @@ function EnvOpt($needUpdate = 0)
</tr>'; </tr>';
} }
$frame .= ' $frame .= '
</table><br>
<table>
<tr>
<td>
<form action="" method="post" style="margin: 0" onsubmit="return deldiskconfirm(this);">
<input type="hidden" name="disktag_del" value="' . $disktag . '">
<input type="submit" name="submit1" value="' . getconstStr('DelDisk') . '">
</form>
</td>
<td>
<form action="" method="post" style="margin: 0" onsubmit="return cpdiskconfirm(this);">
<input type="hidden" name="disktag_copy" value="' . $disktag . '">
<input type="submit" name="submit1" value="' . getconstStr('CopyDisk') . '">
</form>
</td>
</tr>
</table> </table>
<script> <script>
function deldiskconfirm(t) { function deldiskconfirm(t) {
var msg="' . getconstStr('Delete') . ' ??"; var msg="' . getconstStr('Delete') . ' ??";
@@ -1381,27 +1469,8 @@ function EnvOpt($needUpdate = 0)
} }
</script>'; </script>';
} else { } else {
$_GET['frame'] = 'home'; //$_GET['disktag'] = '';
$Driver_arr = scandir(__DIR__ . $slash . 'disk'); $Driver_arr = scandir(__DIR__ . $slash . 'disk');
$frame .= '
<select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">';
foreach ($Driver_arr as $v1) {
if ($v1!='.' && $v1!='..') {
//$v1 = substr($v1, 0, -4);
$v1 = splitlast($v1, '.php')[0];
$frame .= '
<option value="' . $v1 . '"' . ($v1=='Onedrive'?' selected="selected"':'') . '>' . $v1 . '</option>';
}
}
$frame .= '
</select>
<a id="AddDisk_link" href="?AddDisk=Onedrive">' . getconstStr('AddDisk') . '</a>
<script>
function changedrivetype(d) {
document.getElementById(\'AddDisk_link\').href="?AddDisk=" + d;
}
</script>
<br><br>';
if (count($disktags)>1) { if (count($disktags)>1) {
$frame .= ' $frame .= '
<script src="//cdn.bootcss.com/Sortable/1.8.3/Sortable.js"></script> <script src="//cdn.bootcss.com/Sortable/1.8.3/Sortable.js"></script>
@@ -1477,6 +1546,24 @@ function EnvOpt($needUpdate = 0)
}); });
</script><br>'; </script><br>';
} }
$frame .= '
<select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">';
foreach ($Driver_arr as $v1) {
if ($v1!='.' && $v1!='..') {
//$v1 = substr($v1, 0, -4);
$v2 = splitlast($v1, '.php')[0];
if ($v2 . '.php'==$v1) $frame .= '
<option value="' . $v2 . '"' . ($v2=='Onedrive'?' selected="selected"':'') . '>' . $v2 . '</option>';
}
}
$frame .= '
</select>
<a id="AddDisk_link" href="?AddDisk=Onedrive">' . getconstStr('AddDisk') . '</a><br><br>
<script>
function changedrivetype(d) {
document.getElementById(\'AddDisk_link\').href="?AddDisk=" + d;
}
</script>';
$canOneKeyUpate = 0; $canOneKeyUpate = 0;
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
@@ -1485,9 +1572,11 @@ function EnvOpt($needUpdate = 0)
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} elseif ($_SERVER['_APP_SHARE_DIR']==='/var/share/CFF/processrouter') { } elseif (isset($_SERVER['_APP_SHARE_DIR'])&&$_SERVER['_APP_SHARE_DIR']==='/var/share/CFF/processrouter') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} else { } else {
$tmp = time(); $tmp = time();
@@ -1579,7 +1668,7 @@ function EnvOpt($needUpdate = 0)
<button name="config_b" value="import" onclick="importConfig(this);">import</button></td> <button name="config_b" value="import" onclick="importConfig(this);">import</button></td>
</tr> </tr>
</form> </form>
</table> </table><br>
<script> <script>
var config_f = document.getElementById("config_f"); var config_f = document.getElementById("config_f");
function exportConfig(b) { function exportConfig(b) {
@@ -1587,6 +1676,12 @@ function EnvOpt($needUpdate = 0)
alert("admin pass"); alert("admin pass");
return false; return false;
} }
try {
sha1(1);
} catch {
alert("sha1.js not loaded.");
return false;
}
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", ""); xhr.open("POST", "");
@@ -1624,6 +1719,12 @@ function EnvOpt($needUpdate = 0)
return false; return false;
} }
} }
try {
sha1(1);
} catch {
alert("sha1.js not loaded.");
return false;
}
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", ""); xhr.open("POST", "");
@@ -1655,12 +1756,18 @@ function EnvOpt($needUpdate = 0)
alert("Input twice new password"); alert("Input twice new password");
return false; return false;
} }
try {
sha1(1);
} catch {
alert("sha1.js not loaded.");
return false;
}
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
f.timestamp.value = timestamp; f.timestamp.value = timestamp;
f.oldPass.value = sha1(f.oldPass.value + "" + timestamp); f.oldPass.value = sha1(f.oldPass.value + "" + timestamp);
return true; return true;
} }
</script><br>'; </script>';
} }
$html .= ' $html .= '
<style type="text/css"> <style type="text/css">
@@ -1668,20 +1775,22 @@ function EnvOpt($needUpdate = 0)
</style> </style>
<table border=0> <table border=0>
<tr class="tabs">'; <tr class="tabs">';
if ($_GET['frame']=='home') $html .= ' if ($_GET['disktag']=='') {
<td>' . getconstStr('Home') . '</td>'; if ($_GET['setup']==='platform') $html .= '
else $html .= ' <td><a href="?setup">' . getconstStr('Home') . '</a></td>
<td><a href="?setup&frame=home">' . getconstStr('Home') . '</a></td>';
if ($_GET['frame']=='platform') $html .= '
<td>' . getconstStr('PlatformConfig') . '</td>'; <td>' . getconstStr('PlatformConfig') . '</td>';
else $html .= ' else $html .= '
<td><a href="?setup&frame=platform">' . getconstStr('PlatformConfig') . '</a></td>'; <td>' . getconstStr('Home') . '</td>
<td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>';
} else $html .= '
<td><a href="?setup">' . getconstStr('Home') . '</a></td>
<td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>';
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
if ($disktag!='') { if ($disktag!='') {
if ($_GET['frame']==$disktag) $html .= ' if ($_GET['disktag']==$disktag) $html .= '
<td>' . $disktag . '</td>'; <td>' . $disktag . '</td>';
else $html .= ' else $html .= '
<td><a href="?setup&frame=' . $disktag . '">' . $disktag . '</a></td>'; <td><a href="?setup&disktag=' . $disktag . '">' . $disktag . '</a></td>';
} }
} }
$html .= ' $html .= '
@@ -1772,7 +1881,7 @@ function render_list($path = '', $files = [])
} else { } else {
if (!($html = getcache('customTheme'))) { if (!($html = getcache('customTheme'))) {
$file_path = $theme; $file_path = $theme;
$tmp = curl('GET', $file_path, false, [], 1); $tmp = curl('GET', $file_path, '', [], 1);
if ($tmp['stat']==302) { if ($tmp['stat']==302) {
error_log1(json_encode($tmp)); error_log1(json_encode($tmp));
$tmp = curl('GET', $tmp["returnhead"]["Location"]); $tmp = curl('GET', $tmp["returnhead"]["Location"]);
@@ -1886,7 +1995,7 @@ function render_list($path = '', $files = [])
if ($_SERVER['ishidden']==4) { if ($_SERVER['ishidden']==4) {
// 加密状态 // 加密状态
if (!getConfig('dontBasicAuth')) { if (getConfig('useBasicAuth')) {
// use Basic Auth // use Basic Auth
return output('Need password.', 401, ['WWW-Authenticate'=>'Basic realm="Secure Area"']); return output('Need password.', 401, ['WWW-Authenticate'=>'Basic realm="Secure Area"']);
} }
@@ -2075,8 +2184,8 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--IsFileStart-->', '', $html); $html = str_replace('<!--IsFileStart-->', '', $html);
$html = str_replace('<!--IsFileEnd-->', '', $html); $html = str_replace('<!--IsFileEnd-->', '', $html);
} }
$html = str_replace('<!--FileEncodeUrl-->', str_replace('%2523', '%23', str_replace('%26amp%3B','&amp;',spurlencode(path_format($_SERVER['base_disk_path'] . '/' . $path), '/'))), $html); $html = str_replace('<!--FileEncodeUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path))), $html);
$html = str_replace('<!--FileUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html); $html = str_replace('<!--FileUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path))), $html);
$ext = strtolower(substr($path, strrpos($path, '.') + 1)); $ext = strtolower(substr($path, strrpos($path, '.') + 1));
if (in_array($ext, $exts['img'])) $ext = 'img'; if (in_array($ext, $exts['img'])) $ext = 'img';
@@ -2103,11 +2212,11 @@ function render_list($path = '', $files = [])
$html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html); $html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html);
} }
//while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files['url'], $html); //while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files['url'], $html);
while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html); while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html); while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html); while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html);
//$html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files['url']), $html); while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files['url']), $html);
while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); //while (strpos($html, '<!--FileEncodeDownUrl-->')) $html = str_replace('<!--FileEncodeDownUrl-->', urlencode(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html);
$html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html); $html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html);
$html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html); $html = str_replace('<!--constStr@CancelEdit-->', getconstStr('CancelEdit'), $html);
$html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html); $html = str_replace('<!--constStr@Save-->', getconstStr('Save'), $html);
@@ -2154,7 +2263,7 @@ function render_list($path = '', $files = [])
if ($file['type']=='folder') { if ($file['type']=='folder') {
if ($_SERVER['admin'] or !isHideFile($file['name'])) { if ($_SERVER['admin'] or !isHideFile($file['name'])) {
$filenum++; $filenum++;
$FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderList); $FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path) . '/' . $file['name'])), $FolderList);
$FolderListStr = str_replace('<!--FileId-->', $file['id'], $FolderListStr); $FolderListStr = str_replace('<!--FileId-->', $file['id'], $FolderListStr);
$FolderListStr = str_replace('<!--FileEncodeReplaceName-->', str_replace('&','&amp;', $file['showname']?$file['showname']:$file['name']), $FolderListStr); $FolderListStr = str_replace('<!--FileEncodeReplaceName-->', str_replace('&','&amp;', $file['showname']?$file['showname']:$file['name']), $FolderListStr);
$FolderListStr = str_replace('<!--lastModifiedDateTime-->', time_format($file['time']), $FolderListStr); $FolderListStr = str_replace('<!--lastModifiedDateTime-->', time_format($file['time']), $FolderListStr);
@@ -2176,7 +2285,7 @@ function render_list($path = '', $files = [])
$filenum++; $filenum++;
$ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1)); $ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1));
$FolderListStr = $FolderList; $FolderListStr = $FolderList;
while (strpos($FolderListStr, '<!--FileEncodeReplaceUrl-->')) $FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . encode_str_replace($file['name'])), $FolderListStr); while (strpos($FolderListStr, '<!--FileEncodeReplaceUrl-->')) $FolderListStr = str_replace('<!--FileEncodeReplaceUrl-->', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&amp;', '&', $path) . '/' . $file['name'])), $FolderListStr);
$FolderListStr = str_replace('<!--FileExt-->', $ext, $FolderListStr); $FolderListStr = str_replace('<!--FileExt-->', $ext, $FolderListStr);
if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('<!--FileExtType-->', 'audio', $FolderListStr); if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('<!--FileExtType-->', 'audio', $FolderListStr);
elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('<!--FileExtType-->', 'iframe', $FolderListStr); elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('<!--FileExtType-->', 'iframe', $FolderListStr);
@@ -2361,8 +2470,8 @@ function render_list($path = '', $files = [])
$tmp1 = splitfirst($tmp_path, '/'); $tmp1 = splitfirst($tmp_path, '/');
$folder1 = $tmp1[0]; $folder1 = $tmp1[0];
if ($folder1!='') { if ($folder1!='') {
$tmp_url .= $folder1 . '/'; $tmp_url .= str_replace('&amp;', '&', $folder1) . '/';
$PathArrayStr1 = str_replace('<!--PathArrayLink-->', ($folder1==$files['name']?'':$tmp_url), $PathArrayStr); $PathArrayStr1 = str_replace('<!--PathArrayLink-->', encode_str_replace($folder1==$files['name']?'':$tmp_url), $PathArrayStr);
$PathArrayStr1 = str_replace('<!--PathArrayName-->', $folder1, $PathArrayStr1); $PathArrayStr1 = str_replace('<!--PathArrayName-->', $folder1, $PathArrayStr1);
$html .= $PathArrayStr1; $html .= $PathArrayStr1;
} }
@@ -2382,8 +2491,8 @@ function render_list($path = '', $files = [])
$tmp1 = splitfirst($tmp_path, '/'); $tmp1 = splitfirst($tmp_path, '/');
$folder1 = $tmp1[0]; $folder1 = $tmp1[0];
if ($folder1!='') { if ($folder1!='') {
$tmp_url .= $folder1 . '/'; $tmp_url .= str_replace('&amp;', '&', $folder1) . '/';
$PathArrayStr1 = str_replace('<!--PathArrayLink-->', ($folder1==$files['name']?'':$tmp_url), $PathArrayStr); $PathArrayStr1 = str_replace('<!--PathArrayLink-->', encode_str_replace($folder1==$files['name']?'':$tmp_url), $PathArrayStr);
$PathArrayStr1 = str_replace('<!--PathArrayName-->', ($folder1==$_SERVER['disktag']?(getConfig('diskname')==''?$_SERVER['disktag']:getConfig('diskname')):$folder1), $PathArrayStr1); $PathArrayStr1 = str_replace('<!--PathArrayName-->', ($folder1==$_SERVER['disktag']?(getConfig('diskname')==''?$_SERVER['disktag']:getConfig('diskname')):$folder1), $PathArrayStr1);
$html .= $PathArrayStr1; $html .= $PathArrayStr1;
} }
+20 -25
View File
@@ -101,18 +101,18 @@ $constStr = [
'disableShowThumb' => 'if 1, the ShowThumbnail button will not display', 'disableShowThumb' => 'if 1, the ShowThumbnail button will not display',
'disableChangeTheme' => 'if 1, the Theme selection button will not display', 'disableChangeTheme' => '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' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password',
'dontBasicAuth' => 'if 1, will not popup user/pass windows in encrypted folder, but show the page in theme.', 'useBasicAuth' => '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.',
'theme' => 'Select theme.', 'forceHttps' => 'if 1, force to redirect to https when visit via http.',
'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' => '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 show files less than private.', 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
'sitename' => 'sitename', 'sitename' => 'sitename',
'Onedrive_ver' => 'Onedrive version',
], ],
'zh-cn' => [ 'zh-cn' => [
'admin' => '管理密码,不添加时不显示登录页面且无法登录。', 'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
@@ -122,25 +122,25 @@ $constStr = [
'customCss' => '<style>,在<head>最后面', 'customCss' => '<style>,在<head>最后面',
'customTheme' => 'html格式的主题的url', 'customTheme' => 'html格式的主题的url',
'referrer' => '只有这些域名能引用本站资源。格式为a1.com|b1.com', 'referrer' => '只有这些域名能引用本站资源。格式为a1.com|b1.com',
'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2,比private_path优先。', 'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2。',
'diskname' => '这个盘你想显示什么名称。', 'diskname' => '这个盘你想显示什么名称。',
'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。', 'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。', 'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。', 'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。',
'disableChangeTheme' => '如果为 1,则不会显示主题选择按钮', 'disableChangeTheme' => '如果为 1,则不会显示主题选择按钮',
'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
'dontBasicAuth' => '如果为 1,加密目录不再弹出用户名密码窗口,会显示主题自带的页面。', 'useBasicAuth' => '如果为 1,加密目录弹出用户名密码窗口,会显示主题自带的输入密码页面。',
'background' => '设置一个url作为背景。', 'background' => '设置一个url作为背景。',
'backgroundm' => '设置一个url作为手机端用的背景。', 'backgroundm' => '设置一个url作为手机端用的背景。',
'theme' => '选择一个主题。', 'forceHttps' => '0或1。如果设置为1,会强制跳https',
'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长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。', 'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录。',
'sitename' => '网站的名称', 'sitename' => '网站的名称',
'Onedrive_ver' => 'Onedrive版本',
], ],
'zh-tw' => [ 'zh-tw' => [
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。', 'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
@@ -150,7 +150,7 @@ $constStr = [
'customCss' => '<style>,在<head>最後面', 'customCss' => '<style>,在<head>最後面',
'customTheme' => 'html格式的主題的url', 'customTheme' => 'html格式的主題的url',
'referrer' => '', 'referrer' => '',
'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2,比private_path優先。', 'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2。',
'diskname' => '這個盤你想顯示什麼名稱。', 'diskname' => '這個盤你想顯示什麼名稱。',
'disktag' => '一個標籤,用於儲存配置,多盤時會顯示在url中。', 'disktag' => '一個標籤,用於儲存配置,多盤時會顯示在url中。',
'disableShowThumb' => '如果填 1, ‘顯示縮略’按鈕將被隱藏。', 'disableShowThumb' => '如果填 1, ‘顯示縮略’按鈕將被隱藏。',
@@ -158,15 +158,14 @@ $constStr = [
'downloadencrypt' => '0 或 1。如果 1, 那加密目錄內的文件可以不需要密碼就能下載。', 'downloadencrypt' => '0 或 1。如果 1, 那加密目錄內的文件可以不需要密碼就能下載。',
'background' => '設定一個url作為背景。', 'background' => '設定一個url作為背景。',
'backgroundm' => '設定一個url作為手機用的背景。', 'backgroundm' => '設定一個url作為手機用的背景。',
'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長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄;不能是private_path的上級(public看到的不能比private多,要麼看到的就不一樣)。', 'public_path' => '使用API長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄。',
'sitename' => '網站的名稱', 'sitename' => '網站的名稱',
'Onedrive_ver' => 'Onedrive版本',
], ],
'ja' => [ 'ja' => [
'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。', 'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
@@ -176,7 +175,7 @@ $constStr = [
'customCss' => 'style>は、<head>の一番後ろにあります。', 'customCss' => 'style>は、<head>の一番後ろにあります。',
'customTheme' => 'htmlフォーマットのテーマのurl', 'customTheme' => 'htmlフォーマットのテーマのurl',
'referrer' => '', 'referrer' => '',
'domain_path' => '複数のドメイン名を使用する場合、ドメイン名ごとに見られるディレクトリを指定します。フォーマットはa 1.com:/dirto/path 1.com:/path 2で、prvate_path優先。', 'domain_path' => '複数のドメイン名を使用する場合、ドメイン名ごとに見られるディレクトリを指定します。フォーマットはa1.com:/dirto/path1|b1.com:/path2。',
'diskname' => 'このディスクの名前を表示したいですか?', 'diskname' => 'このディスクの名前を表示したいですか?',
'disktag' => '一つのラベルは保存配置に使い、複数のディスクはurlに表示されます。', 'disktag' => '一つのラベルは保存配置に使い、複数のディスクはurlに表示されます。',
'disableShowThumb' => '1を記入すると、「表示サムネイル」ボタンが隠れます。', 'disableShowThumb' => '1を記入すると、「表示サムネイル」ボタンが隠れます。',
@@ -190,9 +189,8 @@ $constStr = [
'hideFunctionalityFile' => '0または1です。もし1ならば、いくつかの書類はリストで観光客に見せませんが、その機能は正常です。readme.md', 'hideFunctionalityFile' => '0または1です。もし1ならば、いくつかの書類はリストで観光客に見せませんが、その機能は正常です。readme.md',
'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。', 'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。',
'domainforproxy' => '会将https://xxxy-my.sharepoint.comこの値に代えて、目標には自分で反世代を設定する必要があります。に加えて&amp;Originndomain=元のドメイン名', 'domainforproxy' => '会将https://xxxy-my.sharepoint.comこの値に代えて、目標には自分で反世代を設定する必要があります。に加えて&amp;Originndomain=元のドメイン名',
'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり、private_pathの上位にはなりません(publicはprivate以上のものを見ることができません。それ以外は異なります。)。', 'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり。',
'sitename' => 'ウェブサイト名', 'sitename' => 'ウェブサイト名',
'Onedrive_ver' => 'Onedriveバージョン',
], ],
'ko-kr' => [ 'ko-kr' => [
'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.', 'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
@@ -202,7 +200,7 @@ $constStr = [
'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에', 'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
'customTheme' => 'html 형식의 테마 url', 'customTheme' => 'html 형식의 테마 url',
'referrer' => '', 'referrer' => '',
'domain_path' => '도 메 인 이름 을 여러 개 사용자 정의 할 때 도 메 인 이름 마다 보 이 는 디 렉 터 리 를 지정 합 니 다.형식 은 a1. com: / dirto / path 1 | b1. com: / path 2, privatepath 우선.', 'domain_path' => '도 메 인 이름 을 여러 개 사용자 정의 할 때 도 메 인 이름 마다 보 이 는 디 렉 터 리 를 지정 합 니 다.형식 은 a1.com:/dirto/path1|b1.com:/path2.',
'diskname' => '이 접시 에 당신 은 어떤 명칭 을 표시 하고 싶 습 니까?', 'diskname' => '이 접시 에 당신 은 어떤 명칭 을 표시 하고 싶 습 니까?',
'disktag' => '디스크가 여러 개인 경우 구성을 저장하는 데 사용되는 레이블이 url에 표시됩니다.', 'disktag' => '디스크가 여러 개인 경우 구성을 저장하는 데 사용되는 레이블이 url에 표시됩니다.',
'disableShowThumb' => '1을 입력하면 “썸네일 표시”버튼이 숨겨집니다.', 'disableShowThumb' => '1을 입력하면 “썸네일 표시”버튼이 숨겨집니다.',
@@ -218,7 +216,6 @@ $constStr = [
'domainforproxy' => 'https://xxxxx-my.sharepoint.com을이 값으로 바꾸고 대상에서 안티 생성을 설정해야합니다. & Origindomain = Original domain name 을 추가합니다.', 'domainforproxy' => 'https://xxxxx-my.sharepoint.com을이 값으로 바꾸고 대상에서 안티 생성을 설정해야합니다. & Origindomain = Original domain name 을 추가합니다.',
'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.', 'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.',
'sitename' => '웹 사이트 이름', 'sitename' => '웹 사이트 이름',
'Onedrive_ver' => 'Onedrive 버전',
], ],
'fa' => [ 'fa' => [
'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید', 'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید',
@@ -233,7 +230,6 @@ $constStr = [
'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.', 'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.',
'public_path' => 'این مسیر Onedrive را هنگامی که از طریق آدرس طولانی API Gateway استفاده می کنید ، نشان دهید. فایل های نمایش عمومی کمتر از خصوصی.', 'public_path' => 'این مسیر Onedrive را هنگامی که از طریق آدرس طولانی API Gateway استفاده می کنید ، نشان دهید. فایل های نمایش عمومی کمتر از خصوصی.',
'sitename' => 'نام سایت', 'sitename' => 'نام سایت',
'Onedrive_ver' => 'ورژن Onedrive',
], ],
'ar-sa' => [ 'ar-sa' => [
'admin' => ' إدارة كلمة السر ، لا يمكنك عرض صفحة تسجيل الدخول دون إضافة', 'admin' => ' إدارة كلمة السر ، لا يمكنك عرض صفحة تسجيل الدخول دون إضافة',
@@ -259,7 +255,6 @@ $constStr = [
'domainforproxy' => 'سوف لا شيء استبدال هذه القيمة ، تحتاج إلى تعيين جيل معاكس في الهدف الخاص بك إضافة اسم النطاق الأصلي', 'domainforproxy' => 'سوف لا شيء استبدال هذه القيمة ، تحتاج إلى تعيين جيل معاكس في الهدف الخاص بك إضافة اسم النطاق الأصلي',
'public_path' => 'عند استخدام API وصلة طويلة للوصول إلى عرض مسار الملف على القرص ، إذا لم يتم تعيين الافتراضي هو الجذر ، لا يمكن أن يكون private ش لا يمكن أن نرى أكثر من private publics ، أو لا', 'public_path' => 'عند استخدام API وصلة طويلة للوصول إلى عرض مسار الملف على القرص ، إذا لم يتم تعيين الافتراضي هو الجذر ، لا يمكن أن يكون private ش لا يمكن أن نرى أكثر من private publics ، أو لا',
'sitename' => 'اسم الموقع', 'sitename' => 'اسم الموقع',
'Onedrive_ver' => 'أوندريف',
], ],
], ],
'SetSecretsFirst' => [ 'SetSecretsFirst' => [
@@ -1077,11 +1072,11 @@ $constStr = [
'ar-sa' => 'أكد بي إتش بي قابل للكتابة', 'ar-sa' => 'أكد بي إتش بي قابل للكتابة',
], ],
'MakesuerRewriteOn' => [ 'MakesuerRewriteOn' => [
'en-us' => 'Plase make sure the RewriteEngine is On.', 'en-us' => 'Plase make sure the RewriteEngine is On',
'zh-cn' => '确认重写(伪静态)功能启用', 'zh-cn' => '确认重写(伪静态)功能启用',
'zh-tw' => '確認重寫(偽靜態)功能啟用', 'zh-tw' => '確認重寫(偽靜態)功能啟用',
'ja' => '書き換え(擬似静的)機能が有効になっていることを確認します', 'ja' => '書き換え(擬似静的)機能が有効になっていることを確認します',
'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.', 'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오',
'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.', 'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.',
'ar-sa' => 'يؤكد أن الكتابة يمكن أن تكون وظيفة شبه استاتي', 'ar-sa' => 'يؤكد أن الكتابة يمكن أن تكون وظيفة شبه استاتي',
], ],
+49 -15
View File
@@ -76,7 +76,7 @@ class Aliyundrive {
$tmp['list'][$filename]['name'] = $file['name']; $tmp['list'][$filename]['name'] = $file['name'];
$tmp['list'][$filename]['time'] = $file['updated_at']; $tmp['list'][$filename]['time'] = $file['updated_at'];
$tmp['list'][$filename]['size'] = $file['size']; $tmp['list'][$filename]['size'] = $file['size'];
$tmp['childcount']++; //$tmp['childcount']++;
} }
} elseif (isset($files['code'])||isset($files['error'])) { } elseif (isset($files['code'])||isset($files['error'])) {
return $files; return $files;
@@ -90,8 +90,6 @@ class Aliyundrive {
global $exts; global $exts;
while (substr($path, -1)=='/') $path = substr($path, 0, -1); while (substr($path, -1)=='/') $path = substr($path, 0, -1);
if ($path == '') $path = '/'; if ($path == '') $path = '/';
//$files = getcache('path_' . $path, $this->disktag);
//if (!$files) {
if (!($files = getcache('path_' . $path, $this->disktag))) { if (!($files = getcache('path_' . $path, $this->disktag))) {
if ($path == '/' || $path == '') { if ($path == '/' || $path == '') {
$files = $this->fileList('root'); $files = $this->fileList('root');
@@ -113,22 +111,33 @@ class Aliyundrive {
$files['time'] = $item['updated_at']; $files['time'] = $item['updated_at'];
$files['size'] = $item['size']; $files['size'] = $item['size'];
} else $files = $item; } else $files = $item;
} }
} }
//echo $files['name']; //echo $files['name'];
} }
if ($files['type']=='file') { if ($files['type']=='file') {
if (in_array(splitlast($files['name'],'.')[1], $exts['txt'])) { if (in_array(strtolower(splitlast($files['name'],'.')[1]), $exts['txt'])) {
if ($files['size']<1024*1024) {
if (!(isset($files['content'])&&$files['content']['stat']==200)) { if (!(isset($files['content'])&&$files['content']['stat']==200)) {
$header['Referer'] = 'https://www.aliyundrive.com/'; $header['Referer'] = 'https://www.aliyundrive.com/';
$header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'; $header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36';
$content1 = curl('GET', $files['download_url'], '', $header); $content1 = curl('GET', $files['download_url'], '', $header);
$tmp = null;
$tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) {
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
$tmp = json_decode(json_encode($tmp), true);
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
}
//error_log1('body : ' . $content1['body'] . PHP_EOL);
$files['content'] = $content1; $files['content'] = $content1;
savecache('path_' . $path, $files, $this->disktag); savecache('path_' . $path, $files, $this->disktag);
} }
error_log1($files['name'] . ' : ' . json_encode($files['content']) . PHP_EOL); } else {
$files['content']['stat'] = 202;
$files['content']['body'] = 'File too large.';
}
//error_log1($files['name'] . ' : ' . json_encode($files['content']) . PHP_EOL);
} }
} }
if (!$files) { if (!$files) {
@@ -177,8 +186,8 @@ class Aliyundrive {
$header["content-type"] = "application/json; charset=utf-8"; $header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token; $header['authorization'] = 'Bearer ' . $this->access_token;
$data['limit'] = 50; $data['limit'] = 200;
$data['marker'] = NULL; $data['marker'] = null;
$data['drive_id'] = $this->driveId; $data['drive_id'] = $this->driveId;
$data['parent_file_id'] = $parent_file_id; $data['parent_file_id'] = $parent_file_id;
$data['image_thumbnail_process'] = 'image/resize,w_160/format,jpeg'; $data['image_thumbnail_process'] = 'image/resize,w_160/format,jpeg';
@@ -190,7 +199,19 @@ class Aliyundrive {
$res = curl('POST', $url, json_encode($data), $header); $res = curl('POST', $url, json_encode($data), $header);
//error_log1($res['stat'] . $res['body']); //error_log1($res['stat'] . $res['body']);
if ($res['stat']==200) return json_decode($res['body'], true); if ($res['stat']==200) {
$body = json_decode($res['body'], true);
$body1 = $body;
while ($body1['next_marker']!='') {
$data['marker'] = $body1['next_marker'];
$res1 = null;
$res1 = curl('POST', $url, json_encode($data), $header);
$body1 = json_decode($res1['body'], true);
$body['items'] = array_merge($body['items'], $body1['items']);
}
return $body;
//return json_decode($res['body'], true);
}
else return $res; else return $res;
} }
@@ -608,8 +629,19 @@ class Aliyundrive {
$title = 'Error'; $title = 'Error';
return message($html, $title, 201); return message($html, $title, 201);
} else { } else {
$str .= '<meta http-equiv="refresh" content="5;URL=' . $url . '">'; $str .= '
return message($str, getconstStr('WaitJumpIndex'), 201); <script>
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(min++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
}
}, 1000);
</script>';
return message($str, getconstStr('WaitJumpIndex'), 201, 1);
} }
} }
if (isset($_GET['SelectDrive'])) { if (isset($_GET['SelectDrive'])) {
@@ -670,6 +702,7 @@ class Aliyundrive {
</form> </form>
</div> </div>
<script> <script>
var status = "' . $response['status'] . '";
function notnull(t) function notnull(t)
{ {
if (t.driveId.value==\'\') { if (t.driveId.value==\'\') {
@@ -680,7 +713,7 @@ class Aliyundrive {
} }
</script> </script>
'; ';
return message($html, $title, 201); return message($html, $title, 201, 1);
} }
if (isset($_GET['install0']) && $_POST['disktag_add']!='') { if (isset($_GET['install0']) && $_POST['disktag_add']!='') {
$_POST['disktag_add'] = preg_replace('/[^0-9a-zA-Z|_]/i', '', $_POST['disktag_add']); $_POST['disktag_add'] = preg_replace('/[^0-9a-zA-Z|_]/i', '', $_POST['disktag_add']);
@@ -716,7 +749,7 @@ class Aliyundrive {
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
$title = 'Error'; $title = 'Error';
return message($html, $title, 201); return message($html, $title, 400);
} else { } else {
$title = 'Refresh token'; $title = 'Refresh token';
$html = ' $html = '
@@ -735,9 +768,10 @@ class Aliyundrive {
} }
return true; return true;
} }
var status = "' . $response['status'] . '";
</script> </script>
'; ';
return message($html, $title, 201); return message($html, $title, 201, 1);
} }
} }
+13 -1
View File
@@ -128,7 +128,8 @@ class Googledrive {
//$this->permission('delete', $files['id']); //$this->permission('delete', $files['id']);
//if (isset($item['mimeType']) && $item['mimeType']!='application/vnd.google-apps.folder') { //if (isset($item['mimeType']) && $item['mimeType']!='application/vnd.google-apps.folder') {
if (in_array(splitlast($item['name'],'.')[1], $exts['txt'])) { if (in_array(strtolower(splitlast($item['name'],'.')[1]), $exts['txt'])) {
if ($files['size']<1024*1024) {
if (!(isset($item['content'])&&$item['content']['stat']==200)) { if (!(isset($item['content'])&&$item['content']['stat']==200)) {
//if (!isset($item['downUrl'])) { //if (!isset($item['downUrl'])) {
$res = curl('GET', $item['webContentLink'], '', [], 1); $res = curl('GET', $item['webContentLink'], '', [], 1);
@@ -138,12 +139,23 @@ class Googledrive {
//} //}
if ($res['stat']==302) { if ($res['stat']==302) {
$content1 = curl('GET', $weblink, '', ["User-Agent"=>"qkqpttgf/OneManager 3.0.0", "Accept"=>"*/*"]); $content1 = curl('GET', $weblink, '', ["User-Agent"=>"qkqpttgf/OneManager 3.0.0", "Accept"=>"*/*"]);
$tmp = null;
$tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) {
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
$tmp = json_decode(json_encode($tmp), true);
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
}
$item['content'] = $content1; $item['content'] = $content1;
}// else $content1 = $res; }// else $content1 = $res;
//error_log1($item['name'] . '~' . json_encode($content1, JSON_PRETTY_PRINT) . PHP_EOL); //error_log1($item['name'] . '~' . json_encode($content1, JSON_PRETTY_PRINT) . PHP_EOL);
$parent_folder['files'][$i] = $item; $parent_folder['files'][$i] = $item;
savecache('path_' . $path, $parent_folder, $this->disktag); savecache('path_' . $path, $parent_folder, $this->disktag);
} }
} else {
$files['content']['stat'] = 202;
$files['content']['body'] = 'File too large.';
}
} }
//} //}
+85 -31
View File
@@ -52,7 +52,7 @@ class Onedrive {
$pos = splitlast($path, '/'); $pos = splitlast($path, '/');
$parentpath = $pos[0]; $parentpath = $pos[0];
if ($parentpath=='') $parentpath = '/'; if ($parentpath=='') $parentpath = '/';
$filename = $pos[1]; $filename = strtolower($pos[1]);
if ($parentfiles = getcache('path_' . $parentpath, $this->disktag)) { if ($parentfiles = getcache('path_' . $parentpath, $this->disktag)) {
if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) { if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) { if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
@@ -93,19 +93,31 @@ class Onedrive {
} }
} else { } else {
// files num < 200 , then cache // files num < 200 , then cache
//if (isset($files['children'])) { if (isset($files['children'])) {
//$files['children'] = children_name($files['children']); $files['children'] = children_name($files['children']);
//} }
savecache('path_' . $path, $files, $this->disktag); savecache('path_' . $path, $files, $this->disktag);
} }
} }
if (isset($files['file'])) { if (isset($files['file'])) {
if (in_array(splitlast($files['name'],'.')[1], $exts['txt'])) { if (in_array(strtolower(splitlast($files['name'],'.')[1]), $exts['txt'])) {
if ($files['size']<1024*1024) {
if (!(isset($files['content'])&&$files['content']['stat']==200)) { if (!(isset($files['content'])&&$files['content']['stat']==200)) {
$content1 = curl('GET', $files[$this->DownurlStrName]); $content1 = curl('GET', $files[$this->DownurlStrName]);
$tmp = null;
$tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) {
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
$tmp = json_decode(json_encode($tmp), true);
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
}
$files['content'] = $content1; $files['content'] = $content1;
savecache('path_' . $path, $files, $this->disktag); savecache('path_' . $path, $files, $this->disktag);
} }
} else {
$files['content']['stat'] = 202;
$files['content']['body'] = 'File too large.';
}
} }
} }
if (isset($files['error'])) { if (isset($files['error'])) {
@@ -330,7 +342,8 @@ class Onedrive {
$oldname = path_format($file['path'] . '/' . $oldname); $oldname = path_format($file['path'] . '/' . $oldname);
$data = '{"name":"' . $newname . '"}'; $data = '{"name":"' . $newname . '"}';
//echo $oldname; //echo $oldname;
$result = $this->MSAPI('PATCH', $oldname, $data); if ($file['id']) $result = $this->MSAPI('PATCH', "/items/" . $file['id'], $data);
else $result = $this->MSAPI('PATCH', $oldname, $data);
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 Delete($file) { public function Delete($file) {
@@ -338,8 +351,9 @@ class Onedrive {
$filename = path_format($file['path'] . '/' . $filename); $filename = path_format($file['path'] . '/' . $filename);
//echo $filename; //echo $filename;
$result = $this->MSAPI('DELETE', $filename); $result = $this->MSAPI('DELETE', $filename);
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']); if ($result['stat']!=204) $r_body = json_encode($this->files_format(json_decode($result['body'], true)));
return output($result['body'], $result['stat']); return output($r_body, $result['stat']);
//return output($result['body'], $result['stat']);
} }
public function Encrypt($folder, $passfilename, $pass) { public function Encrypt($folder, $passfilename, $pass) {
$filename = path_format($folder['path'] . '/' . urlencode($passfilename)); $filename = path_format($folder['path'] . '/' . urlencode($passfilename));
@@ -352,7 +366,7 @@ class Onedrive {
if ($path1!='/'&&substr($path1, -1)=='/') $path1 = substr($path1, 0, -1); if ($path1!='/'&&substr($path1, -1)=='/') $path1 = substr($path1, 0, -1);
savecache('path_' . $path1 . '/?password', '', $this->disktag, 1); savecache('path_' . $path1 . '/?password', '', $this->disktag, 1);
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']);
return output($result['body'], $result['stat']); //return output($result['body'], $result['stat']);
} }
public function Move($file, $folder) { public function Move($file, $folder) {
$filename = spurlencode($file['name']); $filename = spurlencode($file['name']);
@@ -363,7 +377,7 @@ class Onedrive {
if ($path2!='/'&&substr($path2, -1)=='/') $path2 = substr($path2, 0, -1); if ($path2!='/'&&substr($path2, -1)=='/') $path2 = substr($path2, 0, -1);
savecache('path_' . $path2, json_decode('{}', true), $this->disktag, 1); savecache('path_' . $path2, json_decode('{}', true), $this->disktag, 1);
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']);
return output($result['body'], $result['stat']); //return output($result['body'], $result['stat']);
} }
public function Copy($file) { public function Copy($file) {
$filename = spurlencode($file['name']); $filename = spurlencode($file['name']);
@@ -392,7 +406,7 @@ class Onedrive {
$result = $this->MSAPI('copy', $filename, $data); $result = $this->MSAPI('copy', $filename, $data);
}*/ }*/
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']);
return output($result['body'], $result['stat']); //return output($result['body'], $result['stat']);
} }
public function Edit($file, $content) { public function Edit($file, $content) {
/*TXT一般不会超过4M,不用二段上传 /*TXT一般不会超过4M,不用二段上传
@@ -419,7 +433,7 @@ class Onedrive {
} }
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1); //savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
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']);
return output($result['body'], $result['stat']); //return output($result['body'], $result['stat']);
} }
public function AddDisk() { public function AddDisk() {
@@ -444,6 +458,7 @@ class Onedrive {
} }
$tmp = null; $tmp = null;
$tmp['Driver'] = get_class($this);
if ($_POST['DriveType']=='Onedrive') { if ($_POST['DriveType']=='Onedrive') {
/*$api = $this->api_url . '/me'; /*$api = $this->api_url . '/me';
$arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ], 1); $arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ], 1);
@@ -489,14 +504,23 @@ class Onedrive {
$title = 'Error'; $title = 'Error';
return message($html, $title, 201); return message($html, $title, 201);
} else { } else {
$str .= '<meta http-equiv="refresh" content="5;URL=' . $url . '"> $html .= '<script>
<script>
var expd = new Date(); var expd = new Date();
expd.setTime(expd.getTime()+1); expd.setTime(expd.getTime()+1);
var expires = "expires="+expd.toGMTString(); var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires; document.cookie=\'disktag=; path=/; \'+expires;
var i = 0;
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
}
}, 1000);
</script>'; </script>';
return message($str, getconstStr('WaitJumpIndex'), 201); return message($html, getconstStr('WaitJumpIndex'), 201, 1);
} }
} }
@@ -592,9 +616,19 @@ class Onedrive {
return message($html, $title, 201); return message($html, $title, 201);
} else { } else {
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60); savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
$str .= ' $html .= '<script>
<meta http-equiv="refresh" content="3;URL=' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive">'; var i = 0;
return message($str, getconstStr('Wait') . ' 3s', 201); var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
}
}, 1000);
</script>';
return message($html, getconstStr('Wait') . ' 3s', 201, 1);
} }
} }
return message('<pre>' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '</pre>', $tmp['stat']); return message('<pre>' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '</pre>', $tmp['stat']);
@@ -624,7 +658,7 @@ class Onedrive {
$f = substr($_POST['disktag_add'], 0, 1); $f = substr($_POST['disktag_add'], 0, 1);
if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_'; if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_';
if (isCommonEnv($_POST['disktag_add'])) { if (isCommonEnv($_POST['disktag_add'])) {
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 201); return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 400);
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) { } elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button> return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
<script> <script>
@@ -632,7 +666,7 @@ class Onedrive {
expd.setTime(expd.getTime()+1); expd.setTime(expd.getTime()+1);
var expires = "expires="+expd.toGMTString(); var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires; document.cookie=\'disktag=; path=/; \'+expires;
</script>', 'Error', 201); </script>', 'Error', 400);
} }
$tmp = null; $tmp = null;
@@ -658,12 +692,26 @@ class Onedrive {
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
$title = 'Error'; $title = 'Error';
return message($html, $title, 400);
} else { } else {
$title = getconstStr('MayinEnv'); $title = getconstStr('MayinEnv');
$html = getconstStr('Wait') . ' 3s<meta http-equiv="refresh" content="3;URL=' . $url . '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'] . '">'; $html = getconstStr('Wait');
if ($_POST['Drive_ver']=='Sharelink') $html = getconstStr('Wait') . ' 3s<meta http-equiv="refresh" content="3;URL=' . $url . '">'; if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
$html .= '<script>
var i = 0;
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
} }
return message($html, $title, 201); }, 1000);
</script>';
return message($html, $title, 201, 1);
}
} }
} }
@@ -806,8 +854,9 @@ class Onedrive {
$sharepointname = $tmp[1]; $sharepointname = $tmp[1];
} }
$tmp = splitlast($tmp[0], '/'); $tmp = splitlast($tmp[0], '/');
if (getConfig('Driver', $this->disktag)=='Onedrive') $url = 'https://graph.microsoft.com/v1.0/sites/root:/' . $tmp[1] . '/' . $sharepointname; //if (getConfig('Driver', $this->disktag)=='Onedrive') $url = 'https://graph.microsoft.com/v1.0/sites/root:/' . $tmp[1] . '/' . $sharepointname;
if (getConfig('Driver', $this->disktag)=='OnedriveCN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/' . $tmp[1] . '/' . $sharepointname; //if (getConfig('Driver', $this->disktag)=='OnedriveCN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/' . $tmp[1] . '/' . $sharepointname;
$url = $this->api_url . '/sites/root:/' . $tmp[1] . '/' . $sharepointname;
$i=0; $i=0;
$response = []; $response = [];
@@ -885,8 +934,8 @@ class Onedrive {
if ($fileinfo['size']>10*1024*1024) { if ($fileinfo['size']>10*1024*1024) {
$cachefilename = spurlencode( $fileinfo['path'] . '/.' . $fileinfo['filelastModified'] . '_' . $fileinfo['size'] . '_' . $fileinfo['name'] . '.tmp', '/'); $cachefilename = spurlencode( $fileinfo['path'] . '/.' . $fileinfo['filelastModified'] . '_' . $fileinfo['size'] . '_' . $fileinfo['name'] . '.tmp', '/');
$getoldupinfo = $this->list_files(path_format($path . '/' . $cachefilename)); $getoldupinfo = $this->list_files(path_format($path . '/' . $cachefilename));
//echo json_encode($getoldupinfo, JSON_PRETTY_PRINT); //error_log1(json_encode($getoldupinfo, JSON_PRETTY_PRINT));
if (isset($getoldupinfo['file'])&&$getoldupinfo['size']<5120) { if (isset($getoldupinfo['url'])&&$getoldupinfo['size']<5120) {
$getoldupinfo_j = curl('GET', $getoldupinfo['url']); $getoldupinfo_j = curl('GET', $getoldupinfo['url']);
$getoldupinfo = json_decode($getoldupinfo_j['body'], true); $getoldupinfo = json_decode($getoldupinfo_j['body'], true);
if ( json_decode( curl('GET', $getoldupinfo['uploadUrl'])['body'], true)['@odata.context']!='' ) return output($getoldupinfo_j['body'], $getoldupinfo_j['stat']); if ( json_decode( curl('GET', $getoldupinfo['uploadUrl'])['body'], true)['@odata.context']!='' ) return output($getoldupinfo_j['body'], $getoldupinfo_j['stat']);
@@ -915,7 +964,7 @@ class Onedrive {
return $diskSpace; return $diskSpace;
} }
protected function MSAPI($method, $path, $data = '') protected function MSAPI($method, $path, $data = '', $headers = [])
{ {
$activeLimit = getConfig('activeLimit', $this->disktag); $activeLimit = getConfig('activeLimit', $this->disktag);
if ($activeLimit!='') { if ($activeLimit!='') {
@@ -933,11 +982,16 @@ class Onedrive {
$url = $this->api_url . $this->ext_api_url; $url = $this->api_url . $this->ext_api_url;
if ($path=='' or $path=='/') { if ($path=='' or $path=='/') {
$url .= '/'; $url .= '/';
} elseif (substr($path, 0, 6)=="/items") {
$url = substr($url, 0, -5);
$url .= $path;
} else { } else {
$url .= ':' . $path; $url .= ':' . $path;
if (substr($url,-1)=='/') $url=substr($url,0,-1); if (substr($url,-1)=='/') $url=substr($url,0,-1);
} }
if ($method=='PUT') { if ($method=='GET') {
$method = 'GET'; // do nothing
} elseif ($method=='PUT') {
if ($path=='' or $path=='/') { if ($path=='' or $path=='/') {
$url .= 'content'; $url .= 'content';
} else { } else {
@@ -997,10 +1051,10 @@ class Onedrive {
} }
} }
curl_close($ch); curl_close($ch);
error_log1($response['stat'].' /*error_log1($response['stat'].'
'.$response['body'].' '.$response['body'].'
'.$url.' '.$url.'
'); ');*/
return $response; return $response;
} }
+14
View File
@@ -6,6 +6,7 @@ include 'conststr.php';
include 'common.php'; include 'common.php';
//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>';
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';
@@ -30,6 +31,19 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
} }
http_response_code($re['statusCode']); http_response_code($re['statusCode']);
echo $re['body']; echo $re['body'];
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
include 'platform/Vercel.php';
$path = getpath();
//echo 'path:'. $path;
$_GET = getGET();
//echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
$re = main($path);
$sendHeaders = array();
foreach ($re['headers'] as $headerName => $headerVal) {
header($headerName . ': ' . $headerVal, true);
}
http_response_code($re['statusCode']);
echo $re['body'];
} else { } else {
include 'platform/Normal.php'; include 'platform/Normal.php';
$path = getpath(); $path = getpath();
+6 -3
View File
@@ -43,12 +43,12 @@ function GetPathSetting($event, $context)
if ($path=='/'||$path=='') { if ($path=='/'||$path=='') {
$_SERVER['base_path'] = $tmp; $_SERVER['base_path'] = $tmp;
} else { } else {
$_SERVER['base_path'] = substr($tmp, 0, -strlen($path)+1); $_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1);
} }
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['clientIP']; $_SERVER['REMOTE_ADDR'] = $event['clientIP'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0]; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0];
if (isset($event['headers']['Authorization'])) { if (isset($event['headers']['Authorization'])) {
@@ -59,7 +59,6 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_HOST'] = $event['headers']['Host'][0]; $_SERVER['HTTP_HOST'] = $event['headers']['Host'][0];
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0]; $_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
//if ($_SERVER['HTTP_REFERER']!='')
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2'; $_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
return $path; return $path;
@@ -498,3 +497,7 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
} }
return true; return true;
} }
function WaitFunction() {
return true;
}
+6 -3
View File
@@ -36,7 +36,7 @@ function GetPathSetting($event, $context)
$path = $event['path']; $path = $event['path'];
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'];
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['User-Agent']; $_SERVER['HTTP_USER_AGENT'] = $event['headers']['User-Agent'];
@@ -48,7 +48,6 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_HOST'] = $event['headers']['Host']; $_SERVER['HTTP_HOST'] = $event['headers']['Host'];
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto']; $_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
//if ($_SERVER['HTTP_REFERER']!='')
$_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['BCE_CFC_RUNTIME_NAME'] = 'php7'; $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
@@ -364,7 +363,7 @@ function api_error_msg($response)
{ {
if (isset($response['code'])) $html = $response['code'] . '<br> if (isset($response['code'])) $html = $response['code'] . '<br>
' . $response['message']; ' . $response['message'];
else $html = var_dump($response); else $html = json_encode($response, JSON_PRETTY_PRINT);
return $html . '<br><br> return $html . '<br><br>
BRN: ' . $_SERVER['functionBrn'] . '<br> BRN: ' . $_SERVER['functionBrn'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>'; <button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
@@ -432,3 +431,7 @@ function addFileToZip($zip, $rootpath, $path = '')
} }
@closedir($path); @closedir($path);
} }
function WaitFunction() {
return true;
}
+6 -1
View File
@@ -1,4 +1,5 @@
<?php <?php
// https://devcenter.heroku.com/articles/platform-api-reference#build-create
function getpath() function getpath()
{ {
@@ -103,7 +104,7 @@ function setConfig($arr, $disktag = '')
{ {
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
$disktags = explode("|",getConfig('disktag')); $disktags = explode("|",getConfig('disktag'));
$diskconfig = json_decode(getenv($disktag), true); if ($disktag!='') $diskconfig = json_decode(getenv($disktag), true);
$tmp = []; $tmp = [];
$indisk = 0; $indisk = 0;
$operatedisk = 0; $operatedisk = 0;
@@ -339,3 +340,7 @@ function setConfigResponse($response)
{ {
return json_decode( $response['body'], true ); return json_decode( $response['body'], true );
} }
function WaitFunction() {
return true;
}
+5 -2
View File
@@ -58,7 +58,7 @@ function GetPathSetting($event, $context)
} }
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent']; $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
@@ -69,7 +69,6 @@ function GetPathSetting($event, $context)
} }
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; $_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
//if ($_SERVER['HTTP_REFERER']!='')
$_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['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
@@ -488,3 +487,7 @@ function addFileToZip($zip, $rootpath, $path = '')
} }
@closedir($path); @closedir($path);
} }
function WaitFunction() {
return true;
}
+5 -2
View File
@@ -58,7 +58,7 @@ function GetPathSetting($event, $context)
} }
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent']; $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
@@ -69,7 +69,6 @@ function GetPathSetting($event, $context)
} }
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; $_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
//if ($_SERVER['HTTP_REFERER']!='')
$_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['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
@@ -869,3 +868,7 @@ class Signer
return $curl; return $curl;
} }
} }
function WaitFunction() {
return true;
}
+14 -3
View File
@@ -4,8 +4,15 @@ function getpath()
{ {
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]); $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
}
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
}
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
//if ($_SERVER['HTTP_REFERER']!='')
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2]; $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/'; if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/';
else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/'); else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
@@ -227,7 +234,7 @@ function install()
url += location.pathname; url += location.pathname;
if (url.substr(-1)!="/") url += "/"; if (url.substr(-1)!="/") url += "/";
url += "app.json"; url += "app.json";
//alert(url); url += "?" + Date.now();
var xhr4 = new XMLHttpRequest(); var xhr4 = new XMLHttpRequest();
xhr4.open("GET", url); xhr4.open("GET", url);
xhr4.setRequestHeader("x-requested-with","XMLHttpRequest"); xhr4.setRequestHeader("x-requested-with","XMLHttpRequest");
@@ -239,7 +246,7 @@ function install()
document.getElementById("submitbtn").disabled = false; document.getElementById("submitbtn").disabled = false;
document.getElementById("formdiv").style.display = ""; document.getElementById("formdiv").style.display = "";
} else { } else {
alert("Url: " + url + "\nExpect http code 201, but received " + xhr4.status); alert("' . getconstStr('MakesuerRewriteOn') . '?\nfalse\n\nUrl: " + url + "\nExpect http code 201, but received " + xhr4.status);
} }
} }
} }
@@ -378,3 +385,7 @@ function moveFolder($from, $to, $slash)
rmdir($from); rmdir($from);
return json_encode( [ 'response' => 'success' ] ); return json_encode( [ 'response' => 'success' ] );
} }
function WaitFunction() {
return true;
}
+155 -13
View File
@@ -43,7 +43,7 @@ function GetPathSetting($event, $context)
} }
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent']; $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
@@ -52,7 +52,8 @@ function GetPathSetting($event, $context)
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0]; $_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1]; $_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
} }
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; $_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
@@ -370,9 +371,6 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
{ {
//echo json_encode($Envs,JSON_PRETTY_PRINT); //echo json_encode($Envs,JSON_PRETTY_PRINT);
if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $Envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' ); if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $Envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' );
/*$trynum = 0;
while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
'.++$trynum;*/
//json_decode($a,true)['Response']['Environment']['Variables'][0]['Key'] //json_decode($a,true)['Response']['Environment']['Variables'][0]['Key']
$tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables']; $tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
foreach ($tmp as $tmp1) { foreach ($tmp as $tmp1) {
@@ -412,7 +410,7 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr)); return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
} }
function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source) function updateProgram_OLD($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
{ {
WaitSCFStat(); WaitSCFStat();
$meth = 'POST'; $meth = 'POST';
@@ -451,14 +449,158 @@ namespace:' . $_SERVER['namespace'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>'; <button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
} }
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
{
$source['url'] = 'https://github.com/' . $auth . '/' . $project;
$source['branch'] = $branch;
return updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'), $source);
}
function setConfigResponse($response) function setConfigResponse($response)
{ {
return json_decode( $response, true )['Response']; return json_decode( $response, true )['Response'];
} }
function WaitFunction() {
//$trynum = 0;
//while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
//'.++$trynum;
if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
else return false;
}
function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
{
$secretId = $SecretId;
$secretKey = $SecretKey;
$host = 'scf.tencentcloudapi.com';
$service = "scf";
$version = "2018-04-16";
$action = "UpdateFunctionCode";
$region = $Region;
$timestamp = time();
$algorithm = "TC3-HMAC-SHA256";
// step 1: build canonical request string
$httpRequestMethod = "POST";
$canonicalUri = "/";
$canonicalQueryString = "";
$canonicalHeaders = "content-type:application/json; charset=utf-8\n"."host:".$host."\n";
$signedHeaders = "content-type;host";
//$tmpdata['Action'] = 'UpdateFunctionCode';
$tmpdata['Code']['ZipFile'] = base64_encode( file_get_contents($source) );
$tmpdata['CodeSource'] = 'ZipFile';
$tmpdata['FunctionName'] = $function_name;
$tmpdata['Handler'] = 'index.main_handler';
//$tmpdata['Namespace'] = $Namespace;
//$tmpdata['Nonce'] = time();
//$tmpdata['Region'] = $Region;
//$tmpdata['SecretId'] = $SecretId;
//$tmpdata['Timestamp'] = time();
//$tmpdata['Token'] = '';
//$tmpdata['Version'] = '2018-04-16';
$payload = json_encode($tmpdata);
//$payload = '{"Limit": 1, "Filters": [{"Values": ["\u672a\u547d\u540d"], "Name": "instance-name"}]}';
$hashedRequestPayload = hash("SHA256", $payload);
$canonicalRequest = $httpRequestMethod."\n"
.$canonicalUri."\n"
.$canonicalQueryString."\n"
.$canonicalHeaders."\n"
.$signedHeaders."\n"
.$hashedRequestPayload;
//echo $canonicalRequest.PHP_EOL;
// step 2: build string to sign
$date = gmdate("Y-m-d", $timestamp);
$credentialScope = $date."/".$service."/tc3_request";
$hashedCanonicalRequest = hash("SHA256", $canonicalRequest);
$stringToSign = $algorithm."\n"
.$timestamp."\n"
.$credentialScope."\n"
.$hashedCanonicalRequest;
//echo $stringToSign.PHP_EOL;
// step 3: sign string
$secretDate = hash_hmac("SHA256", $date, "TC3".$secretKey, true);
$secretService = hash_hmac("SHA256", $service, $secretDate, true);
$secretSigning = hash_hmac("SHA256", "tc3_request", $secretService, true);
$signature = hash_hmac("SHA256", $stringToSign, $secretSigning);
//echo $signature.PHP_EOL;
// step 4: build authorization
$authorization = $algorithm
." Credential=".$secretId."/".$credentialScope
.", SignedHeaders=content-type;host, Signature=".$signature;
//echo $authorization.PHP_EOL;
//$curl = "curl -X POST https://".$host
// .' -H "Authorization: '.$authorization.'"'
// .' -H "Content-Type: application/json; charset=utf-8"'
// .' -H "Host: '.$host.'"'
// .' -H "X-TC-Action: '.$action.'"'
// .' -H "X-TC-Timestamp: '.$timestamp.'"'
// .' -H "X-TC-Version: '.$version.'"'
// .' -H "X-TC-Region: '.$region.'"'
// ." -d '".$payload."'";
//error_log1( $curl.PHP_EOL );
//return '{"response": {"Error": {"Message":"' . $curl . '"}}}';
$headers['Authorization'] = $authorization;
$headers['Content-Type'] = 'application/json; charset=utf-8';
$headers['Host'] = $host;
$headers['X-TC-Action'] = $action;
$headers['X-TC-Timestamp'] = $timestamp;
$headers['X-TC-Version'] = $version;
$headers['X-TC-Region'] = $region;
return curl('POST', 'https://'.$host, $payload, $headers)['body'];
}
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
$html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
// 获取包中目录名
$tmp = scandir('phar://'.$tarfile);
$name = $auth.'-'.$project;
foreach ($tmp as $f) {
if ( substr($f, 0, strlen($name)) == $name) {
$outPath .= $f;
break;
}
}
// 放入配置文件
file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
// 将目录中文件打包成zip
//$zip=new ZipArchive();
$zip=new PharData($source);
//if($zip->open($source, ZipArchive::CREATE)){
addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
// $zip->close(); //关闭处理的zip文件
//}
return updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'), $source);
}
function addFileToZip($zip, $rootpath, $path = '')
{
if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
if (substr($path,0,1)=='/') $path = substr($path, 1);
$handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
while($filename=readdir($handler)){
if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
$nowname = path_format($rootpath.'/'.$path."/".$filename);
if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
$zip->addEmptyDir($path."/".$filename);
addFileToZip($zip, $rootpath, $path."/".$filename);
}else{ //将文件加入zip对象
$newname = $path."/".$filename;
if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
$zip->addFile($nowname, $newname);
//$zip->renameName($nowname, $newname);
}
}
}
@closedir($path);
}
+8 -2
View File
@@ -43,7 +43,7 @@ function GetPathSetting($event, $context)
} }
if (substr($path,-1)=='/') $path=substr($path,0,-1); if (substr($path,-1)=='/') $path=substr($path,0,-1);
$_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent']; $_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
@@ -52,7 +52,8 @@ function GetPathSetting($event, $context)
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0]; $_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1]; $_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
} }
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto']; $_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
@@ -644,3 +645,8 @@ function addFileToZip($zip, $rootpath, $path = '')
} }
@closedir($path); @closedir($path);
} }
function WaitFunction() {
if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
else return false;
}
+446
View File
@@ -0,0 +1,446 @@
<?php
// https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment
function getpath()
{
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
}
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
}
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
$_SERVER['base_path'] = "/";
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
$p = strpos($_SERVER['REQUEST_URI'],'?');
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
return $path;
}
function getGET()
{
if (!$_POST) {
if (!!$HTTP_RAW_POST_DATA) {
$tmpdata = $HTTP_RAW_POST_DATA;
} else {
$tmpdata = file_get_contents('php://input');
}
if (!!$tmpdata) {
$postbody = explode("&", $tmpdata);
foreach ($postbody as $postvalues) {
$pos = strpos($postvalues,"=");
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
}
}
}
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
$p = strpos($_SERVER['REQUEST_URI'],'?');
if ($p>0) {
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
$getstrarr = explode("&",$getstr);
foreach ($getstrarr as $getvalues) {
if ($getvalues != '') {
$pos = strpos($getvalues, "=");
//echo $pos;
if ($pos > 0) {
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
} else {
$getarry[urldecode($getvalues)] = true;
}
}
}
}
if (isset($getarry)) {
return $getarry;
} else {
return [];
}
}
function getConfig($str, $disktag = '')
{
if (isInnerEnv($str)) {
if ($disktag=='') $disktag = $_SERVER['disktag'];
$tmp = getenv($disktag);
if (is_array($tmp)) $env = $tmp;
else $env = json_decode($tmp, true);
if (isset($env[$str])) {
if (isBase64Env($str)) return base64y_decode($env[$str]);
else return $env[$str];
}
} else {
if (isBase64Env($str)) return base64y_decode(getenv($str));
else return getenv($str);
}
return '';
}
function setConfig($arr, $disktag = '')
{
if ($disktag=='') $disktag = $_SERVER['disktag'];
$disktags = explode("|", getenv('disktag'));
if ($disktag!='') {
$tmp = getenv($disktag);
if (is_array($tmp)) $diskconfig = $tmp;
else $diskconfig = json_decode($tmp, true);
}
$tmp = [];
$indisk = 0;
$operatedisk = 0;
foreach ($arr as $k => $v) {
if (isCommonEnv($k)) {
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
else $tmp[$k] = $v;
} elseif (isInnerEnv($k)) {
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
else $diskconfig[$k] = $v;
$indisk = 1;
} elseif ($k=='disktag_add') {
array_push($disktags, $v);
$operatedisk = 1;
} elseif ($k=='disktag_del') {
$disktags = array_diff($disktags, [ $v ]);
$tmp[$v] = '';
$operatedisk = 1;
} elseif ($k=='disktag_copy') {
$newtag = $v . '_' . date("Ymd_His");
$tagvalue = getenv($v);
if (is_array($tagvalue)) $tmp[$newtag] = json_encode($tagvalue);
else $tmp[$newtag] = $tagvalue;
array_push($disktags, $newtag);
$operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
} else {
$tmp[$k] = json_encode($v);
}
}
if ($indisk) {
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
ksort($diskconfig);
$tmp[$disktag] = json_encode($diskconfig);
}
if ($operatedisk) {
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
$tags = [];
foreach ($disktags as $tag) {
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
else array_push($tags, $tag);
}
$tmp['disktag'] = implode('|', $tags);
$tagvalue = getenv($arr['disktag_rename']);
if (is_array($tagvalue)) $tmp[$arr['disktag_newname']] = json_encode($tagvalue);
else $tmp[$arr['disktag_newname']] = $tagvalue;
$tmp[$arr['disktag_rename']] = null;
} else {
$disktags = array_unique($disktags);
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
else $tmp['disktag'] = null;
}
}
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
//error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp' . json_encode($tmp, JSON_PRETTY_PRINT));
//echo json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp' . json_encode($tmp, JSON_PRETTY_PRINT);
return setVercelConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
}
function install()
{
global $constStr;
if ($_GET['install1']) {
if ($_POST['admin']!='') {
$tmp['admin'] = $_POST['admin'];
//$tmp['language'] = $_POST['language'];
$tmp['timezone'] = $_COOKIE['timezone'];
$APIKey = $_POST['APIKey'];
//if ($APIKey=='') {
// $APIKey = getConfig('APIKey');
//}
$tmp['APIKey'] = $APIKey;
$token = $APIKey;
$header["Authorization"] = "Bearer " . $token;
$header["Content-Type"] = "application/json";
$aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true);
$host = splitfirst($_SERVER["host"], "//")[1];
foreach ($aliases["aliases"] as $key => $aliase) {
if ($host==$aliase["alias"]) $projectId = $aliase["projectId"];
}
$tmp['HerokuappId'] = $projectId;
$response = json_decode(setVercelConfig($tmp, $projectId, $APIKey), true);
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
return message($html, $title, 400);
} else {
/*$html = '<script>
var status = "' . $response['status'] . '";
var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>';
return message($html, $title, 201, 1);*/
$data["dplId"] = $response['status'];
return output(json_encode($data), 201);
}
}
}
if ($_GET['install0']) {
$html .= '
<form action="?install1" method="post" onsubmit="return notnull(this);">
language:<br>';
foreach ($constStr['languages'] as $key1 => $value1) {
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
//if (getConfig('APIKey')=='')
$html .= '<br>
<a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
<label>Token:<input name="APIKey" type="password" placeholder="" value="' . getConfig('APIKey') . '"></label><br>';
$html .= '<br>
<label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
$html .= '
<input type="submit" value="'.getconstStr('Submit').'">
</form>
<div id="showerror"></div>
<script>
var nowtime= new Date();
var timezone = 0-nowtime.getTimezoneOffset()/60;
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie="timezone="+timezone+"; path=/; "+expires;
var errordiv = document.getElementById("showerror");
function changelanguage(str)
{
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
location.href = location.href;
}
function notnull(t)
{
if (t.admin.value==\'\') {
alert(\'input admin\');
return false;
}
if (t.APIKey.value==\'\') {
alert(\'input Token\');
return false;
}
t.style.display = "none";
errordiv.innerHTML = "' . getconstStr('Wait') . '";
var xhr = new XMLHttpRequest();
xhr.open("POST", t.action);
xhr.onload = function(e) {
if (xhr.status==201) {
var res = JSON.parse(xhr.responseText);
getStatus(res.dplId, t.APIKey.value);
} else {
t.style.display = "";
errordiv.innerHTML = xhr.status + "<br>" + xhr.responseText;
}
}
xhr.send("admin=" + t.admin.value + "&APIKey=" + t.APIKey.value);
var x = "";
var min = 0;
function getStatus(id, VercelToken) {
x += ".";
min++;
var xhr = new XMLHttpRequest();
var url = "https://api.vercel.com/v11/now/deployments/" + id;
xhr.open("GET", url);
xhr.setRequestHeader("Authorization", "Bearer " + VercelToken);
xhr.onload = function(e) {
if (xhr.status==200) {
var deployStat = JSON.parse(xhr.responseText).readyState;
if (deployStat=="READY") {
x = "";
min = 0;
errordiv.innerHTML = "Deploy done.";
location.href = "/";
} else {
errordiv.innerHTML = deployStat + ", " + min + ".<br>' . getconstStr('Wait') . ' " + x;
if (deployStat!=="ERROR") setTimeout(function() { getStatus(id, VercelToken) }, 1000);
}
} else {
t.style.display = "";
console.log(xhr.status);
console.log(xhr.responseText);
}
}
xhr.send(null);
}
return false;
}
</script>';
$title = getconstStr('SelectLanguage');
return message($html, $title, 201);
}
if (substr($_SERVER["host"], -10)=="vercel.app") {
$html .= '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind');
$html .= "<br>Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building<br>" ;
} else {
$html.= "Please visit form *.vercel.app";
}
$title = 'Install';
return message($html, $title, 201);
}
// POST /v8/projects/:id/env
function setVercelConfig($envs, $appId, $token)
{
$url = "https://api.vercel.com/v8/projects/" . $appId . "/env";
$header["Authorization"] = "Bearer " . $token;
$header["Content-Type"] = "application/json";
$response = curl("GET", $url, "", $header);
$result = json_decode($response['body'], true);
foreach ($result["envs"] as $key => $value) {
$existEnvs[$value["key"]] = $value["id"];
}
$response = null;
foreach ($envs as $key => $value) {
$tmp = null;
$tmp["type"] = "encrypted";
$tmp["key"] = $key;
$tmp["value"] = $value;
$tmp["target"] = [ "development", "production", "preview" ];
if (isset($existEnvs[$key])) {
if ($value) $response = curl("PATCH", $url . "/" . $existEnvs[$key], json_encode($tmp), $header);
else $response = curl("DELETE", $url . "/" . $existEnvs[$key], "", $header);
} else {
if ($value) $response = curl("POST", $url, json_encode($tmp), $header);
}
//echo $key . " = " . $value . ", <br>" . json_encode($response, JSON_PRETTY_PRINT) . "<br>";
if ($response['stat']!=200) return $response['body'];
}
return VercelUpdate($appId, $token);
}
function VercelUpdate($appId, $token, $sourcePath = "")
{
$url = "https://api.vercel.com/v12/now/deployments";
$header["Authorization"] = "Bearer " . $token;
$header["Content-Type"] = "application/json";
$data["name"] = "OneManager";
$data["project"] = $appId;
$data["target"] = "production";
$data["routes"][0]["src"] = "/(.*)";
$data["routes"][0]["dest"] = "/api/index.php";
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.4.0";
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
//echo $sourcePath . "<br>";
getEachFiles($file, $sourcePath);
$data["files"] = $file;
//echo json_encode($data, JSON_PRETTY_PRINT) . " ,data<br>";
$response = curl("POST", $url, json_encode($data), $header);
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
return json_encode($result);
}
function getEachFiles(&$file, $base, $path = "")
{
//if (substr($base, -1)=="/") $base = substr($base, 0, -1);
//if (substr($path, -1)=="/") $path = substr($path, 0, -1);
$handler=opendir(path_format($base . "/" . $path));
while($filename=readdir($handler)) {
if($filename != '.' && $filename != '..' && $filename != '.git'){
$fromfile = path_format($base . "/" . $path . "/" . $filename);
//echo $fromfile . "<br>";
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
$response = getEachFiles($file, $base, path_format($path . "/" . $filename));
if (api_error(setConfigResponse($response))) return $response;
}else{
$tmp['file'] = path_format($path . "/" . $filename);
$tmp['data'] = file_get_contents($fromfile);
$file[] = $tmp;
}
}
}
closedir($handler);
return json_encode( [ 'response' => 'success' ] );
}
function api_error($response)
{
return isset($response['error']);
}
function api_error_msg($response)
{
return $response['error']['code'] . '<br>
' . $response['error']['message'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
}
function setConfigResponse($response)
{
return json_decode($response, true);
}
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
{
$tmppath = '/tmp';
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = $tmppath . '/github.tar.gz';
$githubfile = file_get_contents($url);
if (!$githubfile) return '{"error":{"message":"fail to download from github"}}';
file_put_contents($tarfile, $githubfile);
$phar = new PharData($tarfile); // need php5.3, 7, 8
$phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
unlink($tarfile);
$outPath = '';
$tmp = scandir($tmppath);
$name = $auth . '-' . $project;
mkdir($tmppath . "/" . $name, 0777);
foreach ($tmp as $f) {
if ( substr($f, 0, strlen($name)) == $name) {
rename($tmppath . '/' . $f, $tmppath . "/" . $name . '/api');
$outPath = $tmppath . "/" . $name;
break;
}
}
//echo $outPath . "<br>";
//error_log1($outPath);
if ($outPath=='') return '{"error":{"message":"no outpath"}}';
return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
}
function WaitFunction($deployid) {
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
$response = curl("GET", $url, "", $header);
if ($response['stat']==200) {
$result = json_decode($response['body'], true);
if ($result['readyState']=="READY") return true;
if ($result['readyState']=="ERROR") return $response;
return false;
} else {
$response['body'] .= $url;
return $response;
}
}
+39 -19
View File
@@ -1,11 +1,15 @@
Install program first, then add onedrive in setup after login. # NOTICE: the release is used as archive.
先安装程序,登录后在设置中添加onedrive。 # 注意:release只是用来存档的。
Please read the descriptions of settings before raising an issue.
请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
# Deploy to Heroku # Deploy to Heroku
Official: https://heroku.com Official: https://heroku.com
Demo: https://herooneindex.herokuapp.com/ Demo: https://herooneindex.herokuapp.com/
How to Install: Click the button [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/qkqpttgf/OneManager-php) to Deploy a new app, or create an app then deploy via connect to your github fork. How to Install:
> ~~Click the button [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/qkqpttgf/OneManager-php) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
> Fork this project, create a heroku app, then turn to Deploy tab, deploy via connect to your github fork.
# Deploy to Glitch # Deploy to Glitch
@@ -15,6 +19,17 @@ Demo: https://onemanager.glitch.me/
How to Install: New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window. How to Install: New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window.
# Deploy to Vercel
Official: https://vercel.com/
Demo: null
Notice:
> 1, you must wait 30-50s to make sure deploy READY after change config;
> 2, the max size of environment is 4k, so you can add 3 onedrive or less;
> 3, Vercel limit 100 deploy every day.
How to Install: https://scfonedrive.github.io/Vercel/Deploy.html .
# Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数) # Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数)
Official: https://cloud.tencent.com/product/scf Official: https://cloud.tencent.com/product/scf
DEMO: 无 DEMO: 无
@@ -31,25 +46,10 @@ How to Install:
添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。 添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。
# Deploy to Virtual Private Server (VPS 或空间)
DEMO: 无
How to Install:
1.Start web service on your server (httpd or other), make sure you can visit it.
启动web服务器,确保你能访问到。
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
3.Upload code.
上传好代码。
4.Change the file .data/config.php can be read&write (666 is suggested).
使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
5.View the website in chrome or other.
在浏览器中访问。
# Deploy to Huawei cloud Function Graph (FG 华为云函数工作流) # Deploy to Huawei cloud Function Graph (FG 华为云函数工作流)
Official: https://console.huaweicloud.com/functiongraph/ Official: https://console.huaweicloud.com/functiongraph/
DEMO: 无 DEMO: 无
注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘。 注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive
How to Install: How to Install:
1,在函数列表,点右边创建函数 1,在函数列表,点右边创建函数
@@ -86,6 +86,21 @@ How to Install:
6,点击右边触发器,复制并访问提供的url,开始安装 6,点击右边触发器,复制并访问提供的url,开始安装
# Deploy to Virtual Private Server (VPS 或空间)
DEMO: 无
How to Install:
1.Start web service on your server (httpd or other), make sure you can visit it.
启动web服务器,确保你能访问到。
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
3.Upload code.
上传好代码。
4.Change the file .data/config.php can be read&write (666 is suggested).
使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
5.View the website in chrome or other.
在浏览器中访问。
# Features 特性 # Features 特性
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce. When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。 下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
@@ -114,4 +129,9 @@ it will showed at top or bottom as markdown. 以MD语法显示在顶部或底部
### head.omf foot.omf ### head.omf foot.omf
it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。 it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。
# A cup of coffee
paypal.me/qkqpttgf
# Chat
QQ Group: 212088653 (请看完上面的中英双语再加群,谢谢!)
Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
+2 -2
View File
@@ -254,14 +254,14 @@
<div class="title pull-left"> <div class="title pull-left">
<a href="<!--base_path-->"><!--Sitename--></a> <a href="<!--base_path-->"><!--Sitename--></a>
</div> </div>
<div class="pull-right"> <div class="pull-right"><!--
<!--LoginStart--> <!--LoginStart-->
<a class="pull-left" onclick="/*login();*/"><!--constStr@Login--></a> <a class="pull-left" onclick="/*login();*/"><!--constStr@Login--></a>
<!--LoginEnd--> <!--LoginEnd-->
<!--AdminStart--> <!--AdminStart-->
<a class="pull-left" onclick="logout();"><!--constStr@Logout--></a> <a class="pull-left" onclick="logout();"><!--constStr@Logout--></a>
<!--AdminEnd--> <!--AdminEnd-->
&nbsp;| &nbsp;| -->
<div class="pull-right lang"> <div class="pull-right lang">
<select name="language" id="language" class="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)"> <select name="language" id="language" class="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
<option value="">Language</option> <option value="">Language</option>
+50 -28
View File
@@ -3,9 +3,9 @@
"music":"musical-notes", "music":"musical-notes",
"video":"logo-youtube", "video":"logo-youtube",
"img":"image", "img":"image",
"office":"paper", "office":"newspaper",
"txt":"clipboard", "txt":"clipboard",
"zip":"filing", "zip":"file-tray-full",
"iso":"disc", "iso":"disc",
"apk":"logo-android", "apk":"logo-android",
"exe":"logo-windows", "exe":"logo-windows",
@@ -31,13 +31,13 @@
.title{text-align:center;margin-top:1rem;letter-spacing:2px;margin-bottom:2rem} .title{text-align:center;margin-top:1rem;letter-spacing:2px;margin-bottom:2rem}
.title a{color:#333;text-decoration:none} .title a{color:#333;text-decoration:none}
.list-wrapper{width:80%;margin:0 auto 30px;position:relative;box-shadow:0 0 32px 0 rgb(128,128,128);border-radius:15px;} .list-wrapper{width:80%;margin:0 auto 30px;position:relative;box-shadow:0 0 32px 0 rgb(128,128,128);border-radius:15px;}
.list-container{position:relative;overflow:hidden;border-radius:15px;} .list-container{position:relative;/*overflow:hidden;*/border-radius:15px;background-color:rgba(245,245,245,0.5);}
.list-container,.list-header-container,.list-wrapper,a.back-link:hover,body{color:#24292e}
.list-header-container{position:relative} .list-header-container{position:relative}
.list-header-container a.back-link{color:#000;display:inline-block;position:absolute;font-size:16px;margin:20px 10px;padding:10px 10px;vertical-align:middle;text-decoration:none} .list-header-container a.back-link{color:#000;display:inline-block;position:absolute;font-size:16px;margin:20px 10px;padding:10px 10px;vertical-align:middle;text-decoration:none}
.list-container,.list-header-container,.list-wrapper,a.back-link:hover,body{color:#24292e} .table-header{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;word-break: break-all;word-wrap: break-word;}
.table-header{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;background-color:rgba(245,245,245,0.5);word-break: break-all;word-wrap: break-word;} .list-body-container{position:relative;left:0;box-sizing:border-box;/*overflow-x:hidden;overflow-y:auto;background:rgba(245,245,245,0.5)*/}
.list-body-container{position:relative;left:0;overflow-x:hidden;overflow-y:auto;box-sizing:border-box;background:rgba(245,245,245,0.5)} .more-disk{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;white-space:nowrap;overflow:auto;}
.more-disk{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;background-color:rgba(245,245,245,0.5);white-space:nowrap;overflow:auto;}
.more-disk a{margin:0 10px;padding:5px;transition-duration: 0.4s;border-radius: 12px; background-color: white; color: black; border: 2px solid rgba(85,85,85,0.7); } .more-disk a{margin:0 10px;padding:5px;transition-duration: 0.4s;border-radius: 12px; background-color: white; color: black; border: 2px solid rgba(85,85,85,0.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}
@@ -54,15 +54,16 @@
.operate{display:inline-table;margin:0;margin-right:5px;list-style:none} .operate{display:inline-table;margin:0;margin-right:5px;list-style:none}
.operate ul{position:absolute;display:none;background:#fffaaa;border:0px #f7f7f7 solid;border-radius:5px;margin:-7px 0 0 0;padding:0 7px;color:#205D67;z-index:1;} .operate ul{position:absolute;display:none;background:#fffaaa;border:0px #f7f7f7 solid;border-radius:5px;margin:-7px 0 0 0;padding:0 7px;color:#205D67;z-index:1;}
.operate:hover ul{position:absolute;display:inline-table;} .operate:hover ul{position:absolute;display:inline-table;}
body .active ul{position:absolute;display:inline-table;} /*for some mobile browser */
.operate ul li{padding:7px;list-style:none;display:block;} .operate ul li{padding:7px;list-style:none;display:block;}
.list-table tr[data-to]:hover .operate ul li a{color:black} .list-table tr[data-to]:hover .operate ul li a{color:black}
<!--AdminEnd--> <!--AdminEnd-->
.operatediv{position:absolute;border:1px #CCCCCC;background-color:#FFFFCC;z-index:2;} .operatediv{position:absolute;border:1px #CCCCCC;background-color:#FFFFCC;z-index:2;}
.operatediv div{margin:16px} .operatediv div{margin:16px}
.operatediv_close{position:absolute;right:3px;top:3px;} .operatediv_close{position:absolute;right:3px;top:3px;}
.readme{padding:8px;background-color:rgba(245,245,245,0.5);} .readme{padding:8px;}
.markdown-body, .customfile{padding:20px;text-align:left} .markdown-body, .customfile{padding:20px;text-align:left}
@media only screen and (max-width:480px){ @media only screen and (orientation: portrait){
<!--BackgroundMStart--> <!--BackgroundMStart-->
body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundMUrl-->");} body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundMUrl-->");}
<!--BackgroundMEnd--> <!--BackgroundMEnd-->
@@ -85,7 +86,7 @@
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul> <li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
<!--IsFolderStart--> <!--IsFolderStart-->
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li> <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li> <li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
<!--IsFolderEnd--> <!--IsFolderEnd-->
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li> <li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
@@ -163,7 +164,7 @@
</div> </div>
<!--EncryptedEnd--> <!--EncryptedEnd-->
<!--GuestUploadStart--> <!--GuestUploadStart-->
<div id="upload_div" style="margin:0 0 16px 0"> <div id="upload_div" style="padding:0 0 16px 0">
<div id="upload_btns" align="center"> <div id="upload_btns" align="center">
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;"> <select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
<option value=""><!--constStr@UploadFile--></option> <option value=""><!--constStr@UploadFile--></option>
@@ -176,14 +177,14 @@
<!--GuestUploadEnd--> <!--GuestUploadEnd-->
<!--IsFileStart--> <!--IsFileStart-->
<div style="margin: 12px 4px 4px; text-align: center"> <div style="padding: 12px 4px 4px; text-align: center">
<div style="margin: 24px"> <div style="margin: 24px">
<textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea> <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
<a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon>&nbsp;<!--constStr@Download--></a> <a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon>&nbsp;<!--constStr@Download--></a>
</div> </div>
<div style="margin: 24px"> <div style="margin: 24px">
<!--IsimgFileStart--> <!--IsimgFileStart-->
<img src="<!--FileEncodeUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" /> <img src="<!--FileEncodeUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';if (this.offsetHeight>document.documentElement.clientHeight) this.style.height=document.documentElement.clientHeight + 'px';" />
<!--IsimgFileEnd--> <!--IsimgFileEnd-->
<!--IsvideoFileStart--> <!--IsvideoFileStart-->
<div id="video-a0"></div> <div id="video-a0"></div>
@@ -240,7 +241,7 @@
<!--AdminStart--> <!--AdminStart-->
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a> <li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
<ul> <ul>
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li> <li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li> <li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li> <li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
@@ -305,7 +306,7 @@
</form> </form>
<!--MorePageEnd--> <!--MorePageEnd-->
<!--AdminStart--> <!--AdminStart-->
<div id="upload_div" style="margin:0 0 16px 0"> <div id="upload_div" style="padding:0 0 16px 0">
<div id="upload_btns" align="center"> <div id="upload_btns" align="center">
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;"> <select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
<option value=""><!--constStr@UploadFile--></option> <option value=""><!--constStr@UploadFile--></option>
@@ -940,7 +941,9 @@
} else { } else {
filemd5 = spark.end(); filemd5 = spark.end();
td2.innerHTML='md5: '+filemd5; td2.innerHTML='md5: '+filemd5;
delete uploading[upbigfilename];
upbigfilename = filemd5+ext; upbigfilename = filemd5+ext;
uploading[upbigfilename] = i;
<!--GuestEnd--> <!--GuestEnd-->
td2.innerHTML='<!--constStr@GetUploadLink--> ...'; td2.innerHTML='<!--constStr@GetUploadLink--> ...';
var xhr1 = new XMLHttpRequest(); var xhr1 = new XMLHttpRequest();
@@ -1004,6 +1007,7 @@
var newstartsize = 0; var newstartsize = 0;
if(!!file){ if(!!file){
var asize=0; var asize=0;
var chunksize=10*1024*1024; // chunk size, max 60M. 每小块上传大小,最大60M,微软建议10M
var totalsize=file.size; var totalsize=file.size;
var xhr2 = new XMLHttpRequest(); var xhr2 = new XMLHttpRequest();
xhr2.open("GET", url); xhr2.open("GET", url);
@@ -1021,8 +1025,6 @@
} else { } else {
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ; StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
} }
var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小,最大60M,微软建议10M
if (totalsize>200*1024*1024) chunksize=10*1024*1024;
function readblob(start) { function readblob(start) {
var end=start+chunksize; var end=start+chunksize;
var blob = file.slice(start,end); var blob = file.slice(start,end);
@@ -1032,6 +1034,7 @@
reader.onload = function(e){ reader.onload = function(e){
var binary = this.result; var binary = this.result;
var lastCurrentSpeed;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("PUT", url, true); xhr.open("PUT", url, true);
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest'); //xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
@@ -1039,9 +1042,10 @@
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize); xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
xhr.upload.onprogress = function(e){ xhr.upload.onprogress = function(e){
if (e.lengthComputable) { if (e.lengthComputable) {
var tmptime = new Date(); let tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed; lastCurrentSpeed = 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)); 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));
} }
} }
@@ -1085,6 +1089,9 @@
} else { } else {
var a=response['nextExpectedRanges'][0]; var a=response['nextExpectedRanges'][0];
asize=Number( a.slice(0,a.indexOf("-")) ); asize=Number( a.slice(0,a.indexOf("-")) );
chunksize = 10*1024*1024;
if (lastCurrentSpeed>5*1024*1024) chunksize = 20*1024*1024;
if (lastCurrentSpeed>10*1024*1024) chunksize = 50*1024*1024;
readblob(asize); readblob(asize);
} }
} } else readblob(asize); } } else readblob(asize);
@@ -1157,7 +1164,6 @@
uploading[upbigfilename] = [i]; uploading[upbigfilename] = [i];
var spark = sha1.create(); var spark = sha1.create();
var reader = new FileReader(); var reader = new FileReader();
var chunksize=10*1024*1024;
var asize = 0; var asize = 0;
var filesha1; var filesha1;
function readblob(start) { function readblob(start) {
@@ -1436,6 +1442,22 @@
document.cookie = "admin=; path=/; "+expires; document.cookie = "admin=; path=/; "+expires;
location.href = location.href; location.href = location.href;
} }
/*for some mobile browser*/
function menu_click(e){
var ee=document.getElementsByClassName("active");
for(var i=0;i<ee.length;i++){
ee[i].classList.remove("active");
}
if(e.type!="mouseout")this.classList.add("active");
}
(function(){
var e=document.getElementsByClassName("operate");
document.body.addEventListener("touchstart", menu_click);
for(var i=0;i<e.length;i++){
e[i].addEventListener("touchstart", menu_click);
e[i].addEventListener("mouseout", menu_click);
}
})();
<!--IsFolderStart--> <!--IsFolderStart-->
function showdiv(event,action,num) { function showdiv(event,action,num) {
var $operatediv=document.getElementsByName('operatediv'); var $operatediv=document.getElementsByName('operatediv');
@@ -1462,15 +1484,15 @@
document.getElementById(action + '_fileid').value=fileid; document.getElementById(action + '_fileid').value=fileid;
document.getElementById(action + '_hidden').value=str; document.getElementById(action + '_hidden').value=str;
if (action=='rename') document.getElementById(action + '_input').value=str; if (action=='rename') document.getElementById(action + '_input').value=str;
var $e = event || window.event; /*var $e = event || window.event;
var $scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var $scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;*/
var $scrollY = document.documentElement.scrollTop || document.body.scrollTop; var $scrollY = document.documentElement.scrollTop || document.body.scrollTop;
var $x = $e.pageX || $e.clientX + $scrollX; /*var $x = $e.pageX || $e.clientX + $scrollX;
var $y = $e.pageY || $e.clientY + $scrollY; var $y = $e.pageY || $e.clientY + $scrollY;
if (action=='create') { if (action=='create') {*/
document.getElementById(action + '_div').style.left=(document.body.clientWidth-document.getElementById(action + '_div').offsetWidth)/2 +'px'; document.getElementById(action + '_div').style.left=(document.body.clientWidth-document.getElementById(action + '_div').offsetWidth)/2 +'px';
document.getElementById(action + '_div').style.top=(window.innerHeight-document.getElementById(action + '_div').offsetHeight)/2+$scrollY +'px'; document.getElementById(action + '_div').style.top=(window.innerHeight-document.getElementById(action + '_div').offsetHeight)/2+$scrollY +'px';
} else { /*} else {
if ($x + document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) { if ($x + document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) {
if (document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) { if (document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) {
document.getElementById(action + '_div').offsetWidth=document.body.clientWidth+'px'; document.getElementById(action + '_div').offsetWidth=document.body.clientWidth+'px';
@@ -1482,7 +1504,7 @@
document.getElementById(action + '_div').style.left=$x+'px'; document.getElementById(action + '_div').style.left=$x+'px';
} }
document.getElementById(action + '_div').style.top=$y+'px'; document.getElementById(action + '_div').style.top=$y+'px';
} }*/
document.getElementById(action + '_input').focus(); document.getElementById(action + '_input').focus();
} }
function submit_operate(str) { function submit_operate(str) {
@@ -1612,7 +1634,7 @@
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>
+1657
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -3,9 +3,9 @@
"music":"musical-notes", "music":"musical-notes",
"video":"logo-youtube", "video":"logo-youtube",
"img":"image", "img":"image",
"office":"paper", "office":"newspaper",
"txt":"clipboard", "txt":"clipboard",
"zip":"filing", "zip":"file-tray-full",
"iso":"disc", "iso":"disc",
"apk":"logo-android", "apk":"logo-android",
"exe":"logo-windows", "exe":"logo-windows",
@@ -109,7 +109,7 @@
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<!--IsFolderStart--> <!--IsFolderStart-->
<a class="dropdown-item" data-toggle="modal" data-target="#NewFileModal"><ion-icon name="create"></ion-icon><!--constStr@Create--></a> <a class="dropdown-item" data-toggle="modal" data-target="#NewFileModal"><ion-icon name="create"></ion-icon><!--constStr@Create--></a>
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value=''"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a> <a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value=''"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a>
<a class="dropdown-item" href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a> <a class="dropdown-item" href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a>
<!--IsFolderEnd--> <!--IsFolderEnd-->
<a class="dropdown-item" href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a> <a class="dropdown-item" href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a>
@@ -177,7 +177,7 @@
<div style="padding:20px"> <div style="padding:20px">
<center> <center>
<form action="" method="post"> <form action="" method="post">
<input name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="password1" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input type="submit" value="<!--constStr@Submit-->"> <input type="submit" value="<!--constStr@Submit-->">
</form> </form>
</center> </center>
@@ -287,7 +287,7 @@
<ion-icon name="construct"></ion-icon> <ion-icon name="construct"></ion-icon>
</a> </a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value='<!--FileEncodeReplaceName-->'"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a> <a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value='<!--FileEncodeReplaceName-->'"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a>
<a class="dropdown-item" data-toggle="modal" data-target="#renameModal" onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a> <a class="dropdown-item" data-toggle="modal" data-target="#renameModal" onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a>
<a class="dropdown-item" data-toggle="modal" data-target="#MoveModal" onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a> <a class="dropdown-item" data-toggle="modal" data-target="#MoveModal" onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a>
<a class="dropdown-item" data-toggle="modal" data-target="#CopyModal" onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a> <a class="dropdown-item" data-toggle="modal" data-target="#CopyModal" onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a>
@@ -1747,7 +1747,7 @@ return false;
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<script src="//cdn.bootcdn.net/ajax/libs/jquery/3.3.1/jquery.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="//cdn.bootcdn.net/ajax/libs/jquery/3.3.1/jquery.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="//cdn.bootcdn.net/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="//cdn.bootcdn.net/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="//cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> <script src="//cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
+500 -113
View File
@@ -3,9 +3,9 @@
"music":"musical-notes", "music":"musical-notes",
"video":"logo-youtube", "video":"logo-youtube",
"img":"image", "img":"image",
"office":"paper", "office":"newspaper",
"txt":"clipboard", "txt":"clipboard",
"zip":"filing", "zip":"file-tray-full",
"iso":"disc", "iso":"disc",
"apk":"logo-android", "apk":"logo-android",
"exe":"logo-windows", "exe":"logo-windows",
@@ -27,6 +27,9 @@
<!--BackgroundStart--> <!--BackgroundStart-->
<style>body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position-x:center;background-image:url("<!--BackgroundUrl-->")}</style> <style>body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position-x:center;background-image:url("<!--BackgroundUrl-->")}</style>
<!--BackgroundEnd--> <!--BackgroundEnd-->
<!--BackgroundMStart-->
<style>@media screen and (orientation:portrait){body{background-image:url("<!--BackgroundMUrl-->");}}</style>
<!--BackgroundMEnd-->
<script type="text/javascript">if(window.console&&window.console.log){console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ","color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;","margin: 1em 0; padding: 5px 0; background: #efefef;")}</script> <script type="text/javascript">if(window.console&&window.console.log){console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ","color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;","margin: 1em 0; padding: 5px 0; background: #efefef;")}</script>
<!--customCss--> <!--customCss-->
</head> </head>
@@ -40,7 +43,7 @@
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul> <li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
<!--IsFolderStart--> <!--IsFolderStart-->
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li> <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li> <li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
<!--IsFolderEnd--> <!--IsFolderEnd-->
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li> <li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
@@ -104,42 +107,41 @@
<div class="list-wrapper" id="list-div"> <div class="list-wrapper" id="list-div">
<div class="list-container"> <div class="list-container">
<div class="list-header-container"> <div class="list-header-container">
<!--BackArrowStart--> <h3 class="table-header"><a href="<!--base_path-->"><!--constStr@Home--></a><!--DiskPathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--DiskPathArrayEnd--></h3>
<a href="<!--BackArrowUrl-->" class="back-link">
<ion-icon name="arrow-back"></ion-icon>
</a>
<!--BackArrowEnd-->
<h3 class="table-header"><!--PathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--PathArrayEnd--></h3>
</div> </div>
<div class="list-body-container"> <div class="list-body-container">
<!--EncryptedStart--> <!--EncryptedStart-->
<div style="padding:20px"> <div style="padding:20px">
<center> <center>
<form action="" method="post"> <form action="" method="post">
<input name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="password1" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input type="submit" value="<!--constStr@Submit-->"> <input type="submit" value="<!--constStr@Submit-->">
</form> </form>
</center> </center>
</div> </div>
<!--EncryptedEnd--> <!--EncryptedEnd-->
<!--GuestUploadStart--> <!--GuestUploadStart-->
<div id="upload_div" style="margin:10px"> <div id="upload_div" style="padding:0 0 16px 0">
<div id="upload_btns" align="center"> <div id="upload_btns" align="center">
<input id="upload_file" type="file" name="upload_filename"> <select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
<option value=""><!--constStr@UploadFile--></option>
<option value="1"><!--constStr@UploadFolder--></option>
</select>
<input id="upload_file" type="file" name="upload_filename" multiple="multiple">
<input id="upload_submit" onclick="preup();" value="<!--constStr@Upload-->" type="button"> <input id="upload_submit" onclick="preup();" value="<!--constStr@Upload-->" type="button">
</div> </div>
</div> </div>
<!--GuestUploadEnd--> <!--GuestUploadEnd-->
<!--IsFileStart--> <!--IsFileStart-->
<div style="margin: 12px 4px 4px; text-align: center"> <div style="padding: 12px 4px 4px; text-align: center">
<div style="margin: 24px"> <div style="margin: 24px">
<textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea> <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
<a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon>&nbsp;<!--constStr@Download--></a> <a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon>&nbsp;<!--constStr@Download--></a>
</div> </div>
<div style="margin: 24px"> <div style="margin: 24px">
<!--IsimgFileStart--> <!--IsimgFileStart-->
<img src="<!--FileDownUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" /> <img src="<!--FileEncodeUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" />
<!--IsimgFileEnd--> <!--IsimgFileEnd-->
<!--IsvideoFileStart--> <!--IsvideoFileStart-->
<div id="video-a0"></div> <div id="video-a0"></div>
@@ -196,7 +198,7 @@
<!--AdminStart--> <!--AdminStart-->
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a> <li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
<ul> <ul>
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li> <li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li> <li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li> <li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
@@ -205,7 +207,7 @@
</li> </li>
<!--AdminEnd--> <!--AdminEnd-->
<ion-icon name="folder"></ion-icon> <ion-icon name="folder"></ion-icon>
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/"><!--FileEncodeReplaceName--></a> <a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/" fileid="<!--FileId-->"><!--FileEncodeReplaceName--></a>
</td> </td>
<td class="updated_at" id="folder_time<!--filenum-->"><!--lastModifiedDateTime--></td> <td class="updated_at" id="folder_time<!--filenum-->"><!--lastModifiedDateTime--></td>
<td class="size" id="folder_size<!--filenum-->"><!--size--></td> <td class="size" id="folder_size<!--filenum-->"><!--size--></td>
@@ -225,7 +227,7 @@
</li> </li>
<!--AdminEnd--> <!--AdminEnd-->
<ion-icon name="<!--IconValue-->"></ion-icon> <ion-icon name="<!--IconValue-->"></ion-icon>
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" target=_blank><!--FileEncodeReplaceName--></a> <a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" fileid="<!--FileId-->" target=_blank><!--FileEncodeReplaceName--></a>
<a class="download" href="<!--FileEncodeReplaceUrl-->"><ion-icon name="download"></ion-icon></a> <a class="download" href="<!--FileEncodeReplaceUrl-->"><ion-icon name="download"></ion-icon></a>
</td> </td>
<td class="updated_at" id="file_time<!--filenum-->"><!--lastModifiedDateTime--></td> <td class="updated_at" id="file_time<!--filenum-->"><!--lastModifiedDateTime--></td>
@@ -261,7 +263,7 @@
</form> </form>
<!--MorePageEnd--> <!--MorePageEnd-->
<!--AdminStart--> <!--AdminStart-->
<div id="upload_div" style="margin:0 0 16px 0"> <div id="upload_div" style="padding:0 0 16px 0">
<div id="upload_btns" align="center"> <div id="upload_btns" align="center">
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;"> <select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
<option value=""><!--constStr@UploadFile--></option> <option value=""><!--constStr@UploadFile--></option>
@@ -273,10 +275,10 @@
</div> </div>
<!--AdminEnd--> <!--AdminEnd-->
<!--IsFolderEnd--> <!--IsFolderEnd-->
</div>
</div>
</div>
<!--ListEnd--> <!--ListEnd-->
</div>
</div>
</div>
<!--ReadmemdStart--> <!--ReadmemdStart-->
<div class="list-wrapper" id="readme-div"> <div class="list-wrapper" id="readme-div">
<div class="list-container"> <div class="list-container">
@@ -313,6 +315,7 @@
<label id="rename_label"></label><br><br><a onclick="operatediv_close('rename')" class="operatediv_close"><!--constStr@Close--></a> <label id="rename_label"></label><br><br><a onclick="operatediv_close('rename')" class="operatediv_close"><!--constStr@Close--></a>
<form id="rename_form" onsubmit="return submit_operate('rename');"> <form id="rename_form" onsubmit="return submit_operate('rename');">
<input id="rename_sid" name="rename_sid" type="hidden" value=""> <input id="rename_sid" name="rename_sid" type="hidden" value="">
<input id="rename_fileid" name="rename_fileid" type="hidden" value="">
<input id="rename_hidden" name="rename_oldname" type="hidden" value=""> <input id="rename_hidden" name="rename_oldname" type="hidden" value="">
<input id="rename_input" name="rename_newname" type="text" value=""> <input id="rename_input" name="rename_newname" type="text" value="">
<input name="operate_action" type="submit" value="<!--constStr@Rename-->"> <input name="operate_action" type="submit" value="<!--constStr@Rename-->">
@@ -326,6 +329,7 @@
<form id="delete_form" onsubmit="return submit_operate('delete');"> <form id="delete_form" onsubmit="return submit_operate('delete');">
<label id="delete_input"><!--constStr@Delete-->?</label> <label id="delete_input"><!--constStr@Delete-->?</label>
<input id="delete_sid" name="delete_sid" type="hidden" value=""> <input id="delete_sid" name="delete_sid" type="hidden" value="">
<input id="delete_fileid" name="delete_fileid" type="hidden" value="">
<input id="delete_hidden" name="delete_name" type="hidden" value=""> <input id="delete_hidden" name="delete_name" type="hidden" value="">
<input name="operate_action" type="submit" value="<!--constStr@Submit-->"> <input name="operate_action" type="submit" value="<!--constStr@Submit-->">
</form> </form>
@@ -336,6 +340,7 @@
<label id="encrypt_label"></label><br><br><a onclick="operatediv_close('encrypt')" class="operatediv_close"><!--constStr@Close--></a> <label id="encrypt_label"></label><br><br><a onclick="operatediv_close('encrypt')" class="operatediv_close"><!--constStr@Close--></a>
<form id="encrypt_form" onsubmit="return submit_operate('encrypt');"> <form id="encrypt_form" onsubmit="return submit_operate('encrypt');">
<input id="encrypt_sid" name="encrypt_sid" type="hidden" value=""> <input id="encrypt_sid" name="encrypt_sid" type="hidden" value="">
<input id="encrypt_fileid" name="encrypt_fileid" type="hidden" value="">
<input id="encrypt_hidden" name="encrypt_folder" type="hidden" value=""> <input id="encrypt_hidden" name="encrypt_folder" type="hidden" value="">
<input id="encrypt_input" name="encrypt_newpass" type="text" value="" placeholder="<!--constStr@InputPasswordUWant-->"> <input id="encrypt_input" name="encrypt_newpass" type="text" value="" placeholder="<!--constStr@InputPasswordUWant-->">
<!--EncryptBtnStart--><input name="operate_action" type="submit" value="<!--constStr@Encrypt-->"><!--EncryptBtnEnd--><!--EncryptAlertStart--><br><label><!--constStr@SetpassfileBfEncrypt--></label><!--EncryptAlertEnd--> <!--EncryptBtnStart--><input name="operate_action" type="submit" value="<!--constStr@Encrypt-->"><!--EncryptBtnEnd--><!--EncryptAlertStart--><br><label><!--constStr@SetpassfileBfEncrypt--></label><!--EncryptAlertEnd-->
@@ -347,6 +352,7 @@
<label id="copy_label"></label><br><br><a onclick="operatediv_close('copy')" class="operatediv_close"><!--constStr@Close--></a> <label id="copy_label"></label><br><br><a onclick="operatediv_close('copy')" class="operatediv_close"><!--constStr@Close--></a>
<form id="copy_form" onsubmit="return submit_operate('copy');"> <form id="copy_form" onsubmit="return submit_operate('copy');">
<input id="copy_sid" name="copy_sid" type="hidden" value=""> <input id="copy_sid" name="copy_sid" type="hidden" value="">
<input id="copy_fileid" name="copy_fileid" type="hidden" value="">
<input id="copy_hidden" name="copy_name" type="hidden" value=""> <input id="copy_hidden" name="copy_name" type="hidden" value="">
<input id="copy_input" name="copy_input" type="hidden" value=""> <input id="copy_input" name="copy_input" type="hidden" value="">
<input name="operate_action" type="submit" value="<!--constStr@Copy-->"> <input name="operate_action" type="submit" value="<!--constStr@Copy-->">
@@ -358,6 +364,7 @@
<label id="move_label"></label><br><br><a onclick="operatediv_close('move')" class="operatediv_close"><!--constStr@Close--></a> <label id="move_label"></label><br><br><a onclick="operatediv_close('move')" class="operatediv_close"><!--constStr@Close--></a>
<form id="move_form" onsubmit="return submit_operate('move');"> <form id="move_form" onsubmit="return submit_operate('move');">
<input id="move_sid" name="move_sid" type="hidden" value=""> <input id="move_sid" name="move_sid" type="hidden" value="">
<input id="move_fileid" name="move_fileid" type="hidden" value="">
<input id="move_hidden" name="move_name" type="hidden" value=""> <input id="move_hidden" name="move_name" type="hidden" value="">
<select id="move_input" name="move_folder"> <select id="move_input" name="move_folder">
<!--MoveRootStart--> <!--MoveRootStart-->
@@ -376,6 +383,7 @@
<a onclick="operatediv_close('create')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('create')" class="operatediv_close"><!--constStr@Close--></a>
<form id="create_form" onsubmit="return submit_operate('create');"> <form id="create_form" onsubmit="return submit_operate('create');">
<input id="create_sid" name="create_sid" type="hidden" value=""> <input id="create_sid" name="create_sid" type="hidden" value="">
<input id="create_fileid" name="create_fileid" type="hidden" value="">
<input id="create_hidden" type="hidden" value=""> <input id="create_hidden" type="hidden" value="">
<table> <table>
<tr> <tr>
@@ -413,8 +421,9 @@
<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?-->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 type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>
</center> </center>
@@ -428,6 +437,7 @@
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
@@ -440,28 +450,32 @@
document.cookie='language='+str+'; path=/; '+expires; document.cookie='language='+str+'; path=/; '+expires;
location.href = location.href; location.href = location.href;
} }
<!--LoginStart-->
function login() {
document.getElementById('mask').style.display='';
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
document.getElementById('login_div').style.display='';
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus();
}
function sha1loginpass(f) {
if (f.password1.value=="") return false;
try {
timestamp = new Date().getTime() + "";
timestamp = timestamp.substr(0, timestamp.length-3);
f.timestamp.value = timestamp;
f.password1.value = sha1(timestamp + "" + f.password1.value);
return true;
} catch {
alert("sha1.js not loaded.");
return false;
}
}
<!--LoginEnd-->
<!--ListStart--> <!--ListStart-->
/*var root = '<!--base_disk_path-->';
function path_format(path) {
path = '/' + path + '/';
while (path.indexOf('//') !== -1) {
path = path.replace('//', '/')
}
return path
}
document.querySelectorAll('.table-header').forEach(function (e) {
var path = e.innerText;
if (path.substr(path.length-1)=='/') path = path.substr(0, path.length-1);
var paths = path.split('/');
e.innerHTML = '/ ';
if (paths <= 2) return;
for (var i = 1; i < paths.length - 1; i++) {
var to = path_format(root + paths.slice(0, i + 1).join('/'));
e.innerHTML += '<a href="' + to + '">' + paths[i] + '</a> / '
}
e.innerHTML += paths[paths.length - 1];
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
});*/
<!--IsFileStart--> <!--IsFileStart-->
var $url = document.getElementById('url'); var $url = document.getElementById('url');
if ($url) { if ($url) {
@@ -544,7 +558,7 @@
}); });
} }
} }
addVideos(['<!--FileDownUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
@@ -589,7 +603,6 @@
if ($head) { if ($head) {
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div')); //document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
$head.innerHTML = marked(document.getElementById('head-md').innerText); $head.innerHTML = marked(document.getElementById('head-md').innerText);
} }
<!--HeadmdEnd--> <!--HeadmdEnd-->
<!--ReadmemdStart--> <!--ReadmemdStart-->
@@ -609,15 +622,13 @@
strarry=str.split('.'); strarry=str.split('.');
ext=strarry[strarry.length-1].toLowerCase(); ext=strarry[strarry.length-1].toLowerCase();
if (images.indexOf(ext)>-1) { if (images.indexOf(ext)>-1) {
if (document.getElementById('originalpic').checked==true) {
var url=files[$i].href; var url=files[$i].href;
url=url.substr(0,url.length-8); url=url.substr(0,url.length-8);
if (document.getElementById('originalpic').checked==true) {
files[$i].parentNode.parentNode.innerHTML='<td colspan="3"><img src="'+url+'" alt="'+str+'" onload="if (this.offsetWidth>document.getElementById(\'list-div\').offsetWidth) this.style.width=\'100%\';"></td>'; files[$i].parentNode.parentNode.innerHTML='<td colspan="3"><img src="'+url+'" alt="'+str+'" onload="if (this.offsetWidth>document.getElementById(\'list-div\').offsetWidth) this.style.width=\'100%\';"></td>';
$i--; $i--;
} else { } else {
var nurl=window.location.href; url+='?thumbnails';
if (nurl.substr(-1)!="/") nurl+="/";
var url=nurl+str+'?thumbnails';
get_thumbnails_url(url, str, files[$i]); get_thumbnails_url(url, str, files[$i]);
} }
} }
@@ -754,6 +765,40 @@
alert(tmptextarea.innerHTML+"<!--constStr@Success-->"); alert(tmptextarea.innerHTML+"<!--constStr@Success-->");
} }
<!--UploadJsStart--> <!--UploadJsStart-->
function size_format(num) {
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' B';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' KB';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' MB';
}
return num.toFixed(2) + ' GB';
}
function seconds2hour(seconds) {
let h, m, s;
if (parseFloat(seconds)<60) {
return seconds + 's';
} else {
s = (seconds % 60).toFixed(0);
m = parseInt(seconds / 60);
if (parseInt(m)<60) {
return m + 'm' + s + 's';
} else {
h = parseInt(m / 60);
m = m % 60;
return h + 'h' + m + 'm' + s + 's';
}
}
}
function uploadbuttonhide() { function uploadbuttonhide() {
document.getElementById('upload_btns').style.display='none'; document.getElementById('upload_btns').style.display='none';
/*document.getElementById('upload_submit').disabled='disabled'; /*document.getElementById('upload_submit').disabled='disabled';
@@ -768,6 +813,9 @@
document.getElementById('upload_submit').style.display=''; document.getElementById('upload_submit').style.display='';
document.getElementById('upload_file').style.display='';*/ document.getElementById('upload_file').style.display='';*/
} }
var uploading = new Object();
<!--UploadJsEnd-->
<!--OnedriveUploadJsStart-->
function preup() { function preup() {
uploadbuttonhide(); uploadbuttonhide();
var files=document.getElementById('upload_file').files; var files=document.getElementById('upload_file').files;
@@ -780,7 +828,15 @@
table1.setAttribute('class','list-table'); table1.setAttribute('class','list-table');
var timea=new Date().getTime(); var timea=new Date().getTime();
var i=0; var i=0;
var uploadList = setInterval(function(){
if (i<files.length) {
if (Object.keys(uploading).length<5) {
getuplink(i); getuplink(i);
i++;
}// else console.log(Object.keys(uploading).length);
} else clearInterval(uploadList);
}, 1000);
//getuplink(i);
function getuplink(i, r=0) { function getuplink(i, r=0) {
var file=files[i]; var file=files[i];
var td1; var td1;
@@ -793,7 +849,7 @@
tr1.appendChild(td1); tr1.appendChild(td1);
td1.setAttribute('style','width:30%;word-break:break-word;'); td1.setAttribute('style','width:30%;word-break:break-word;');
td1.setAttribute('id','upfile_td1_'+timea+'_'+i); td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size); td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
td2=document.createElement('td'); td2=document.createElement('td');
tr1.appendChild(td2); tr1.appendChild(td2);
td2.setAttribute('id','upfile_td2_'+timea+'_'+i); td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
@@ -806,11 +862,13 @@
uploadbuttonshow(); uploadbuttonshow();
return; return;
} }
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
uploading[upbigfilename] = i;
var filemd5=''; var filemd5='';
<!--GuestStart--> <!--GuestStart-->
function getext(str) { function getext(str) {
strarry=str.split('.'); strarry=str.split('.');
if (strarry.length==1) return '';
ext=strarry[strarry.length-1].toLowerCase(); ext=strarry[strarry.length-1].toLowerCase();
var reg = new RegExp(".","g"); var reg = new RegExp(".","g");
var a = str.replace(reg,""); var a = str.replace(reg,"");
@@ -838,29 +896,21 @@
if (asize < file.size) { if (asize < file.size) {
readblob(asize); readblob(asize);
} else { } else {
var filemd5 = spark.end(); filemd5 = spark.end();
td2.innerHTML='md5: '+filemd5; td2.innerHTML='md5: '+filemd5;
upbigfilename = filemd5+ext; upbigfilename = filemd5+ext;
<!--GuestEnd--> <!--GuestEnd-->
td2.innerHTML='<!--constStr@GetUploadLink--> ...'; td2.innerHTML='<!--constStr@GetUploadLink--> ...';
var xhr1 = new XMLHttpRequest(); var xhr1 = new XMLHttpRequest();
xhr1.open("POST", '?action=upbigfile'); xhr1.open("POST", '?action=upbigfile');
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest'); xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr1.onprogress = function(e){ xhr1.onprogress = function(e){
td2.innerHTML+='.'; td2.innerHTML+='.';
} }
xhr1.onload = function(e){ xhr1.onload = function(e){
console.log(xhr1.status+xhr1.responseText); //console.log(xhr1.status+xhr1.responseText);
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>'; td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
if (xhr1.status==409) {
// td2.innerHTML='nameAlreadyExists';
var html=JSON.parse(xhr1.responseText);
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
<!--GuestStart-->
td2.innerHTML='md5: '+filemd5;
<!--GuestEnd-->
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" 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>';
}
if (xhr1.status==200) { if (xhr1.status==200) {
if (xhr1.responseText=='') { if (xhr1.responseText=='') {
getuplink(i,1); getuplink(i,1);
@@ -873,10 +923,24 @@
td2.innerHTML='<!--constStr@UploadStart--> ...'; td2.innerHTML='<!--constStr@UploadStart--> ...';
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename); binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
} }
} else {
if (xhr1.status==409) {
// td2.innerHTML='nameAlreadyExists';
var html=JSON.parse(xhr1.responseText);
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
<!--GuestStart-->
td2.innerHTML='md5: '+filemd5;
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'"><!--constStr@CopyUrl--></button></div>';
<!--GuestEnd-->
<!--AdminStart-->
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" style="display:none"><!--constStr@CopyUrl--></button></div>';
<!--AdminEnd-->
} }
if (i<files.length-1) { /*if (i<files.length-1) {
i++; i++;
getuplink(i); getuplink(i);
}*/
delete uploading[upbigfilename];
} }
} }
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5); xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
@@ -887,24 +951,7 @@
} }
uploadbuttonshow(); uploadbuttonshow();
} }
function size_format(num) {
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' B';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' KB';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' MB';
}
return num.toFixed(2) + ' GB';
}
function binupfile(file,url,tdnum,filename){ function binupfile(file,url,tdnum,filename){
var label=document.getElementById('upfile_td2_'+tdnum); var label=document.getElementById('upfile_td2_'+tdnum);
var reader = new FileReader(); var reader = new FileReader();
@@ -953,7 +1000,7 @@
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--> '+remaintime.toFixed(1)+'s'; 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));
} }
} }
var C_starttime = new Date(); var C_starttime = new Date();
@@ -962,6 +1009,7 @@
var response=JSON.parse(xhr.responseText); var response=JSON.parse(xhr.responseText);
if (response['size']>0) { if (response['size']>0) {
// contain size, upload finish. 有size说明是最终返回,上传结束 // contain size, upload finish. 有size说明是最终返回,上传结束
if (totalsize>10*1024*1024) {
var xhr3 = new XMLHttpRequest(); var xhr3 = new XMLHttpRequest();
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename); xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest'); xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
@@ -969,6 +1017,7 @@
xhr3.onload = function(e){ xhr3.onload = function(e){
console.log(xhr3.responseText+','+xhr3.status); console.log(xhr3.responseText+','+xhr3.status);
} }
}
EndTime=new Date(); EndTime=new Date();
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>'; MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
if (newstartsize==0) { if (newstartsize==0) {
@@ -976,8 +1025,12 @@
} else { } else {
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>'; MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'" 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>'; delete uploading[filename];
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>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green';
// uploadbuttonshow(); // uploadbuttonshow();
<!--AdminStart--> <!--AdminStart-->
response.name=file.webkitRelativePath||response.name; response.name=file.webkitRelativePath||response.name;
@@ -986,6 +1039,7 @@
} else { } else {
if (!response['nextExpectedRanges']) { if (!response['nextExpectedRanges']) {
label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>'; label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
delete uploading[filename];
} else { } else {
var a=response['nextExpectedRanges'][0]; var a=response['nextExpectedRanges'][0];
asize=Number( a.slice(0,a.indexOf("-")) ); asize=Number( a.slice(0,a.indexOf("-")) );
@@ -1001,12 +1055,332 @@
} else { } else {
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>'; label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
} }
delete uploading[filename];
// uploadbuttonshow(); // uploadbuttonshow();
} }
} }
} }
} }
<!--UploadJsEnd--> <!--OnedriveUploadJsEnd-->
<!--AliyundriveUploadJsStart-->
function preup() {
uploadbuttonhide();
var files=document.getElementById('upload_file').files;
if (files.length<1) {
uploadbuttonshow();
return;
};
var table1=document.createElement('table');
document.getElementById('upload_div').appendChild(table1);
table1.setAttribute('class','list-table');
var timea=new Date().getTime();
var i=0;
var uploadList = setInterval(function(){
if (i<files.length) {
if (Object.keys(uploading).length<5) {
getuplink(i);
i++;
}// else console.log(Object.keys(uploading).length);
} else clearInterval(uploadList);
}, 1000);
//getuplink(i);
function getuplink(i, r=0) {
var file=files[i];
var td1;
var td2;
if (r==0) {
var tr1=document.createElement('tr');
table1.appendChild(tr1);
tr1.setAttribute('data-to',1);
td1=document.createElement('td');
tr1.appendChild(td1);
td1.setAttribute('style','width:30%;word-break:break-word;');
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
td2=document.createElement('td');
tr1.appendChild(td2);
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
}
var tdnum = timea+'_'+i;
td1=document.getElementById('upfile_td1_'+tdnum);
td2=document.getElementById('upfile_td2_'+tdnum);
var chunksize=10*1024*1024; // 分块大小
//var chunksize=100*1024; // 测试小块
/*if (file.size>100*1024*1024*1024) {
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
uploadbuttonshow();
return;
}*/
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
uploading[upbigfilename] = [i];
var spark = sha1.create();
var reader = new FileReader();
var chunksize=10*1024*1024;
var asize = 0;
var filesha1;
function readblob(start) {
var end=start+chunksize;
var blob = file.slice(start,end);
reader.readAsArrayBuffer(blob);
}
readblob(asize);
reader.onload = function(e){
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
var binary = this.result;
spark.update(binary);
asize += chunksize;
if (asize < file.size) {
readblob(asize);
} else {
filesha1 = spark.hex();
td2.innerHTML='SHA1: ' + filesha1;
<!--GuestStart-->
function getext(str) {
let p = str.lastIndexOf('.');
if (p===-1) return '';
if (p===0) return '';
return str.substr(p);
}
var ext = getext(file.webkitRelativePath||file.name);
upbigfilename = filesha1 + ext;
<!--GuestEnd-->
//while (upbigfilename.indexOf('%2F')>0) upbigfilename = upbigfilename.replace('%2F', '/');
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
var html = JSON.parse(localStorage.getItem(filesha1));
//console.log(html);
if (html!==null && ('part_info_list' in html)) {
td2.innerHTML='<!--constStr@UploadStart--> ...';
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
} else {
var xhr1 = new XMLHttpRequest();
xhr1.open("POST", '?action=upbigfile');
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr1.onload = function(e){
//console.log(xhr1.status+xhr1.responseText);
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
if (xhr1.status==201) {
if (xhr1.responseText=='') {
getuplink(i,1);
return;
}
var html=JSON.parse(xhr1.responseText);
//console.log(html);
if (!html['part_info_list']) {
if (html.name!='') {
if (html.exist==true) td2.innerHTML=html.name+' 文件名已有';
else if (html.rapid_upload==true) td2.innerHTML=html.name+' 秒传';
else td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" 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>';
} else {
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
}
delete uploading[upbigfilename];
} else {
td2.innerHTML='<!--constStr@UploadStart--> ...';
//console.log(html);
localStorage.setItem(filesha1, JSON.stringify(html));
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
}
} else {
delete uploading[upbigfilename];
}
/*if (i<files.length-1) {
i++;
getuplink(i);
}*/
}
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
}
}
}
}
uploadbuttonshow();
}
function binupfile(file, res, tdnum, filename, filesha1, chunksize) {
// xhr.getResponseHeader
if (!('ETag' in res)) res['ETag'] = new Array();
var fileid = res['file_id'];
var uploadid = res['upload_id'];
var label=document.getElementById('upfile_td2_'+tdnum);
var reader = new FileReader();
var StartStr='';
var MiddleStr='';
var StartTime;
var EndTime;
var newstartsize = 0;
if(!!file){
var chunknum = 0;
var chunknumtotal = res['part_info_list'].length;
var asize=0;
var totalsize=file.size;
var newstartsize=0;
while (res['ETag'][chunknum]!=null) {
chunknum++;
newstartsize += chunksize;
}
StartTime = new Date();
asize = newstartsize;
if (newstartsize==0) {
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
} else {
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
}
//var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小
//if (totalsize>200*1024*1024) chunksize=10*1024*1024;
function readblob(start) {
var end=start+chunksize;
var blob = file.slice(start,end);
reader.readAsArrayBuffer(blob);
//reader.readAsArrayBuffer(file);
}
readblob(asize);
reader.onload = function(e){
if (asize>totalsize) {
var xhr1 = new XMLHttpRequest();
xhr1.open("POST", '?action=upbigfile');
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr1.onload = function(e){
console.log(xhr1.responseText+','+xhr1.status);
if (xhr1.status==200) {
localStorage.removeItem(filesha1);
<!--AdminStart-->
var html=JSON.parse(xhr1.responseText);
//response.name=file.webkitRelativePath||response.name;
addelement(html);
<!--AdminEnd-->
/*if (totalsize>10*1024*1024) {
var xhr3 = new XMLHttpRequest();
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr3.send(null);
xhr3.onload = function(e){
console.log(xhr3.responseText+','+xhr3.status);
}
}*/
EndTime=new Date();
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
if (newstartsize==0) {
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
} else {
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
}
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.style.color='green';
} else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1);
}
delete uploading[filename];
}
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
} else {
var binary = this.result;
var xhr = new XMLHttpRequest();
xhr.open("PUT", res['part_info_list'][chunknum]['upload_url'], true);
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
bsize=asize+e.loaded-1;
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
xhr.upload.onprogress = function(e){
if (e.lengthComputable) {
var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
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));
}
}
var C_starttime = new Date();
xhr.onload = function(e){
if (xhr.status<500) {
//console.log(xhr.responseText);
//console.log(xhr.getResponseHeader('ETag'));
//var response=JSON.parse(xhr.responseText);
if (xhr.responseText==''&&xhr.getResponseHeader('ETag')!='') {
// 有ETag说明本段上传成功
let etag = xhr.getResponseHeader('ETag');
//if (etag.substr(0,1)=='"') etag = etag.substr(1);还就要引号!
//if (etag.substr(-1)=='"') etag = etag.substr(0, etag.length-1);
res['ETag'][chunknum] = etag;
localStorage.setItem(filesha1, JSON.stringify(res));
chunknum++;
asize = bsize + 1;
if (chunknum==chunknumtotal) {
// 上传结束
var xhr1 = new XMLHttpRequest();
xhr1.open("POST", '?action=upbigfile');
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr1.onload = function(e){
console.log(xhr1.responseText+','+xhr1.status);
if (xhr1.status==200) {
localStorage.removeItem(filesha1);
<!--AdminStart-->
var html=JSON.parse(xhr1.responseText);
//response.name=file.webkitRelativePath||response.name;
addelement(html);
<!--AdminEnd-->
/*if (totalsize>10*1024*1024) {
var xhr3 = new XMLHttpRequest();
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
xhr3.send(null);
xhr3.onload = function(e){
console.log(xhr3.responseText+','+xhr3.status);
}
}*/
EndTime=new Date();
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
if (newstartsize==0) {
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
} else {
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
}
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.style.color='green';
} else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1);
}
delete uploading[filename];
}
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
// uploadbuttonshow();
} else {
readblob(asize);
}
} else {
console.log(xhr.status+xhr.responseText);//<PartEtag>
if (xhr.status==409) {
let str = xhr.responseText;
str = str.substr(str.indexOf('<PartEtag>')+10);
str = str.substr(0, str.indexOf('</PartEtag>'));
res['ETag'][chunknum] = str;
localStorage.setItem(filesha1, JSON.stringify(res));
chunknum++;
asize += chunksize;
readblob(asize);
} else {
delete uploading[filename];
}
//label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
} } else readblob(asize);
}
xhr.send(binary);
}
}
}
}
<!--AliyundriveUploadJsEnd-->
<!--GoogledriveUploadJsStart-->
function preup() {
alert("Stop!\nCan not upload form explorer without token.");
}
<!--GoogledriveUploadJsEnd-->
<!--ListEnd--> <!--ListEnd-->
function operatediv_close(operate) { function operatediv_close(operate) {
document.getElementById(operate+'_div').style.display='none'; document.getElementById(operate+'_div').style.display='none';
@@ -1014,9 +1388,28 @@
} }
<!--AdminStart--> <!--AdminStart-->
function logout() { function logout() {
document.cookie = "admin=; path=/"; var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie = "admin=; path=/; "+expires;
location.href = location.href; location.href = location.href;
} }
/*for some mobile browser*/
function menu_click(e){
var ee=document.getElementsByClassName("active");
for(var i=0;i<ee.length;i++){
ee[i].classList.remove("active");
}
if(e.type!="mouseout")this.classList.add("active");
}
(function(){
var e=document.getElementsByClassName("operate");
document.body.addEventListener("touchstart", menu_click);
for(var i=0;i<e.length;i++){
e[i].addEventListener("touchstart", menu_click);
e[i].addEventListener("mouseout", menu_click);
}
})();
<!--IsFolderStart--> <!--IsFolderStart-->
function showdiv(event,action,num) { function showdiv(event,action,num) {
var $operatediv=document.getElementsByName('operatediv'); var $operatediv=document.getElementsByName('operatediv');
@@ -1028,21 +1421,19 @@
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px'; document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
if (num=='') { if (num=='') {
var str=''; var str='';
var fileid='';
} else { } else {
var str=document.getElementById('file_a'+num).innerText; var str=decodeURIComponent(document.getElementById('file_a'+num).href);
if (str=='') {
str=document.getElementById('file_a'+num).getElementsByTagName("img")[0].alt;
if (str=='') {
alert('<!--constStr@GetFileNameFail-->');
operatediv_close(action);
return;
}
}
if (str.substr(-1)==' ') str=str.substr(0, str.length-1); if (str.substr(-1)==' ') str=str.substr(0, str.length-1);
if (str.substr(-1)=='/') str=str.substr(0, str.length-1);
if (str.substr(-8)=='?preview') str=str.substr(0, str.length-8);
if (str.lastIndexOf('/')>-1) str=str.substr(str.lastIndexOf('/')+1);
var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue;
} }
document.getElementById(action + '_div').style.display=''; document.getElementById(action + '_div').style.display='';
document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&amp;'); document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&amp;');
document.getElementById(action + '_sid').value=num; document.getElementById(action + '_sid').value=num;
document.getElementById(action + '_fileid').value=fileid;
document.getElementById(action + '_hidden').value=str; document.getElementById(action + '_hidden').value=str;
if (action=='rename') document.getElementById(action + '_input').value=str; if (action=='rename') document.getElementById(action + '_input').value=str;
var $e = event || window.event; var $e = event || window.event;
@@ -1071,9 +1462,9 @@
function submit_operate(str) { function submit_operate(str) {
var num=document.getElementById(str+'_sid').value; var num=document.getElementById(str+'_sid').value;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("GET", '?'+serializeForm(str+'_form')); xhr.open("POST", '');
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest'); xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
xhr.send(null);
xhr.onload = function(e){ xhr.onload = function(e){
var html; var html;
if (xhr.status<300) { if (xhr.status<300) {
@@ -1089,10 +1480,12 @@
html=JSON.parse(xhr.responseText); html=JSON.parse(xhr.responseText);
addelement(html); addelement(html);
} }
//alert('success');
} else alert(xhr.status+'\n'+xhr.responseText); } else alert(xhr.status+'\n'+xhr.responseText);
document.getElementById(str+'_div').style.display='none'; document.getElementById(str+'_div').style.display='none';
document.getElementById('mask').style.display='none'; document.getElementById('mask').style.display='none';
} }
xhr.send(serializeForm(str+'_form'));
return false; return false;
} }
function addelement(html) { function addelement(html) {
@@ -1106,15 +1499,16 @@
a1.target='_blank'; a1.target='_blank';
var td2=document.createElement('td'); var td2=document.createElement('td');
td2.setAttribute('class','updated_at'); td2.setAttribute('class','updated_at');
td2.innerText=html.lastModifiedDateTime.replace(/T/,' ').replace(/Z/,''); if (!!html.time) td2.innerText=html.time.replace(/T/,' ').replace(/Z/,'');
var td3=document.createElement('td'); var td3=document.createElement('td');
td3.setAttribute('class','size'); td3.setAttribute('class','size');
td3.innerText=size_format(html.size); if (!!html.size) td3.innerText=size_format(html.size);
if (!!html.folder) { else td3.innerText='0 B';
if (html.type=='folder') {
a1.href+='/'; a1.href+='/';
document.getElementById('tr0').parentNode.insertBefore(tr1,document.getElementById('tr0').nextSibling); document.getElementById('tr0').parentNode.insertBefore(tr1,document.getElementById('tr0').nextSibling);
} }
if (!!html.file) { if (html.type=='file') {
a1.href+='?preview'; a1.href+='?preview';
a1.name='filelist'; a1.name='filelist';
document.getElementById('tr0').parentNode.appendChild(tr1); document.getElementById('tr0').parentNode.appendChild(tr1);
@@ -1188,18 +1582,11 @@
} }
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--AdminEnd--> <!--AdminEnd-->
<!--LoginStart--> <!--EncryptedStart-->
function login() { document.getElementById('password1').focus();
document.getElementById('mask').style.display=''; <!--EncryptedEnd-->
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
document.getElementById('login_div').style.display='';
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus();
}
<!--LoginEnd-->
</script> </script>
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>
+5 -5
View File
@@ -3,9 +3,9 @@
"music":"musical-notes", "music":"musical-notes",
"video":"logo-youtube", "video":"logo-youtube",
"img":"image", "img":"image",
"office":"paper", "office":"newspaper",
"txt":"clipboard", "txt":"clipboard",
"zip":"filing", "zip":"file-tray-full",
"iso":"disc", "iso":"disc",
"apk":"logo-android", "apk":"logo-android",
"exe":"logo-windows", "exe":"logo-windows",
@@ -89,7 +89,7 @@
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul> <li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
<!--IsFolderStart--> <!--IsFolderStart-->
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li> <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li> <li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
<!--IsFolderEnd--> <!--IsFolderEnd-->
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li> <li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
@@ -240,7 +240,7 @@
<!--AdminStart--> <!--AdminStart-->
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a> <li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
<ul> <ul>
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li> <li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li> <li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li> <li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li> <li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
@@ -1248,6 +1248,6 @@
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--customScript--> <!--customScript-->
</html> </html>
+246 -91
View File
File diff suppressed because one or more lines are too long
+10 -1
View File
@@ -1,7 +1,16 @@
20210817-2030.39
fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
20210804-1535.38
try fix "&"/"&amp;" in filename. try show an img too height. change upload chunk size when upload speed>10M/s. fix forceHttps when custom domain in Glitch. fix ionicons svg lost.try use file id when rename. background (or other) based on width/height not only width. fix some bugs. Pre-Add platform Vercel, just wait bugs fixed.
尝试修复文件名含 "&"/"&amp;"。尝试在一屏内显示过长的图片。上传时分割的块大小随着上传速度改变。修复Glitch中使用自定义域名时forceHttps问题。修复ionicons图标失踪。尝试在重命名时使用file id来操作。背景(或其它)基于长宽来看是竖屏还是横屏,不再只看宽度。修复其它bug。预加入Vercel平台,等修复bugs。
20210512-1648.37
add setting "forceHttps", can force 302 jump to https. fix preview office files. fix manage in safari.fix disktag can be "home". fix some bugs.
新增一个设置,可以强制跳转https。修复office文档预览。修复safari上点不了管理。盘的标签可以是home了,随便命名了。修复一些其它问题。
20210331-1530.36 20210331-1530.36
admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs. admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs.
暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。 暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。
20210313-1352.35 20210313-1352.35
use driveId, after update, <font color="red">Aliyundrive and Googledrive please click the Change link after Driver type</font>. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file. use driveId, after update, <font color="red">Aliyundrive and Googledrive please click the Change link after Driver type</font>. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file.
换用driveId,更新后<font color="red">Aliyundrive与Googledrive请点一下那个切换链接</font>。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。 换用driveId,更新后<font color="red">Aliyundrive与Googledrive请点一下那个切换链接</font>。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。