pull/610/head
gd1214b 2022-07-26 15:01:52 +08:00
commit 076503a692
16 changed files with 289 additions and 68 deletions

View File

@ -42,6 +42,7 @@ $EnvConfigs = [
'globalHeadMdUrl' => 0b011,
'globalReadmeMdUrl' => 0b011,
'globalFootOmfUrl' => 0b011,
'bcmathUrl' => 0b011,
'Driver' => 0b100,
'client_id' => 0b100,
@ -56,6 +57,7 @@ $EnvConfigs = [
'activeLimit' => 0b100,
'driveId' => 0b100,
'diskDisplay' => 0b110,
'diskname' => 0b111,
'diskDescription' => 0b111,
'domain_path' => 0b111,
@ -272,7 +274,7 @@ function main($path)
$files['type'] = 'folder';
$files['childcount'] = count($disktags);
$files['showname'] = 'root';
foreach ($disktags as $disktag) {
foreach ($disktags as $disktag) if ($_SERVER['admin']||getConfig('diskDisplay', $disktag)=='') {
$files['list'][$disktag]['type'] = 'folder';
$files['list'][$disktag]['name'] = $disktag;
$files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
@ -286,7 +288,7 @@ function main($path)
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/');
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
if (!in_array($_SERVER['disktag'], $disktags)) {
if ((!$_SERVER['admin']&&getConfig('diskDisplay', $_SERVER['disktag'])=='disable')||!in_array($_SERVER['disktag'], $disktags)) {
$tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
if (!!$_GET) {
$tmp .= '?';
@ -320,12 +322,13 @@ function main($path)
//error_log1($_SERVER['REQUEST_METHOD']);
if ($_GET['action']=='del_upload_cache') {
// del '.tmp' without login. 无需登录即可删除.tmp后缀文件
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
return $drive->del_upload_cache($path);
}
if ($_GET['action']=='upbigfile') {
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
if (!$_SERVER['admin']) {
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
@ -334,7 +337,20 @@ function main($path)
return $drive->bigfileupload($path1);
}
}
if ($_GET['action']=='upsmallfile') {
//echo json_encode($_POST, JSON_PRETTY_PRINT);
//echo json_encode($_FILES, JSON_PRETTY_PRINT);
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
if (!$_SERVER['admin']) {
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
}
return smallfileupload($drive, $path);
/*if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);*/
}
if ($_SERVER['admin']) {
$tmp = adminoperate($path);
if ($tmp['statusCode'] > 0) {
@ -385,6 +401,7 @@ function main($path)
} else {
$files = $drive->list_files($path1);
}
//echo "<pre>" . json_encode($files, 448) . "</pre>";
//if ($path!=='')
if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
$tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
@ -446,26 +463,34 @@ function main($path)
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
if (!!$fileConduitSize || !!$fileConduitCacheTime) {
if ($fileConduitSize>1) $fileConduitSize *= 1024*1024;
if ($fileConduitSize>0) $fileConduitSize *= 1024*1024;
else $fileConduitSize = 1024*1024;
if ($fileConduitCacheTime>1) $fileConduitCacheTime *= 3600;
if ($fileConduitCacheTime>0) $fileConduitCacheTime *= 3600;
else $fileConduitCacheTime = 3600;
/*if ($_SERVER['HTTP_RANGE']!='') {
$header['Range'] = $_SERVER['HTTP_RANGE'];
$response = curl('GET', $files['url'], '', $header, 1);
//return output($header['Range'] . json_encode($response['returnhead']));
return output(
$response['body'],
$response['stat'],
//$response['returnhead'],
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
$response['returnhead'],
//['Accept-Ranges' => 'bytes', 'Range' => $response['returnhead']['Range'], 'Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
false
);
} else {
return output('', 206,
['Accept-Ranges' => 'bytes', 'Content-Range' => 'bytes 0-0/' . $files['size'], 'Content-Type' => $files['mime'] ]
);
}*/
if ($files['size']<$fileConduitSize) return output(
base64_encode(file_get_contents($files['url'])),
200,
[
'Accept-Ranges' => 'bytes',
//'access-control-allow-origin' => '*',
//'access-control-expose-headers' => 'Content-Length, WWW-Authenticate, Location, Accept-Ranges',
'Content-Type' => $files['mime'],
'Cache-Control' => 'max-age=' . $fileConduitCacheTime,
//'Cache-Control' => 'max-age=0',
@ -473,6 +498,7 @@ function main($path)
],
true
);
//if ($files['size']<$fileConduitSize) return $drive->ConduitDown($files['url'], $files['time'], $fileConduitCacheTime);
}
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
$header['Location'] = $url;
@ -490,12 +516,13 @@ function main($path)
return render_list($path, $files);
} else {
if (!isset($files['error'])) {
if (is_array($files)) $files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
else $files['error']['message'] = $files;
$files['error']['code'] = 'unknownError';
$files['error']['stat'] = 500;
if (is_array($files)) {
$files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
$files['error']['code'] = 'unknownError';
$files['error']['stat'] = 500;
}
}
return message('<div style="margin:8px;"><pre>' . $files['error']['message'] . '</pre></div><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>', $files['error']['code'], $files['error']['stat']);
return message('<div style="margin:8px;"><pre>' . $files.json_encode($files, JSON_PRETTY_PRINT) . '</pre></div><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>', $files['error']['code'], $files['error']['stat']);
}
}
@ -857,7 +884,7 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
@ -869,7 +896,9 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
if ($location) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//$response['body'] = curl_exec($ch);
if ($returnheader) {
list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch));
$tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
$result['body'] = $tmpres[1];
$returnhead = $tmpres[0];
//echo "HEAD:" . $returnhead;
foreach (explode("\r\n", $returnhead) as $head) {
$tmp = explode(': ', $head);
@ -879,7 +908,7 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
} else {
$response['body'] = curl_exec($ch);
}
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
$response['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $response;
}
@ -1071,7 +1100,7 @@ function needUpdate()
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
{
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
if (baseclassofdrive()=='Aliyundrive') $headers['Referrer-Policy'] = 'no-referrer';
if (baseclassofdrive()=='Aliyundrive' || baseclassofdrive()=='BaiduDisk') $headers['Referrer-Policy'] = 'no-referrer';
//$headers['Referrer-Policy'] = 'same-origin';
//$headers['X-Frame-Options'] = 'sameorigin';
return [
@ -1208,7 +1237,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
function adminoperate($path)
{
global $drive;
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
$path1 = path_format($_SERVER['list_path'] . '/' . $path);
if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
$tmpget = $_GET;
@ -1523,7 +1552,7 @@ function EnvOpt($needUpdate = 0)
$html .= '
OneManager DIR: ' . __DIR__ . '
<form name="form1" method="POST" action="">
<input id="inputarea" name="cmd" style="width:100%" value="' . $_POST['cmd'] . '" placeholder="ls, pwd, cat"><br>
<input id="inputarea" name="cmd" style="width:100%" value="' . htmlspecialchars($_POST['cmd']) . '" placeholder="ls, pwd, cat"><br>
<input type="submit" value="post">
</form>';
if ($_POST['cmd']!='') {
@ -1670,11 +1699,26 @@ output:
<input name="_admin" type="hidden" value="">
<input type="hidden" name="disk" value="' . $disktag . '">';
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
$frame .= '
if ($key=='diskDisplay') {
$frame .= '
<tr>
<td><label>' . $key . '</label></td>
<td width=100%>
<select name="' . $key . '">
<option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option>
<option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option>
<option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option>
</select>
' . getconstStr('EnvironmentsDescription')[$key] . '
</td>
</tr>';
} else {
$frame .= '
<tr>
<td><label>' . $key . '</label></td>
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
</tr>';
}
}
$frame .= '
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
@ -2159,7 +2203,13 @@ function render_list($path = '', $files = [])
$p_path='';
if ($path1 !== '/') {
if ($files['type']=='file') {
$pretitle = str_replace('&','&amp;', $files['name']);
if (isset($files['name'])) {
$pretitle = str_replace('&','&amp;', $files['name']);
} else {
if (substr($path1, 0, 1)=='/') $pretitle = substr($path1, 1);
if (substr($path1, -1)=='/') $pretitle = substr($pretitle, 0, -1);
$pretitle = str_replace('&','&amp;', $pretitle);
}
$n_path = $pretitle;
$tmp = splitlast(splitlast($path1,'/')[0],'/');
if ($tmp[1]=='') {
@ -2928,7 +2978,7 @@ function render_list($path = '', $files = [])
$MultiDiskArea = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--MultiDisksEnd-->');
$MultiDisks = $tmp[0];
foreach ($disktags as $disk) {
foreach ($disktags as $disk) if ($_SERVER['admin']||getConfig('diskDisplay', $disk)=='') {
$diskname = getConfig('diskname', $disk);
if ($diskname=='') $diskname = $disk;
$MultiDisksStr = str_replace('<!--MultiDisksUrl-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);

View File

@ -321,7 +321,6 @@ class Aliyundrive {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
}
public function Copy($file) {
return output('NO copy', 415);
if (!$file['id']) {
$oldfile = $this->list_path($file['path'] . '/' . $file['name']);
//error_log1('res:' . json_encode($res));
@ -329,47 +328,60 @@ class Aliyundrive {
} else {
$oldfile = $this->fileGet($file['id']);
}
$url = $this->api_url . '/file/create';
$header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token;
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
$data['content_hash'] = $oldfile['content_hash'];
$data['content_hash_name'] = 'sha1';
$data['content_type'] = $oldfile['content_type'];
$data['drive_id'] = $this->driveId;
$data['ignoreError'] = false;
$data['name'] = $oldfile['name'];
$data['parent_file_id'] = $oldfile['parent_file_id'];
$data['part_info_list'][0]['part_number'] = 1;
$data['size'] = $oldfile['size'];
$data['type'] = 'file';
$result = curl('POST', $url, json_encode($data), $header);
if ($result['stat']==201) {
//error_log1('1,url:' . $url .' res:' . json_encode($result));
$res = json_decode($result['body'], true);
$url = $res['part_info_list'][0]['upload_url'];
if (!$url) { // 无url应该算秒传
return output('no up url', 200);
if ($oldfile['type']=='folder') return output('Can not copy folder', 415);
if (!function_exists('bcadd')) {
// no php-bcmath
if ($bcmathurl = getConfig('bcmathUrl', $this->disktag)) {
if (strpos($bcmathurl, '?')) {
$bcmathurl .= '&dividend=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
} else {
$bcmathurl .= '?dividend=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
}
$o = curl('GET', $bcmathurl)['body'];
} else {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
return output('No bcmath module, can not copy', 415);
}
/*$file_id = $res['file_id'];
$upload_id = $res['upload_id'];
$result = curl('PUT', $url, $content, [], 1);
if ($result['stat']==200) { // 块1传好
$etag = $result['returnhead']['ETag'];
$result = $this->fileComplete($file_id, $upload_id, [ $etag ]);
if ($result['stat']!=200) return output($result['body'], $result['stat']);
else return output('success', 0);
}*/
} else {
$r = bchexdec( substr(md5($this->access_token), 0, 16) );
$o = bcmod($r, $oldfile['size']);
}
//error_log1('2,url:' . $url .' res:' . json_encode($result));
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
$res = curl('GET', $oldfile['download_url'], '', [
'Referer' => ''
, 'Range' => 'bytes=' . $o . '-' . ($o+7)
]);
if ($res['stat']==206) {
$proof_code = base64_encode($res['body']);
$url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
$header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token;
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
$data['content_hash'] = $oldfile['content_hash'];
$data['content_hash_name'] = 'sha1';
$data['drive_id'] = $this->driveId;
$data['name'] = $oldfile['name'];
$data['parent_file_id'] = $oldfile['parent_file_id'];
$data['part_info_list'][0]['part_number'] = 1;
$data['proof_code'] = $proof_code;
$data['proof_version'] = 'v1';
$data['size'] = $oldfile['size'];
$data['type'] = 'file';
$result = curl('POST', $url, json_encode($data), $header);
/*if ($result['stat']==201) {
$res = json_decode($result['body'], true);
if ($res['rapid_upload']) return output('rapid upload', 200);
$url = $res['part_info_list'][0]['upload_url'];
if (!$url) { // 无url应该算秒传
return output('no up url', 200);
} else {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
}
}*/
//error_log1('2,url:' . $url .' res:' . json_encode($result));
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
} else {
return output("Get proof error\n" . json_encode($res), 415);
}
}
public function Edit($file, $content) {
$tmp = splitlast($file['path'], '/');
@ -564,6 +576,60 @@ class Aliyundrive {
$thumb_url = $res['thumbnail'];
return $thumb_url;
}
public function smallfileupload($path, $tmpfile) {
if (!$_SERVER['admin']) {
$tmp1 = splitlast($tmpfile['name'], '.');
if ($tmp1[0]==''||$tmp1[1]=='') $filename = sha1_file($tmpfile['tmp_name']);
else $filename = sha1_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
} else {
$filename = $tmpfile['name'];
}
//$content = file_get_contents($tmpfile['tmp_name']);
$result = $this->tmpfileCreate($this->list_path($_SERVER['list_path'] . '/' . $path . '/')['file_id'], $tmpfile['tmp_name'], $filename);
//error_log1('1,url:' . $url .' res:' . json_encode($result));
if ($result['stat']==201) {
$res = json_decode($result['body'], true);
$url = $res['part_info_list'][0]['upload_url'];
if (!$url) { // 无url应该算秒传
//return output('no up url', 0);
$a = 1;
} else {
$file_id = $res['file_id'];
$upload_id = $res['upload_id'];
//$result = curl('PUT', $url, $content, [], 1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$fh_res = fopen($tmpfile['tmp_name'], 'r');
curl_setopt($ch, CURLOPT_INFILE, $fh_res);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($tmpfile['tmp_name']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
$result['body'] = $tmpres[1];
$returnhead = $tmpres[0];
foreach (explode("\r\n", $returnhead) as $head) {
$tmp = explode(': ', $head);
$heads[$tmp[0]] = $tmp[1];
}
$result['returnhead'] = $heads;
$result['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
fclose($fh_res);
curl_close($ch);
//error_log1('2,url:' . $url .' res:' . json_encode($result));
if ($result['stat']==200) { // 块1传好
$result = $this->fileComplete($file_id, $upload_id, [ $result['returnhead']['ETag'] ]);
//error_log1('3, res:' . json_encode($result));
//if ($result['stat']!=200) return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
//else return output('success', 0);
}
}
$res = json_decode($result['body'], true);
//if (isset($res['url']))
$res['download_url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
}
return output(json_encode($this->files_format($res), JSON_UNESCAPED_SLASHES), $result['stat']);
}
public function bigfileupload($path)
{
if (isset($_POST['uploadid'])) {
@ -582,7 +648,6 @@ class Aliyundrive {
$i = $_POST['filesize'];
//$o = $i ? bcmod($r, $i) : 0;
$o = bcmod($r, $i);
//return output(hexdec( substr(md5($this->access_token), 0, 16) ) . ' , ' . $r . ' / ' . $i . ' = ' . $o, 200);
return output($o, 200);
}*/
}

View File

@ -973,6 +973,20 @@ class Onedrive {
return $thumb_url;
}
public function smallfileupload($path, $tmpfile) {
if (!$_SERVER['admin']) {
$tmp1 = splitlast($tmpfile['name'], '.');
if ($tmp1[0]==''||$tmp1[1]=='') $filename = md5_file($tmpfile['tmp_name']);
else $filename = md5_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
} else {
$filename = $tmpfile['name'];
}
$content = file_get_contents($tmpfile['tmp_name']);
$result = $this->MSAPI('PUT', path_format($_SERVER['list_path'] . '/' . $path . '/' . $filename), $content);
$res = $this->files_format(json_decode($result['body'], true));
if (isset($res['url'])) $res['url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
return output(json_encode($res, JSON_UNESCAPED_SLASHES), $result['stat']);
}
public function bigfileupload($path)
{
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);

View File

@ -67,7 +67,9 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
} else {
include 'platform/Normal.php';
if (!function_exists('curl_init')) {
return message('<font color="red">Need curl</font>, please install php-curl.', 'Error', 500);
http_response_code(500);
echo '<font color="red">Need curl</font>, please install php-curl.';
exit(1);
}
$path = getpath();
//echo 'path:'. $path;

View File

@ -546,3 +546,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through FC.', 400);
}

View File

@ -485,3 +485,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through CFC.', 400);
}

View File

@ -415,3 +415,9 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -536,3 +536,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through FG.', 400);
}

View File

@ -902,3 +902,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through FG.', 400);
}

View File

@ -391,3 +391,9 @@ function WaitFunction() {
function changeAuthKey() {
return message("Not need.", 'Change platform Auth token or key', 404);
}
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -355,3 +355,9 @@ function WaitFunction() {
function changeAuthKey() {
return message("Not need.", 'Change platform Auth token or key', 404);
}
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -662,3 +662,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through SCF.', 400);
}

View File

@ -705,3 +705,7 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
return output('Can not upload through SCF.', 400);
}

View File

@ -316,7 +316,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$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";
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.5.1";
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
//echo $sourcePath . "<br>";
getEachFiles($file, $sourcePath);
@ -432,7 +432,7 @@ function WaitFunction($deployid = '') {
}
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/deployments/" . $deployid;
$url = "https://api.vercel.com/v13/deployments/" . $deployid;
$response = curl("GET", $url, "", $header);
if ($response['stat']==200) {
$result = json_decode($response['body'], true);
@ -489,3 +489,9 @@ function changeAuthKey() {
</script>';
return message($html, 'Change platform Auth token or key', 200);
}
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -665,6 +665,21 @@
disableAutoFetch: true,
rangeChunkSize: 65535
});
/*loadingTask.onProgress = (e) => {
//console.log(e);
var p = document.getElementById('p');
if (p==null) {
p = document.createElement('div');
p.id = 'p';
p.setAttribute('onclick', "this.style.display = 'none';");
p.style = 'left: 10px; top: 30%; position: fixed;';
document.body.appendChild(p);
}
p.innerHTML = 'Loaded: ' + ((e.loaded/e.total)*100).toFixed(2) + '%<br>(' + size_format(e.loaded) + ' / ' + size_format(e.total) + ')';
p.style.display = '';
if (e.loaded==e.total) p.style.display = 'none';
}*/
loadingTask.promise.then(function(pdf) {
var pagenum = pdf.numPages;
var pdfContainer = document.getElementById('pdf-d');
@ -678,7 +693,6 @@
pdfContainer.appendChild(pdfnextpagebutton);
var pdfWaitNextPage = setInterval(function(){
//console.log(document.documentElement.scrollTop + ", " + document.body.scrollHeight);
console.log("next page: " + pagepos + " / " + pagenum);
if (pdfnextpagebutton.style.display=='none') {
for (var i=pagepos;i<=(pagepos+4<pagenum?pagepos+4:pagenum);i++) {
var canvasNew = document.createElement('canvas');
@ -688,6 +702,7 @@
}
pagepos = i;
if (pagepos<pagenum) {
console.log("next page: " + pagepos + " / " + pagenum);
pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
pdfnextpagebutton.style.display ='';
pdfContainer.appendChild(pdfnextpagebutton);
@ -713,6 +728,24 @@
page.render(renderContext);
});
}
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';
}
<!--IspdfFileEnd-->
<!--IsFileEnd-->
<!--IsFolderStart-->

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link rel="preconnect" href="https://fastly.jsdelivr.net" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<meta charset="utf-8" />
@ -15,8 +15,13 @@
content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"
/>
<title><!--Title--></title>
<<<<<<< HEAD
<meta name="description" content="gd1214b's OneManager" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn/css/app.min.css"><meta name="theme-color" content="#fff" />
=======
<meta name="description" content="A Onemanager-PHP site with Theme-renexmoe" />
<link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/css/app.css"><meta name="theme-color" content="#fff" />
>>>>>>> 94f780963b612b2f91ec8f92939e9382b1271823
<!--BackgroundStart-->
<style>
body {
@ -510,6 +515,7 @@
{ "music":"audiotrack", "video":"ondemand_video", "img":"image",
"pdf":"picture_as_pdf", "default":"insert_drive_file"}
<!--IconValuesEnd-->
<<<<<<< HEAD
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script>
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script>
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script>
@ -517,4 +523,7 @@
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script>
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script>
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script>
=======
<script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@798ab416.9ed46bb752b71a3c13a4.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script>
>>>>>>> 94f780963b612b2f91ec8f92939e9382b1271823
</html>