diff --git a/packages/napcat-webui-backend/src/router/Plugin.ts b/packages/napcat-webui-backend/src/router/Plugin.ts index f4bbed6f..b4009736 100644 --- a/packages/napcat-webui-backend/src/router/Plugin.ts +++ b/packages/napcat-webui-backend/src/router/Plugin.ts @@ -1,5 +1,5 @@ import { Router } from 'express'; -import multer from 'multer'; +// import multer from 'multer'; import path from 'path'; import fs from 'fs'; import os from 'os'; @@ -12,7 +12,7 @@ import { RegisterPluginManagerHandler, PluginConfigSSEHandler, PluginConfigChangeHandler, - ImportLocalPluginHandler, + // ImportLocalPluginHandler, GetPluginIconHandler } from '@/napcat-webui-backend/src/api/Plugin'; import { @@ -31,32 +31,32 @@ if (!fs.existsSync(uploadDir)) { fs.mkdirSync(uploadDir, { recursive: true }); } -const storage = multer.diskStorage({ - destination: (_req, _file, cb) => { - cb(null, uploadDir); - }, - filename: (_req, file, cb) => { - const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9); - cb(null, uniqueSuffix + '-' + file.originalname); - } -}); +// const storage = multer.diskStorage({ +// destination: (_req, _file, cb) => { +// cb(null, uploadDir); +// }, +// filename: (_req, file, cb) => { +// const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9); +// cb(null, uniqueSuffix + '-' + file.originalname); +// } +// }); -const upload = multer({ - storage, - limits: { - fileSize: 50 * 1024 * 1024, // 50MB 限制 - }, - fileFilter: (_req, file, cb) => { - // 只允许 .zip 文件 - if (file.mimetype === 'application/zip' || - file.mimetype === 'application/x-zip-compressed' || - file.originalname.endsWith('.zip')) { - cb(null, true); - } else { - cb(new Error('Only .zip files are allowed')); - } - } -}); +// const upload = multer({ +// storage, +// limits: { +// fileSize: 50 * 1024 * 1024, // 50MB 限制 +// }, +// fileFilter: (_req, file, cb) => { +// // 只允许 .zip 文件 +// if (file.mimetype === 'application/zip' || +// file.mimetype === 'application/x-zip-compressed' || +// file.originalname.endsWith('.zip')) { +// cb(null, true); +// } else { +// cb(new Error('Only .zip files are allowed')); +// } +// } +// }); const router: Router = Router();