dsh-plugin-mobile-gateway 0.6.3 → 0.6.4

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 CHANGED
@@ -44,6 +44,8 @@ dsh plugin --profile web add dsh-plugin-mobile-gateway@latest
44
44
  npx --yes dsh-plugin-mobile-gateway@latest init
45
45
  ```
46
46
 
47
+ `init` 会把当前正在执行的 npm 包精确版本安装到 DSH profile,并仅对该版本跳过 pnpm 的新版本等待期,确保插件与 Helper 版本一致。
48
+
47
49
  安装后停止并重新启动 WebUI:
48
50
 
49
51
  ```bash
package/bin/setup-ip.mjs CHANGED
@@ -23,6 +23,21 @@ const HELPER_INSTALL = '/usr/local/libexec/dsh-mobile-gateway-helper'
23
23
  const HELPER_SERVICE = '/etc/systemd/system/dsh-mobile-gateway-helper.service'
24
24
  const HELPER_SOCKET = '/run/dsh-mobile-gateway/helper.sock'
25
25
 
26
+ function currentPackageSpec() {
27
+ const manifest = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
28
+ if (typeof manifest.name !== 'string' || !manifest.name || typeof manifest.version !== 'string' || !manifest.version) {
29
+ throw new Error('package manifest is missing name or version')
30
+ }
31
+ return `${manifest.name}@${manifest.version}`
32
+ }
33
+
34
+ function pluginInstallArgs(packageSpec = currentPackageSpec()) {
35
+ return [
36
+ 'plugin', '--profile', 'web', 'add', packageSpec,
37
+ `--config.minimum-release-age-exclude=${packageSpec}`,
38
+ ]
39
+ }
40
+
26
41
  function printHelp() {
27
42
  console.log(`Usage:
28
43
  dsh-plugin-mobile-gateway setup [--ip <public IPv4>] [--port 3080] [--email <address>] [--yes]
@@ -134,7 +149,8 @@ async function init() {
134
149
  if (!commandExists('dsh') || !commandExists('sudo')) {
135
150
  throw new Error('init requires dsh and sudo on PATH')
136
151
  }
137
- run('dsh', ['plugin', '--profile', 'web', 'add', 'dsh-plugin-mobile-gateway@latest'])
152
+ const packageSpec = currentPackageSpec()
153
+ run('dsh', pluginInstallArgs(packageSpec))
138
154
  const script = fileURLToPath(import.meta.url)
139
155
  run('sudo', ['env', `PATH=${process.env.PATH || ''}`, process.execPath, script, 'setup-helper'])
140
156
  console.log('\nInitialization completed. Start or restart DSH with: dsh web')
@@ -419,9 +435,11 @@ async function remove(options) {
419
435
  export {
420
436
  assertPublicIpv4,
421
437
  certName,
438
+ currentPackageSpec,
422
439
  nginxHttpConfig,
423
440
  nginxTlsConfig,
424
441
  parseArgs,
442
+ pluginInstallArgs,
425
443
  helperService,
426
444
  renewalService,
427
445
  renewalTimer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-mobile-gateway",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "update readme",
5
5
  "main": "lib/index.mjs",
6
6
  "files": [