From b41bdbdf70e276cf964f7fbb68a33b61a15b1dec Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 08:46:48 +0800 Subject: [PATCH 1/6] Update readme.md --- readme.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 6de9882..4ee94f1 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,9 @@ QQ Group: 943919989 Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw +### Install program first, then add onedrive in setup after login. +### 先安装程序,登录后在设置中添加onedrive。 + # Deploy to heroku Official: https://heroku.com @@ -20,13 +23,13 @@ How to Install: 让代码中的config.php文件程序可读写,推荐chmod 666 config.php。 5.View the website in chrome or other. 在浏览器中访问。 - 6.Follow the guide, bind your onedrive. - 根据引导,绑定你的OneDrive。 # Deploy to SCF Official: https://cloud.tencent.com/product/scf -How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview +~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview ~~ + +先在环境变量添加Region,ap-hongkong或ap-guangzhou之类,再安装。 DEMO: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/ @@ -39,7 +42,7 @@ The XXX_path in setting is the path in Onedrive, not in url, program will find t 设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。 LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited. 网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。 -Program will show content of 'readme.md' under file list. +Program will show content of 'readme.md' & 'head.md'. 可以在文件列表下面显示readme.md文件的内容。 guest up path, is a folder that the guest can upload files, but can not be list (exclude admin). 游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。 From ae66d7a9ed7e01c6d98cdadedca77e8757324987 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:33:07 +0800 Subject: [PATCH 2/6] Update readme.md --- readme.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 4ee94f1..694c284 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,5 @@ -QQ Group: 943919989 -Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw - -### Install program first, then add onedrive in setup after login. -### 先安装程序,登录后在设置中添加onedrive。 +Install program first, then add onedrive in setup after login. +先安装程序,登录后在设置中添加onedrive。 # Deploy to heroku Official: https://heroku.com @@ -27,7 +24,7 @@ How to Install: # Deploy to SCF Official: https://cloud.tencent.com/product/scf -~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview ~~ +~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview~~ 先在环境变量添加Region,ap-hongkong或ap-guangzhou之类,再安装。 @@ -51,3 +48,5 @@ If there is 'index.html' file, program will only show the content of 'index.html Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort. 点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。 +QQ Group: 943919989 +Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw From 3b1de93cc43071496f689bee605e8105d34d3787 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 12:39:07 +0800 Subject: [PATCH 3/6] Update readme.md --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 694c284..689958b 100644 --- a/readme.md +++ b/readme.md @@ -27,6 +27,7 @@ Official: https://cloud.tencent.com/product/scf ~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview~~ 先在环境变量添加Region,ap-hongkong或ap-guangzhou之类,再安装。 +添加网盘时,SCF反应不过来,会添加失败,请不要删除,再添加一次相同的就可以了。 DEMO: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/ From 46714bff6b02942cdd14340c198f2458e7a63db2 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 18:55:17 +0800 Subject: [PATCH 4/6] use '?random=jpg' to get an URL of a random file --- function/common.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/function/common.php b/function/common.php index 973b410..79e4be1 100644 --- a/function/common.php +++ b/function/common.php @@ -614,7 +614,20 @@ function main($path) } else return output(json_encode($exts['img']),400); } else return output('',401); } + $files = list_files($path); + //echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT); + if ($_GET['random']!=='') { + if ($_SERVER['ishidden']<4) { + $tmp = []; + foreach (array_keys($files['children']) as $filename) { + if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; + } + $tmp = array_values($tmp); + if (count($tmp)>0) return output($tmp[rand(0,count($tmp)-1)],200); + else return output('',404); + } else return output('',401); + } if (isset($files['file']) && !$_GET['preview']) { // is file && not preview mode if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); @@ -927,6 +940,13 @@ function fetch_files($path = '/') $files=fetch_files_children($files, $path1, $page); } else { // files num < 200 , then cache + if (isset($files['children'])) { + $tmp = []; + foreach ($files['children'] as $file) { + $tmp[$file['name']] = $file; + } + $files['children'] = $tmp; + } savecache('path_' . $path, $files); } } @@ -938,6 +958,7 @@ function fetch_files($path = '/') $files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true); } } + return $files; } From 57ead42c49853105c2357a881bcc4d0b05e8f763 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 19:02:05 +0800 Subject: [PATCH 5/6] use '?random=jpg' to get an URL of a random file --- function/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index 79e4be1..76497b4 100644 --- a/function/common.php +++ b/function/common.php @@ -617,7 +617,7 @@ function main($path) $files = list_files($path); //echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT); - if ($_GET['random']!=='') { + if (isset($_GET['random'])&&$_GET['random']!=='') { if ($_SERVER['ishidden']<4) { $tmp = []; foreach (array_keys($files['children']) as $filename) { From be51285dcafa0a4de0bd7716a44e05620ae5debe Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 9 Mar 2020 19:09:12 +0800 Subject: [PATCH 6/6] use '?random=jpg' to get an URL of a random file (3) --- function/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index 76497b4..35b7672 100644 --- a/function/common.php +++ b/function/common.php @@ -624,7 +624,7 @@ function main($path) if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; } $tmp = array_values($tmp); - if (count($tmp)>0) return output($tmp[rand(0,count($tmp)-1)],200); + if (count($tmp)>0) return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]); else return output('',404); } else return output('',401); }