From 457e2cee18e7facaa9c2d200888842180579825e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:45:49 +0800 Subject: [PATCH 01/12] try to check exist curl before install --- platform/Normal.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/Normal.php b/platform/Normal.php index 2e7782b..880fdf9 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -278,8 +278,14 @@ language:
'; $title = getconstStr('SelectLanguage'); return message($html, $title, 201); } - $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind'); - $title = 'Install'; + + if (function_exists('curl_init')) { + $title = 'Install'; + $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind'); + } else { + $title = 'Error'; + $html = 'Need curl, please install php-curl.'; + } return message($html, $title, 201); } From 51cc75c0f598e8e7219c92fb937e3582e4292cd2 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:49:35 +0800 Subject: [PATCH 02/12] try fix encrypt current directory at left-top --- theme/classic.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/theme/classic.html b/theme/classic.html index c3919a1..17b04a9 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -229,7 +229,7 @@
- +     @@ -1477,17 +1477,18 @@ document.getElementById('mask').style.display=''; //document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px'; document.getElementById('mask').style.height=document.documentElement.scrollHeight-1) str=str.substr(str.lastIndexOf('/')+1); - var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue; } + var fileid = document.getElementById('file_a'+num).attributes['fileid'].nodeValue; document.getElementById(action + '_div').style.display=''; document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&'); document.getElementById(action + '_sid').value=num; From 880f90b026d2b3763247bacecb3d1f72dfb959a5 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:50:13 +0800 Subject: [PATCH 03/12] try fix encrypt current directory at left-top --- common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/common.php b/common.php index 2abb476..3ae7d43 100644 --- a/common.php +++ b/common.php @@ -2394,6 +2394,7 @@ function render_list($path = '', $files = []) $html = str_replace('', '', $html); } $html = str_replace('', getconstStr('File'), $html); + while (strpos($html, '')) $html = str_replace('', $files['id'], $html); $html = str_replace('', getconstStr('ShowThumbnails'), $html); $html = str_replace('', getconstStr('CopyAllDownloadUrl'), $html); $html = str_replace('', getconstStr('EditTime'), $html); From 4577a35b83f2c944b7f80710ad68e71eb339e623 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:36:28 +0800 Subject: [PATCH 04/12] Redirect when folder not end with / #465 fix --- common.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/common.php b/common.php index 3ae7d43..87fc498 100644 --- a/common.php +++ b/common.php @@ -256,6 +256,8 @@ function main($path) // echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.''; $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']); if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/'; + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + if ($path1!='/' && substr($path1,-1)=='/') $path1 = substr($path1, 0, -1); $_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['ajax']=0; if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1; @@ -308,8 +310,6 @@ function main($path) if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); } - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1); return $drive->bigfileupload($path1); } } @@ -317,8 +317,6 @@ function main($path) if ($_SERVER['admin']) { $tmp = adminoperate($path); if ($tmp['statusCode'] > 0) { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1 = substr($path1, 0, -1); savecache('path_' . $path1, '', $_SERVER['disktag'], 1); return $tmp; } @@ -329,8 +327,6 @@ function main($path) if (isset($_GET['thumbnails'])) { if ($_SERVER['ishidden']<4) { if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1, -1)=='/') $path1=substr($path1, 0, -1); $thumb_url = $drive->get_thumbnails_url($path1); if ($thumb_url!='') { if ($_GET['location']) { @@ -356,16 +352,22 @@ function main($path) if (!getConfig('downloadencrypt', $_SERVER['disktag'])) { $files = json_decode('{"type":"folder"}', true); } else { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1); $files = $drive->list_files($path1); if ($files['type']=='folder') $files = json_decode('{"type":"folder"}', true); } } else { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1); $files = $drive->list_files($path1); } + if ( $files['type']=='folder' && substr($path, -1)!=='/' ) { + $tmp = path_format($_SERVER['base_disk_path'] . $path . '/'); + return output(' + +308 Permanent Redirect + +

Permanent Redirect

+

The document has moved here.

+', 308, [ 'Location' => $tmp ]); + } if ($_GET['json']) { // return a json From 2dfd11c8d11b3b6f9f42265738d276b66a1c2ab3 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:39:57 +0800 Subject: [PATCH 05/12] check if exist curl in vps at begin #462 check curl mod --- index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.php b/index.php index 56fecf2..a06dc76 100644 --- a/index.php +++ b/index.php @@ -49,6 +49,9 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { else echo $re['body']; } else { include 'platform/Normal.php'; + if (!function_exists('curl_init')) { + return message('Need curl, please install php-curl.', 'Error', 500); + } $path = getpath(); //echo 'path:'. $path; $_GET = getGET(); From 83ee24fc90a2e4edd1e880229e069f6ee823ba83 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:41:25 +0800 Subject: [PATCH 06/12] check if exist curl in vps at php start, not install --- platform/Normal.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/platform/Normal.php b/platform/Normal.php index 880fdf9..5002b19 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -279,13 +279,8 @@ language:
'; return message($html, $title, 201); } - if (function_exists('curl_init')) { - $title = 'Install'; - $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind'); - } else { - $title = 'Error'; - $html = 'Need curl, please install php-curl.'; - } + $title = 'Install'; + $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind'); return message($html, $title, 201); } From 7627fd78eb6ecf2e03edb230f30d66a0aa36be34 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 8 Nov 2021 18:48:53 +0800 Subject: [PATCH 07/12] Update readme_cn.md --- readme_cn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme_cn.md b/readme_cn.md index 5363588..c17d086 100644 --- a/readme_cn.md +++ b/readme_cn.md @@ -132,7 +132,7 @@ 1. 新建函数 -- HTTP函数 2. 运行环境选择php7.2 3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个 -4. 上传代码 +4. 上传代码(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。) 5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。 6. 访问你的域名,开始安装 From e34cfb173c1491a7302b280f00e0e0f32659740f Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 8 Nov 2021 18:55:59 +0800 Subject: [PATCH 08/12] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 193d7d1..3f12e7d 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ # NOTICE: - The release is used as archive. + The Releases is used as archive, not newest code. Please read the descriptions of settings before raising an issue. From 2f48674ef8a0619a2f68be70d284e4f5996ffbb8 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 8 Nov 2021 18:56:39 +0800 Subject: [PATCH 09/12] Update readme_cn.md --- readme_cn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme_cn.md b/readme_cn.md index c17d086..5d45aaf 100644 --- a/readme_cn.md +++ b/readme_cn.md @@ -2,7 +2,7 @@ # 注意: - release只是当存档用的。 + Releases只是当存档在用的,并不是最新代码。 请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。 From 724f357fc4d70be5827ddaf083792679089d375c Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 10 Nov 2021 18:40:24 +0800 Subject: [PATCH 10/12] fix: too many redirect in SCF long link --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 87fc498..a2723a1 100644 --- a/common.php +++ b/common.php @@ -358,7 +358,7 @@ function main($path) } else { $files = $drive->list_files($path1); } - if ( $files['type']=='folder' && substr($path, -1)!=='/' ) { + if ($path!=='') if ( $files['type']=='folder' && substr($path, -1)!=='/' ) { $tmp = path_format($_SERVER['base_disk_path'] . $path . '/'); return output(' From 9d677c8aeec5be8569e2be229fc97a5c5f0d90b4 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Nov 2021 11:42:19 +0000 Subject: [PATCH 11/12] fix: too many redirect in SCF/FC/FG/CFC --- platform/AliyunFC.php | 3 --- platform/BaiduCFC.php | 2 -- platform/HuaweiFG_env.php | 2 -- platform/HuaweiFG_file.php | 2 -- platform/TencentSCF_env.php | 2 -- platform/TencentSCF_file.php | 2 -- 6 files changed, 13 deletions(-) diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index 09c5f49..2618d89 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -54,9 +54,6 @@ function GetPathSetting($event, $context) //$_SERVER['base_path'] = substr($tmp, 0, strlen(urldecode($event['path']))); } $_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/'); - - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['clientIP']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0]; diff --git a/platform/BaiduCFC.php b/platform/BaiduCFC.php index c8ba09e..f2b21e6 100644 --- a/platform/BaiduCFC.php +++ b/platform/BaiduCFC.php @@ -34,8 +34,6 @@ function GetPathSetting($event, $context) $_SERVER['functionBrn'] = $context['functionBrn']; $_SERVER['base_path'] = '/'; $path = $event['path']; - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With']; diff --git a/platform/HuaweiFG_env.php b/platform/HuaweiFG_env.php index d65ae59..d3cebd9 100644 --- a/platform/HuaweiFG_env.php +++ b/platform/HuaweiFG_env.php @@ -57,8 +57,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; diff --git a/platform/HuaweiFG_file.php b/platform/HuaweiFG_file.php index 38422fa..64e6199 100644 --- a/platform/HuaweiFG_file.php +++ b/platform/HuaweiFG_file.php @@ -57,8 +57,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; diff --git a/platform/TencentSCF_env.php b/platform/TencentSCF_env.php index 6210d6b..c8084ae 100644 --- a/platform/TencentSCF_env.php +++ b/platform/TencentSCF_env.php @@ -41,8 +41,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = $event['requestContext']['path']; $path = substr($event['path'], strlen($event['requestContext']['path'])); } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; diff --git a/platform/TencentSCF_file.php b/platform/TencentSCF_file.php index 27acaa1..78e8600 100644 --- a/platform/TencentSCF_file.php +++ b/platform/TencentSCF_file.php @@ -41,8 +41,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = $event['requestContext']['path']; $path = substr($event['path'], strlen($event['requestContext']['path'])); } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; From 06988494b30577e6027e50547f0b24f1c6fe20f1 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 14 Nov 2021 17:17:17 +0800 Subject: [PATCH 12/12] order_by name asc --- disk/Aliyundrive.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/disk/Aliyundrive.php b/disk/Aliyundrive.php index 795fd59..6dd2875 100644 --- a/disk/Aliyundrive.php +++ b/disk/Aliyundrive.php @@ -194,8 +194,8 @@ class Aliyundrive { $data['image_url_process'] = 'image/resize,w_1920/format,jpeg'; $data['video_thumbnail_process'] = 'video/snapshot,t_0,f_jpg,w_300'; $data['fields'] = '*'; - $data['order_by'] = 'updated_at'; - $data['order_direction'] = 'DESC'; + $data['order_by'] = 'name'; //updated_at + $data['order_direction'] = 'ASC'; //DESC $res = curl('POST', $url, json_encode($data), $header); //error_log1($res['stat'] . $res['body']);