@abtnode/router-provider 1.16.47-beta-20250731-014139-e860268f → 1.16.47-beta-20250801-094129-1ba43aaa

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.
@@ -238,6 +238,7 @@ DefaultProvider.check = async ({ configDir = '' } = {}) => {
238
238
 
239
239
  return result;
240
240
  };
241
+ DefaultProvider.version = '';
241
242
 
242
243
  DefaultProvider.getUsablePorts = () =>
243
244
  getUsablePorts(
@@ -84,6 +84,23 @@ const parseServerName = (domain) => {
84
84
  return domain;
85
85
  };
86
86
 
87
+ const getVersion = (nginxBinPath = '') => {
88
+ let binPath = nginxBinPath;
89
+ if (!binPath) {
90
+ const whichNginx = shelljs.which('nginx');
91
+ binPath = whichNginx ? whichNginx.toString() : '';
92
+ }
93
+ if (!binPath) {
94
+ return '';
95
+ }
96
+ const result = shelljs.exec(`${binPath} -v`, { silent: true });
97
+ let version = '';
98
+ if (result.code === 0) {
99
+ version = semver.coerce((result.stderr || result.stdout).split('/').pop())?.version || '';
100
+ }
101
+ return version;
102
+ };
103
+
87
104
  class NginxProvider extends BaseProvider {
88
105
  /**
89
106
  * @param {object} options
@@ -459,9 +476,9 @@ class NginxProvider extends BaseProvider {
459
476
  capabilities.modsecurity = modulePaths.some((x) => toLower(x).includes('modsecurity'));
460
477
  }
461
478
 
462
- const result = shelljs.exec(`${this.binPath} -v`, { silent: true });
463
- if (result.code === 0) {
464
- capabilities.version = semver.coerce((result.stderr || result.stdout).split('/').pop())?.version || '';
479
+ const version = getVersion(this.binPath);
480
+ if (version) {
481
+ capabilities.version = version;
465
482
  }
466
483
 
467
484
  return capabilities;
@@ -1542,5 +1559,6 @@ NginxProvider.exists = () => !!shelljs.which('nginx');
1542
1559
 
1543
1560
  NginxProvider.getUsablePorts = () => getUsablePorts('nginx', hasPortPermission);
1544
1561
  NginxProvider.hasPortPermission = hasPortPermission;
1562
+ NginxProvider.version = getVersion();
1545
1563
 
1546
1564
  module.exports = NginxProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/router-provider",
3
- "version": "1.16.47-beta-20250731-014139-e860268f",
3
+ "version": "1.16.47-beta-20250801-094129-1ba43aaa",
4
4
  "description": "Routing engine implementations for abt node",
5
5
  "author": "polunzh <polunzh@gmail.com>",
6
6
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
@@ -32,11 +32,11 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/constant": "1.16.47-beta-20250731-014139-e860268f",
36
- "@abtnode/db-cache": "1.16.47-beta-20250731-014139-e860268f",
37
- "@abtnode/logger": "1.16.47-beta-20250731-014139-e860268f",
38
- "@abtnode/router-templates": "1.16.47-beta-20250731-014139-e860268f",
39
- "@abtnode/util": "1.16.47-beta-20250731-014139-e860268f",
35
+ "@abtnode/constant": "1.16.47-beta-20250801-094129-1ba43aaa",
36
+ "@abtnode/db-cache": "1.16.47-beta-20250801-094129-1ba43aaa",
37
+ "@abtnode/logger": "1.16.47-beta-20250801-094129-1ba43aaa",
38
+ "@abtnode/router-templates": "1.16.47-beta-20250801-094129-1ba43aaa",
39
+ "@abtnode/util": "1.16.47-beta-20250801-094129-1ba43aaa",
40
40
  "@arcblock/http-proxy": "^1.19.1",
41
41
  "@arcblock/is-valid-domain": "^1.0.5",
42
42
  "@ocap/util": "^1.21.0",
@@ -62,5 +62,5 @@
62
62
  "bluebird": "^3.7.2",
63
63
  "fs-extra": "^11.2.0"
64
64
  },
65
- "gitHead": "85b5870be6b7a531cd7a86bd132112d68547fde1"
65
+ "gitHead": "0c90ec548e798d7ca264c37189b3887769591047"
66
66
  }