diff --git a/function/common.php b/function/common.php
index badfb6f..dac6028 100644
--- a/function/common.php
+++ b/function/common.php
@@ -859,7 +859,7 @@ function splitlast($str, $split)
$tmp[1] = substr($str, $pos+1);
} else {
$tmp[0] = '';
- $tmp[1] = $str;
+ $tmp[1] = substr($str, 1);
}
return $tmp;
}
@@ -934,28 +934,37 @@ function MSAPI($method, $path, $data = '', $access_token)
function fetch_files($path = '/')
{
+ global $exts;
$path1 = path_format($path);
$path = path_format($_SERVER['list_path'] . path_format($path));
if (!($files = getcache('path_' . $path))) {
// https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
// https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
// https://developer.microsoft.com/zh-cn/graph/graph-explorer
- $pos = strrpos($path, '/');
- if ($pos>1) {
- $parentpath = substr($path, 0, $pos);
- $filename = substr($path, $pos+1);
- if ($parentfiles = getcache('path_' . $parentpath))
- foreach ($parentfiles['children'] as $file)
- if ($file['name']==$filename)
- if (isset($file['@microsoft.graph.downloadUrl']))
- return $file;
+ $pos = splitlast($path, '/');
+ $parentpath = $pos[0];
+ $filename = $pos[1];
+ if ($parentfiles = getcache('path_' . $parentpath. '/')) {
+ if (isset($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl'])) {
+ if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
+ if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
+ $content1 = curl_request($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl']);
+ $parentfiles['children'][$filename]['content'] = $content1;
+ savecache('path_' . $parentpath. '/', $parentfiles);
+ }
+ }
+ return $parentfiles['children'][$filename];
+ }
}
+
$url = $_SERVER['api_url'];
if ($path !== '/') {
$url .= ':' . $path;
if (substr($url,-1)=='/') $url=substr($url,0,-1);
}
$url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl)';
+ $retry = 0;
+ $arr = [];
while ($retry<3&&!$arr['stat']) {
$arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]);
$retry++;
@@ -1002,7 +1011,7 @@ function children_name($children)
{
$tmp = [];
foreach ($children as $file) {
- $tmp[$file['name']] = $file;
+ $tmp[strtolower($file['name'])] = $file;
}
return $tmp;
}
@@ -1115,6 +1124,10 @@ function render_list($path = '', $files = '')
global $exts;
global $constStr;
+ if (isset($files['children']['index.html']) && !$_SERVER['admin']) {
+ $htmlcontent = fetch_files(spurlencode(path_format($path . '/index.html'),'/'))['content'];
+ return output($htmlcontent['body'], $htmlcontent['stat']);
+ }
$path = str_replace('%20','%2520',$path);
$path = str_replace('+','%2B',$path);
$path = str_replace('&','&',path_format(urldecode($path))) ;
@@ -1147,12 +1160,12 @@ function render_list($path = '', $files = '')
$theme = getConfig('theme');
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
- $htmlpage = include 'theme/'.$theme;
+ include 'theme/'.$theme;
$html = '' . ob_get_clean();
- if (isset($htmlpage['statusCode'])) return $htmlpage;
+ //if (isset($htmlpage['statusCode'])) return $htmlpage;
if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
return output($html,$statusCode);
}
diff --git a/version b/version
index 47d021d..9837280 100644
--- a/version
+++ b/version
@@ -1,3 +1,9 @@
+20200321-1830.15
+本次更新后,'index.html'功能在其它主题会导致bug。
+文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
+after this update, then 'index.html' function will bug in other theme.
+cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。
+
20200311-2150.14
Add a switch, can download a known file or not, while the folder is encrypted.
Hide time and size in mobile.
@@ -5,7 +11,6 @@ Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after
增加一个开关,在目录加密后能否下载其中的某个文件。
在手机上浏览时,隐藏修改时间跟大小。
加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
-
20200229-1300.13
In SCF, some config can input Special symbols now, like ?&= 。
在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。