filecat 5.23.1 → 5.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/{523.4ec3bcbd1ee671ff6589.js → 523.e773ebf3ccfcf3d84c73.js} +2 -2
- package/build/dist/{943.a12e7d5fe12333494061.js → 943.6360059826b561a14949.js} +2 -2
- package/build/dist/index.html +1 -1
- package/build/dist/{main.82a9564e6271c5e96238.js → main.b2c4cedb05c5a34a2565.js} +2 -2
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/package.json +2 -1
- package/shell/pkg.ts +7 -2
- package/shell/start/filecat-install.cmd +1 -0
- package/shell/start/filecat-uninstall.cmd +1 -0
- package/shell/start/windows-install.js +131 -0
- package/shell/start/windows-uninstall.js +76 -0
- /package/build/dist/{523.4ec3bcbd1ee671ff6589.js.LICENSE.txt → 523.e773ebf3ccfcf3d84c73.js.LICENSE.txt} +0 -0
- /package/build/dist/{943.a12e7d5fe12333494061.js.LICENSE.txt → 943.6360059826b561a14949.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.82a9564e6271c5e96238.js.LICENSE.txt → main.b2c4cedb05c5a34a2565.js.LICENSE.txt} +0 -0
- /package/shell/start/{run.cmd → filecat-run.cmd} +0 -0
- /package/shell/start/{run.sh → filecat-run.sh} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filecat",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.2",
|
|
4
4
|
"description": "FileCat Server Manager",
|
|
5
5
|
"author": "xiaobaidadada",
|
|
6
6
|
"scripts": {
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"webpack-cli": "^5.1.4",
|
|
124
124
|
"webpack-dev-server": "^5.2.0",
|
|
125
125
|
"webpack-node-externals": "^3.0.0",
|
|
126
|
+
"windows-shortcuts": "^0.1.6",
|
|
126
127
|
"ws": "^8.16.0",
|
|
127
128
|
"xxhashjs": "^0.2.2"
|
|
128
129
|
},
|
package/shell/pkg.ts
CHANGED
|
@@ -12,9 +12,14 @@ const FileServiceImpl = new FileService();
|
|
|
12
12
|
const args = process.argv.slice(2);
|
|
13
13
|
|
|
14
14
|
if(args[0].includes("win")) {
|
|
15
|
-
fs.copyFileSync(path.join(__dirname,"start","run.cmd"), path.join(__dirname, "..", "build", "run.cmd"));
|
|
15
|
+
fs.copyFileSync(path.join(__dirname,"start","filecat-run.cmd"), path.join(__dirname, "..", "build", "filecat-run.cmd"));
|
|
16
|
+
fs.copyFileSync(path.join(__dirname,"start","filecat-install.cmd"), path.join(__dirname, "..", "build", "filecat-install.cmd"));
|
|
17
|
+
fs.copyFileSync(path.join(__dirname,"start","filecat-uninstall.cmd"), path.join(__dirname, "..", "build", "filecat-uninstall.cmd"));
|
|
18
|
+
fs.copyFileSync(path.join(__dirname,"start","windows-install.js"), path.join(__dirname, "..", "build", "windows-install.js"));
|
|
19
|
+
fs.copyFileSync(path.join(__dirname,"start","windows-uninstall.js"), path.join(__dirname, "..", "build", "windows-uninstall.js"));
|
|
20
|
+
|
|
16
21
|
} else {
|
|
17
|
-
fs.copyFileSync(path.join(__dirname,"start","run.sh"), path.join(__dirname, "..", "build", "run.sh"));
|
|
22
|
+
fs.copyFileSync(path.join(__dirname,"start","filecat-run.sh"), path.join(__dirname, "..", "build", "filecat-run.sh"));
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const filePaths: string[] = [], directorys: string[] = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.\node windows-install.js %*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.\node windows-uninstall.js %*
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const ws = require("windows-shortcuts");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const readline = require("readline");
|
|
5
|
+
|
|
6
|
+
// 当前脚本所在目录
|
|
7
|
+
// const currentDir = process.cwd();
|
|
8
|
+
const currentDir = __dirname;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// 默认安装目录
|
|
12
|
+
const defaultInstallDir = "C:\\Program Files\\Filecat";
|
|
13
|
+
|
|
14
|
+
// 需要启动的 cmd
|
|
15
|
+
const CMD_NAME = "filecat-run.cmd";
|
|
16
|
+
|
|
17
|
+
// 开始菜单目录
|
|
18
|
+
const startMenuDir = path.join(
|
|
19
|
+
process.env.APPDATA,
|
|
20
|
+
"Microsoft",
|
|
21
|
+
"Windows",
|
|
22
|
+
"Start Menu",
|
|
23
|
+
"Programs",
|
|
24
|
+
"Filecat"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// =====================
|
|
28
|
+
// 递归复制目录
|
|
29
|
+
// =====================
|
|
30
|
+
function copyDir(src, dest) {
|
|
31
|
+
if (!fs.existsSync(dest)) {
|
|
32
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
36
|
+
|
|
37
|
+
for (let entry of entries) {
|
|
38
|
+
const srcPath = path.join(src, entry.name);
|
|
39
|
+
const destPath = path.join(dest, entry.name);
|
|
40
|
+
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
copyDir(srcPath, destPath);
|
|
43
|
+
} else {
|
|
44
|
+
fs.copyFileSync(srcPath, destPath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// =====================
|
|
50
|
+
// 创建快捷方式
|
|
51
|
+
// =====================
|
|
52
|
+
function createShortcut(installDir) {
|
|
53
|
+
const cmdPath = path.join(installDir, CMD_NAME);
|
|
54
|
+
const shortcutPath = path.join(startMenuDir, "Filecat.lnk");
|
|
55
|
+
|
|
56
|
+
fs.mkdirSync(startMenuDir, { recursive: true });
|
|
57
|
+
|
|
58
|
+
ws.create(shortcutPath, {
|
|
59
|
+
target: cmdPath,
|
|
60
|
+
workingDir: installDir,
|
|
61
|
+
desc: "Filecat 启动程序"
|
|
62
|
+
}, (err) => {
|
|
63
|
+
if (err) {
|
|
64
|
+
console.error("创建快捷方式失败:", err);
|
|
65
|
+
} else {
|
|
66
|
+
console.log("开始菜单快捷方式创建成功!");
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// =====================
|
|
72
|
+
// 安装主流程
|
|
73
|
+
// =====================
|
|
74
|
+
function install(installDir) {
|
|
75
|
+
|
|
76
|
+
const cmdSrc = path.join(currentDir, CMD_NAME);
|
|
77
|
+
|
|
78
|
+
if (!fs.existsSync(cmdSrc)) {
|
|
79
|
+
console.error("找不到 filecat-start.cmd");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
console.log("正在复制文件...");
|
|
85
|
+
|
|
86
|
+
copyDir(currentDir, installDir);
|
|
87
|
+
|
|
88
|
+
console.log("文件复制完成");
|
|
89
|
+
|
|
90
|
+
createShortcut(installDir);
|
|
91
|
+
|
|
92
|
+
console.log("安装成功!");
|
|
93
|
+
console.log("Win 键搜索 Filecat 即可启动");
|
|
94
|
+
|
|
95
|
+
} catch (e) {
|
|
96
|
+
console.error("安装失败:", e.message);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// =====================
|
|
101
|
+
// 用户交互
|
|
102
|
+
// =====================
|
|
103
|
+
const rl = readline.createInterface({
|
|
104
|
+
input: process.stdin,
|
|
105
|
+
output: process.stdout
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
console.log("========== Filecat 安装程序 ==========");
|
|
109
|
+
console.log("默认安装目录:");
|
|
110
|
+
console.log(defaultInstallDir);
|
|
111
|
+
console.log("");
|
|
112
|
+
|
|
113
|
+
rl.question("回车确认安装,或输入自定义安装路径:", (inputPath) => {
|
|
114
|
+
|
|
115
|
+
const installDir = inputPath.trim() || defaultInstallDir;
|
|
116
|
+
|
|
117
|
+
console.log("");
|
|
118
|
+
console.log("安装路径:", installDir);
|
|
119
|
+
|
|
120
|
+
rl.question("确认安装?(y/n): ", (confirm) => {
|
|
121
|
+
|
|
122
|
+
if (confirm.toLowerCase() !== "y") {
|
|
123
|
+
console.log("已取消安装");
|
|
124
|
+
rl.close();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
rl.close();
|
|
129
|
+
install(installDir);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const ws = require("windows-shortcuts");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
// 快捷方式路径
|
|
6
|
+
const shortcutPath = path.join(
|
|
7
|
+
process.env.APPDATA,
|
|
8
|
+
"Microsoft",
|
|
9
|
+
"Windows",
|
|
10
|
+
"Start Menu",
|
|
11
|
+
"Programs",
|
|
12
|
+
"Filecat",
|
|
13
|
+
"Filecat.lnk"
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
function removeDirSafe(dir) {
|
|
17
|
+
if (fs.existsSync(dir)) {
|
|
18
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
19
|
+
console.log("已删除目录:", dir);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function removeFileSafe(file) {
|
|
24
|
+
if (fs.existsSync(file)) {
|
|
25
|
+
fs.rmSync(file, { force: true });
|
|
26
|
+
console.log("已删除文件:", file);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// =====================
|
|
31
|
+
// 主逻辑
|
|
32
|
+
// =====================
|
|
33
|
+
if (!fs.existsSync(shortcutPath)) {
|
|
34
|
+
console.log("找不到快捷方式,无法确定安装目录");
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ws.query(shortcutPath, (err, options) => {
|
|
39
|
+
|
|
40
|
+
if (err) {
|
|
41
|
+
console.error("读取快捷方式失败:", err);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!options.target) {
|
|
46
|
+
console.error("快捷方式未包含目标路径");
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ⭐ 获取真实文件路径
|
|
51
|
+
const targetFile = options.target;
|
|
52
|
+
|
|
53
|
+
// ⭐ 获取安装目录
|
|
54
|
+
const installDir = path.dirname(targetFile);
|
|
55
|
+
|
|
56
|
+
console.log("检测到安装目录:", installDir);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
|
|
60
|
+
// 删除安装目录
|
|
61
|
+
removeDirSafe(installDir);
|
|
62
|
+
|
|
63
|
+
// 删除快捷方式
|
|
64
|
+
removeFileSafe(shortcutPath);
|
|
65
|
+
|
|
66
|
+
// 删除开始菜单文件夹
|
|
67
|
+
removeDirSafe(path.dirname(shortcutPath));
|
|
68
|
+
|
|
69
|
+
console.log("卸载完成");
|
|
70
|
+
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.error("卸载失败:", e.message);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
process.exit(0);
|
|
76
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|