From bbcf8afb98d38d45ec3d6c403598f573e3ed20cd Mon Sep 17 00:00:00 2001 From: icret <16373024+icret@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:31:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0API=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/index.php | 16 ++++++++++++++++ docs/图床更新升级.md | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/api/index.php b/api/index.php index 8c6c67e..3733f6b 100755 --- a/api/index.php +++ b/api/index.php @@ -111,6 +111,22 @@ if ($handle->uploaded) { // 图片完整相对路径:/i/2021/05/03/k88e7p.jpg if ($handle->processed) { + // 黑名单文件 - 通过MD5检测 + if ($config['md5_black']) { + $befor_upload_file_md5 = md5_file($handle->file_src_pathname); + $after_upload_file_md5 = md5_file($handle->file_dst_pathname); + if (stristr($config['md5_blacklist'], $befor_upload_file_md5) || stristr($config['md5_blacklist'], $after_upload_file_md5)) { + if (file_exists($handle->file_dst_pathname)) unlink($handle->file_dst_pathname); + exit(json_encode( + array( + "result" => "failed", + "code" => 205, + "message" => "当前文件禁止上传", + ), + JSON_UNESCAPED_UNICODE + )); + } + } // 图片相对路径 $pathIMG = $Img_path . $handle->file_dst_name; // 图片访问网址 diff --git a/docs/图床更新升级.md b/docs/图床更新升级.md index 53dbf61..35c533d 100644 --- a/docs/图床更新升级.md +++ b/docs/图床更新升级.md @@ -9,6 +9,10 @@ 2. 保留挂载在主机上的配置文件和上传文件夹 3. 重新执行一边docker安装代码 +##### 全新安装 +1. 备份`上传文件目录` +2. 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既重装完成 + ##### 更新后显示当前版本与Github版本不一致? - 将最新版按照[正常升级](#正常升级)操作