同步升级网页图标处理

This commit is contained in:
邹景立 2022-03-01 20:35:13 +08:00
parent 7ea65bbf0c
commit e7a326e9d7

View File

@ -87,16 +87,7 @@ class Config extends Controller
}
// 修改网站 ICON 图标文件,替换 public/favicon.ico 文件
if (preg_match('#^https?://#', $icon = $post['site_icon'] ?? '')) try {
if (preg_match('#/upload/(\w{2}/\w{30}.\w+)$#', $icon, $vars)) {
$info = LocalStorage::instance()->info($vars[1]);
}
if (empty($info) || empty($info['file'])) {
$info = LocalStorage::down($icon);
}
if (!empty($info) && !empty($info['file'])) {
$favicon = new FaviconExtend($info['file'], [48, 48]);
$favicon->saveIco("{$this->app->getRootPath()}public/favicon.ico");
}
SystemService::instance()->setFavicon($icon);
} catch (\Exception $exception) {
trace_file($exception);
$this->error($exception->getMessage());