feat: 修改终端背景图片的存储路径更新为data文件夹

Related to #36
This commit is contained in:
Baobhan Sith
2025-05-16 14:20:14 +08:00
parent b79f492558
commit 6dff17a769
@@ -9,7 +9,7 @@ import fsp from 'fs/promises'; // Use fs.promises for async file operations
// --- 背景图片上传配置 (保持不变) ---
const backgroundStorage = multer.diskStorage({
destination: (req, file, cb) => {
const uploadPath = path.join(__dirname, '../../uploads/backgrounds/');
const uploadPath = path.join(__dirname, '../../data/background/');
// 确保目录存在
fs.mkdirSync(uploadPath, { recursive: true });
cb(null, uploadPath);
@@ -134,7 +134,7 @@ export const getBackgroundFileController = async (req: Request, res: Response):
try {
// 构建文件的绝对路径 (基于 multer 的保存位置)
const absolutePath = path.join(__dirname, '../../uploads/backgrounds/', filename);
const absolutePath = path.join(__dirname, '../../data/background/', filename);
// 检查文件是否存在且可读
await fsp.access(absolutePath, fs.constants.R_OK);