This commit is contained in:
unknown
2025-06-11 17:02:43 +08:00
parent f7c2c5e6f2
commit ff59827d2e

View File

@@ -840,7 +840,7 @@ var mixioServer = async function() {
const format = match[1]; const format = match[1];
const timeStamp = Date.now(); const timeStamp = Date.now();
const fileName = `${timeStamp}.${format}`; const fileName = `${timeStamp}.${format}`;
const filePath = path.join(__dirname, 'img', 'store', topic[0], topic[1], fileName); const filePath = path.join('img', 'store', topic[0], topic[1], fileName);
const base64Data = payload.replace(base64Reg, ''); const base64Data = payload.replace(base64Reg, '');
const buffer = Buffer.from(base64Data, 'base64'); const buffer = Buffer.from(base64Data, 'base64');
fs.mkdirSync(path.dirname(filePath), { recursive: true }); fs.mkdirSync(path.dirname(filePath), { recursive: true });
@@ -849,7 +849,7 @@ var mixioServer = async function() {
// 全部明文存为txt // 全部明文存为txt
const timeStamp = Date.now(); const timeStamp = Date.now();
const fileName = `${timeStamp}.txt`; const fileName = `${timeStamp}.txt`;
const filePath = path.join(__dirname, 'img', 'store', topic[0], topic[1], fileName); const filePath = path.join('img', 'store', topic[0], topic[1], fileName);
fs.mkdirSync(path.dirname(filePath), { recursive: true}); fs.mkdirSync(path.dirname(filePath), { recursive: true});
fs.writeFileSync(filePath, payload); fs.writeFileSync(filePath, payload);
} }
@@ -1351,7 +1351,7 @@ var mixioServer = async function() {
if (req.session.userName && req.query.projectName){ if (req.session.userName && req.query.projectName){
var projectName = req.query.projectName var projectName = req.query.projectName
// img/store/username/projectName // img/store/username/projectName
var imgStorePath = path.join(process.cwd(), 'img/store/' + req.session.userName + "/" + projectName) var imgStorePath = path.join('img/store/' + req.session.userName + "/" + projectName)
// 文件名发送列表 // 文件名发送列表
fs.readdir(imgStorePath, function(err, files) { fs.readdir(imgStorePath, function(err, files) {
res.send(files || []) res.send(files || [])
@@ -1367,7 +1367,7 @@ var mixioServer = async function() {
// img/store/username/projectName // img/store/username/projectName
var imgStorePath = 'img/store/' + req.session.userName + "/" + projectName var imgStorePath = 'img/store/' + req.session.userName + "/" + projectName
// 删除文件 // 删除文件
fs.unlink(path.join(process.cwd(), imgStorePath, filename), function(err) { fs.unlink(path.join(imgStorePath, filename), function(err) {
if (err) { if (err) {
console.log(err) console.log(err)
} }