diff --git a/conf/app.php b/conf/app.php index 36b35a6..219fb6a 100644 --- a/conf/app.php +++ b/conf/app.php @@ -3,7 +3,7 @@ * Config */ $configs = array( - 'version' => '0.2.3', + 'version' => '0.2.4', 'releaseDate' => '2024-9-7', 'showVersion' => false, //默认不显示版本号和发布日期 @@ -49,10 +49,10 @@ $configs = array( 'googleimage' => array( 'imageHeight' => 350, //图片高度,单位:px 'contact' => 'FileSite图片网站订制联系:FileSite.io', - 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif'), + 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif', 'svg'), ), - 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif'), + 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif', 'svg'), 'supportedVideoExts' => array('mp4', 'mov', 'm3u8'), 'screenshot_start' => 1000, //视频播放页快照截取开始时间,单位:毫秒 'screenshot_expire_seconds' => 315360000, //视频封面图缓存3650天 diff --git a/lib/DirScanner.php b/lib/DirScanner.php index 54b224b..ec197ca 100644 --- a/lib/DirScanner.php +++ b/lib/DirScanner.php @@ -43,6 +43,7 @@ Class DirScanner { 'jpeg', //图片 'png', //图片 'webp', //图片 + 'svg', //图片 'gif', //图片 'ico', //图标 'mp3', //音乐 @@ -398,6 +399,7 @@ Class DirScanner { 'jpeg' => "{$webRoot}{$directory}{$filename}.{$extension}", 'png' => "{$webRoot}{$directory}{$filename}.{$extension}", 'webp' => "{$webRoot}{$directory}{$filename}.{$extension}", + 'svg' => "{$webRoot}{$directory}{$filename}.{$extension}", 'gif' => "{$webRoot}{$directory}{$filename}.{$extension}", 'ico' => "{$webRoot}{$directory}{$filename}.{$extension}", 'mp3' => "{$webRoot}{$directory}{$filename}.{$extension}", @@ -809,7 +811,7 @@ Class DirScanner { } //获取目录下第一个图片作为封面图返回 - public function getSnapshotImage($realpath, $imgExts = array('jpg', 'jpeg', 'png', 'webp', 'gif')) { + public function getSnapshotImage($realpath, $imgExts = array('jpg', 'jpeg', 'png', 'webp', 'gif', 'svg')) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($realpath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index e452510..a04d1ce 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -30,22 +30,25 @@ Class ListController extends Controller { return $this->redirect('/'); } - $currentDir = $cachedParentData[$cateId]; - if (strpos($cacheParentDataId, $cateId) === false && empty($currentDir)) { + if (strpos($cacheParentDataId, $cateId) === false && empty($cachedParentData[$cateId])) { throw new Exception("缓存数据中找不到当前目录,请返回上一页重新进入!", 404); - }else if (strpos($cacheParentDataId, $cateId) !== false) { + }else if (strpos($cacheParentDataId, $cateId) !== false) { //为播放页面查询当前目录下所有视频 $currentDir = $cachedParentData; - } + }else if (!empty($cachedParentData)) { + $currentDir = $cachedParentData[$cateId]; + + //密码授权检查 + $isAllowed = Common::isUserAllowedToDir($currentDir['directory']); + if (!$isAllowed) { + $goUrl = "/site/pwdauth/?dir=" . urlencode($currentDir['directory']) . "&back=" . urlencode(FSC::$app['requestUrl']); + return $this->redirect($goUrl); + } - //密码授权检查 - $isAllowed = Common::isUserAllowedToDir($currentDir['directory']); - if (!$isAllowed) { - $goUrl = "/site/pwdauth/?dir=" . urlencode($currentDir['directory']) . "&back=" . urlencode(FSC::$app['requestUrl']); - return $this->redirect($goUrl); + //扫描当前目录 + $scanner->setWebRoot($this->getCurrentWebroot($currentDir['realpath'])); + $scanner->setRootDir($currentDir['realpath']); } - $scanner->setWebRoot($this->getCurrentWebroot($currentDir['realpath'])); - $scanner->setRootDir($currentDir['realpath']); //优先从缓存读取数据 $maxScanDeep = 0; //最大扫描目录级数 @@ -130,10 +133,6 @@ Class ListController extends Controller { }); } - //获取目录面包屑 - $subcate = !empty($scanResults[$cateId]) ? $scanResults[$cateId] : array(); - $breadcrumbs = $this->getBreadcrumbs($currentDir, $cachedParentData, $scanner); - //获取当前目录下的readme $cateReadmeFile = $scanner->getDefaultReadme(); if (!empty($cateReadmeFile)) { @@ -149,6 +148,8 @@ Class ListController extends Controller { $expireSeconds = 86400; $mp3File = Common::getCacheFromFile($cacheKey, $expireSeconds); + //当前目录数据 + $subcate = !empty($scanResults[$cateId]) ? $scanResults[$cateId] : array(); //翻页支持 $page = $this->get('page', 1); @@ -221,6 +222,10 @@ Class ListController extends Controller { } + //获取目录面包屑 + $breadcrumbs = $this->getBreadcrumbs($currentDir, $cachedParentData, $scanner); + + $viewName = '//site/index'; //共享视图 $params = compact( 'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index f77256c..ad61b4d 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -433,14 +433,12 @@ Class SiteController extends Controller { $imgSource = imagecreatefromgif($img_filepath); break; case '.webp': - //php >= 5.4 - if (phpversion() >= 5.4) { + if (function_exists('imagecreatefromwebp')) { $imgSource = imagecreatefromwebp($img_filepath); } break; case '.bmp': - //php >= 7.2 - if (phpversion() >= 7.2) { + if (function_exists('imagecreatefrombmp')) { $imgSource = imagecreatefrombmp($img_filepath); } break; diff --git a/www/css/beauty.css b/www/css/beauty.css index 113e361..53083b2 100644 --- a/www/css/beauty.css +++ b/www/css/beauty.css @@ -82,7 +82,7 @@ a:link{text-decoration:none} .im_item>a{overflow: hidden;display:block;position:relative;width: 100%;height: 100%} .im_img_title{background:rgba(7, 7, 7, .1);position:absolute;left:0;right:0;bottom:0;top:0;color:#EEE;border-radius:10px} .im_img_title .folder_title{position:absolute;bottom:10px;left:10px;margin-right:10px;font-weight:bold;padding:3px;border:solid 1px #444;border-radius:6px;font-size:13px;background-color:#333;opacity:0.7} -.im_img_title .right-bottom{left:auto;right:5px;bottom:5px;margin-right:0;padding:0 2px;font-size:11px;border:0 none;font-weight:300;color:#CCC} +.im_img_title .right-bottom{padding-left:5px;font-size:11px;border:0 none;font-weight:300;color:#CCC} .im_img_title img{vertical-align:bottom} .im_item:hover .im_img{transform:scale(1.03)} .im_item:hover .im_img_title,.im_item:hover .im_img_title .right-bottom{color:#FFF}