|
|
|
@ -46,6 +46,7 @@ Class DirScanner {
@@ -46,6 +46,7 @@ Class DirScanner {
|
|
|
|
|
'webp', //图片 |
|
|
|
|
'gif', //图片 |
|
|
|
|
'ico', //图标 |
|
|
|
|
'mp3', //音乐 |
|
|
|
|
'mp4', //视频 |
|
|
|
|
'ts', //视频 |
|
|
|
|
'm3u8', //视频 |
|
|
|
@ -60,9 +61,10 @@ Class DirScanner {
@@ -60,9 +61,10 @@ Class DirScanner {
|
|
|
|
|
'webp' => 512000, //图片 |
|
|
|
|
'gif' => 512000, //图片 |
|
|
|
|
'ico' => 51200, //图标 |
|
|
|
|
'mp4' => 104857600, //视频 |
|
|
|
|
'ts' => 10485760, //视频 |
|
|
|
|
'm3u8' => 10485760, //视频 |
|
|
|
|
'mp3' => 10485760, //音乐,10M |
|
|
|
|
'mp4' => 104857600, //视频,100M |
|
|
|
|
'ts' => 10485760, //视频,10M |
|
|
|
|
'm3u8' => 10485760, //视频,10M |
|
|
|
|
); |
|
|
|
|
protected $securedFileExtensions = array( //开启Nginx防盗链的文件类型 |
|
|
|
|
'jpg', //图片 |
|
|
|
@ -71,6 +73,7 @@ Class DirScanner {
@@ -71,6 +73,7 @@ Class DirScanner {
|
|
|
|
|
'webp', //图片 |
|
|
|
|
'gif', //图片 |
|
|
|
|
'ico', //图标 |
|
|
|
|
'mp3', //音乐 |
|
|
|
|
'mp4', //视频 |
|
|
|
|
'ts', //视频 |
|
|
|
|
'm3u8', //视频 |
|
|
|
@ -368,6 +371,7 @@ Class DirScanner {
@@ -368,6 +371,7 @@ Class DirScanner {
|
|
|
|
|
'webp' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
'gif' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
'ico' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
'mp3' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
'mp4' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
'ts' => "{$webRoot}{$directory}{$filename}.{$extension}", |
|
|
|
|
); |
|
|
|
@ -719,26 +723,31 @@ Class DirScanner {
@@ -719,26 +723,31 @@ Class DirScanner {
|
|
|
|
|
|
|
|
|
|
//获取指定目录下名称为README.md的文件 |
|
|
|
|
public function getDefaultReadme($dirid = '') { |
|
|
|
|
return $this->getDefaultFile('md', $dirid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//根据扩展名在根目录下或者指定目录下获取一个文件 |
|
|
|
|
public function getDefaultFile($extension, $dirid = '') { |
|
|
|
|
$readme = null; |
|
|
|
|
$md = null; |
|
|
|
|
|
|
|
|
|
if (empty($dirid) && !empty($this->tree)) { |
|
|
|
|
foreach($this->tree as $id => $file) { |
|
|
|
|
if (!empty($file['extension']) && $file['extension'] == 'md') { |
|
|
|
|
if (!empty($file['extension']) && $file['extension'] == $extension) { |
|
|
|
|
$md = $file; |
|
|
|
|
if (strtoupper($file['filename']) == 'README') { |
|
|
|
|
if ($extension == 'md' && strtoupper($file['filename']) == 'README') { |
|
|
|
|
$readme = $file; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else if (!empty($this->scanResults)) { |
|
|
|
|
}else if (!empty($dirid) && !empty($this->scanResults)) { |
|
|
|
|
$directory = $this->scanResults[$dirid]; |
|
|
|
|
if (!empty($directory) && !empty($directory['files'])) { |
|
|
|
|
foreach($directory['files'] as $id => $file) { |
|
|
|
|
if (!empty($file['extension']) && $file['extension'] == 'md') { |
|
|
|
|
if (!empty($file['extension']) && $file['extension'] == $extension) { |
|
|
|
|
if (empty($md)) {$md = $file;} //取第一个md文件 |
|
|
|
|
if (strtoupper($file['filename']) == 'README') { |
|
|
|
|
if ($extension == 'md' && strtoupper($file['filename']) == 'README') { |
|
|
|
|
$readme = $file; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|