dsh-plugin-mobile-gateway 0.4.0 → 0.4.1
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/README.md +1 -1
- package/bin/setup-ip.mjs +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ dsh plugin --profile web add dsh-plugin-mobile-gateway
|
|
|
24
24
|
如果希望固定版本,可以在包名后指定版本号:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
dsh plugin --profile web add dsh-plugin-mobile-gateway@0.4.
|
|
27
|
+
dsh plugin --profile web add dsh-plugin-mobile-gateway@0.4.1
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
也可以不经过 npm,直接安装 GitHub 版本:
|
package/bin/setup-ip.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import path from 'node:path'
|
|
|
7
7
|
import process from 'node:process'
|
|
8
8
|
import readline from 'node:readline/promises'
|
|
9
9
|
import { execFileSync } from 'node:child_process'
|
|
10
|
-
import {
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
11
|
|
|
12
12
|
const MARKER = '# Managed by dsh-plugin-mobile-gateway'
|
|
13
13
|
const CONFIG_DIR = '/etc/dsh-mobile-gateway'
|
|
@@ -314,7 +314,18 @@ export {
|
|
|
314
314
|
renewalTimer,
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
function isMainModule(argvEntry) {
|
|
318
|
+
if (!argvEntry) return false
|
|
319
|
+
try {
|
|
320
|
+
return fs.realpathSync(argvEntry) === fs.realpathSync(fileURLToPath(import.meta.url))
|
|
321
|
+
} catch {
|
|
322
|
+
return false
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export { isMainModule }
|
|
327
|
+
|
|
328
|
+
if (isMainModule(process.argv[1])) {
|
|
318
329
|
try {
|
|
319
330
|
const options = parseArgs(process.argv.slice(2))
|
|
320
331
|
if (options.command === 'help') printHelp()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-mobile-gateway",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Persistent WebSocket gateway for dsh: exposes /ws/mobile on the web server and forwards agent session output to connected mobile clients",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"files": [
|