fix: 修正错别字
This commit is contained in:
1 parent
28ee6daab4
commit
afc57bc229
5 files changed
+14
-14
No files matched your search
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
import { api, staticPath } from "../config.js";
|
import { api, staticPath } from "../config.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import useFsOprateEventCenter from "../hooks/useFsOprateEventCenter.js";
|
import useFsOperateEventCenter from "../hooks/useFsOperateEventCenter.js";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
const fsOprateEventCenter = useFsOprateEventCenter();
|
const fsOperateEventCenter = useFsOperateEventCenter();
|
||||||
|
|
||||||
function cutPath(targetPath, newPath) {
|
function cutPath(targetPath, newPath) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -27,7 +27,7 @@ export default function useCutApi(app) {
|
|||||||
const decodedPath = decodeURIComponent(req.path).substring(api.cut.length - 1);
|
const decodedPath = decodeURIComponent(req.path).substring(api.cut.length - 1);
|
||||||
const targetPath = path.join(staticPath, decodedPath);
|
const targetPath = path.join(staticPath, decodedPath);
|
||||||
const newPath = path.join(staticPath, req.body.newPath, path.basename(targetPath));
|
const newPath = path.join(staticPath, req.body.newPath, path.basename(targetPath));
|
||||||
const eventId = fsOprateEventCenter.push(cutPath(targetPath, newPath));
|
const eventId = fsOperateEventCenter.push(cutPath(targetPath, newPath));
|
||||||
res.send({ eventId });
|
res.send({ eventId });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
import { api, staticPath } from "../config.js";
|
import { api, staticPath } from "../config.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import useFsOprateEventCenter from "../hooks/useFsOprateEventCenter.js";
|
import useFsOperateEventCenter from "../hooks/useFsOperateEventCenter.js";
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
const fsOprateEventCenter = useFsOprateEventCenter()
|
const fsOperateEventCenter = useFsOperateEventCenter()
|
||||||
|
|
||||||
function deletePath(targetPath) {
|
function deletePath(targetPath) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -34,7 +34,7 @@ export default function useDeleteApi(app) {
|
|||||||
app.post(api.delete, (req, res) => {
|
app.post(api.delete, (req, res) => {
|
||||||
const decodedPath = decodeURIComponent(req.path).substring(api.delete.length - 1);
|
const decodedPath = decodeURIComponent(req.path).substring(api.delete.length - 1);
|
||||||
const targetPath = path.join(staticPath, decodedPath);
|
const targetPath = path.join(staticPath, decodedPath);
|
||||||
const eventId = fsOprateEventCenter.push(deletePath(targetPath))
|
const eventId = fsOperateEventCenter.push(deletePath(targetPath))
|
||||||
res.send({ eventId });
|
res.send({ eventId });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { api } from "../config.js";
|
import { api } from "../config.js";
|
||||||
import useFsOprateEventCenter from "../hooks/useFsOprateEventCenter.js";
|
import useFsOperateEventCenter from "../hooks/useFsOperateEventCenter.js";
|
||||||
|
|
||||||
const fsOprateEventCenter = useFsOprateEventCenter();
|
const fsOperateEventCenter = useFsOperateEventCenter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取一个文件操作事件的结果
|
* 获取一个文件操作事件的结果
|
||||||
@@ -10,6 +10,6 @@ const fsOprateEventCenter = useFsOprateEventCenter();
|
|||||||
export default function useQueryApi(app) {
|
export default function useQueryApi(app) {
|
||||||
app.get(api.query, (req, res) => {
|
app.get(api.query, (req, res) => {
|
||||||
const id = req.query.id;
|
const id = req.query.id;
|
||||||
res.json(fsOprateEventCenter.query(id));
|
res.json(fsOperateEventCenter.query(id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
import { api, staticPath } from "../config.js";
|
import { api, staticPath } from "../config.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import useFsOprateEventCenter from "../hooks/useFsOprateEventCenter.js";
|
import useFsOperateEventCenter from "../hooks/useFsOperateEventCenter.js";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
const fsOprateEventCenter = useFsOprateEventCenter();
|
const fsOperateEventCenter = useFsOperateEventCenter();
|
||||||
|
|
||||||
function renamePath(targetPath, newName) {
|
function renamePath(targetPath, newName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -28,7 +28,7 @@ export default function useRenameApi(app) {
|
|||||||
const decodedPath = decodeURIComponent(req.path).substring(api.rename.length - 1);
|
const decodedPath = decodeURIComponent(req.path).substring(api.rename.length - 1);
|
||||||
const targetPath = path.join(staticPath, decodedPath);
|
const targetPath = path.join(staticPath, decodedPath);
|
||||||
const newName = req.body.newName;
|
const newName = req.body.newName;
|
||||||
const eventId = fsOprateEventCenter.push(renamePath(targetPath, newName));
|
const eventId = fsOperateEventCenter.push(renamePath(targetPath, newName));
|
||||||
res.send({ eventId });
|
res.send({ eventId });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import generateId from "./generateId.js"
|
import generateId from "./generateId.js"
|
||||||
|
|
||||||
// 一个文件操作事件
|
// 一个文件操作事件
|
||||||
class FsOprateEvent {
|
class FsOperateEvent {
|
||||||
constructor(event){
|
constructor(event){
|
||||||
this.status = 'progress'
|
this.status = 'progress'
|
||||||
this.uid = generateId()
|
this.uid = generateId()
|
||||||
@@ -31,7 +31,7 @@ class FsOprateEventCenter {
|
|||||||
* @returns {number} 事件id
|
* @returns {number} 事件id
|
||||||
*/
|
*/
|
||||||
push(event){
|
push(event){
|
||||||
const ev = new FsOprateEvent(event)
|
const ev = new FsOperateEvent(event)
|
||||||
const id = ev.uid
|
const id = ev.uid
|
||||||
this.eventMap[id] = {
|
this.eventMap[id] = {
|
||||||
event: ev,
|
event: ev,
|
||||||
Reference in new issue
Block a user