@lppx/lanshare 1.0.4 → 1.0.6
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/dist/src/cli/cli.js +22 -2
- package/package.json +3 -3
package/dist/src/cli/cli.js
CHANGED
|
@@ -116,13 +116,33 @@ async function handleStartCommand() {
|
|
|
116
116
|
process.exit(0);
|
|
117
117
|
}
|
|
118
118
|
// #endregion
|
|
119
|
+
// #region 输入文件夹路径
|
|
120
|
+
const dirResponse = await (0, prompts_1.default)({
|
|
121
|
+
type: 'text',
|
|
122
|
+
name: 'dir',
|
|
123
|
+
message: '请输入服务启动所使用的文件夹路径 (留空使用默认目录,输入 . 表示当前目录)',
|
|
124
|
+
initial: '',
|
|
125
|
+
validate: (value) => {
|
|
126
|
+
if (!value || value.trim() === '') {
|
|
127
|
+
return true; // 空值是允许的,使用默认目录
|
|
128
|
+
}
|
|
129
|
+
return true; // 路径验证在启动时进行
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (dirResponse.dir === undefined) {
|
|
133
|
+
logger_1.default.info('用户取消操作');
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
// #endregion
|
|
119
137
|
const port = Number(portResponse.port);
|
|
120
|
-
|
|
138
|
+
const uploadDir = dirResponse.dir?.trim() || undefined;
|
|
139
|
+
logger_1.default.info(`配置完成 - IP: ${ipResponse.ip}, Port: ${port}${uploadDir ? `, 目录: ${uploadDir}` : ''}`);
|
|
121
140
|
// 启动服务器
|
|
122
141
|
logger_1.default.info(`日志目录: ${logger_1.logDir}`);
|
|
123
142
|
await (0, index_1.startServer)({
|
|
124
143
|
ip: ipResponse.ip,
|
|
125
|
-
port: port
|
|
144
|
+
port: port,
|
|
145
|
+
uploadDir: uploadDir
|
|
126
146
|
});
|
|
127
147
|
// 自动打开浏览器
|
|
128
148
|
const url = `http://${ipResponse.ip}:${port}`;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.6",
|
|
7
7
|
"description": "这是一个局域网分享工具",
|
|
8
8
|
"bin": {
|
|
9
9
|
"lanshare": "dist/src/cli.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/socket.io": "^3.0.1",
|
|
29
29
|
"commander": "^12.0.0",
|
|
30
30
|
"express": "^4.18.2",
|
|
31
|
-
"multer": "
|
|
31
|
+
"multer": "2.0.2",
|
|
32
32
|
"open": "^11.0.0",
|
|
33
33
|
"prompts": "^2.4.2",
|
|
34
34
|
"socket.io": "^4.8.3",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/express": "^4.17.21",
|
|
39
|
-
"@types/multer": "^
|
|
39
|
+
"@types/multer": "^2.0.0",
|
|
40
40
|
"@types/node": "^20.11.0",
|
|
41
41
|
"@types/prompts": "^2.4.9",
|
|
42
42
|
"@types/winston": "^2.4.4",
|