node-pluginsmanager-plugin 4.7.2 → 4.8.0

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.
@@ -145,7 +145,7 @@ module.exports = class Server extends MediatorUser {
145
145
  );
146
146
 
147
147
  // get descriptor
148
- if ("/" + this._Descriptor.info.title + "/descriptor" === req.pattern && "get" === req.method) {
148
+ if ("/" + this._Descriptor.info.title + "/api/descriptor" === req.pattern && "get" === req.method) {
149
149
 
150
150
  return new Promise((resolve, reject) => {
151
151
 
@@ -157,6 +157,27 @@ module.exports = class Server extends MediatorUser {
157
157
  return err ? reject(err) : resolve(api);
158
158
  });
159
159
 
160
+ // add current server
161
+ }).then((api) => {
162
+
163
+ const protocol = res.socket && Boolean(res.socket.encrypted) ? "https" : "http";
164
+
165
+ let port = res.socket && res.socket.localPort ? res.socket.localPort : 0;
166
+ if (!port) {
167
+ port = "http" === protocol ? 80 : 443;
168
+ }
169
+
170
+ if (!api.servers) {
171
+ api.servers = [];
172
+ }
173
+
174
+ api.servers.push({
175
+ "url": protocol + "://" + req.validatedIp + ":" + port,
176
+ "description": "Actual current server"
177
+ });
178
+
179
+ return Promise.resolve(api);
180
+
160
181
  }).then((api) => {
161
182
 
162
183
  this._log("info", "<= [" + req.validatedIp + "] " + JSON.stringify(api));
@@ -179,7 +200,7 @@ module.exports = class Server extends MediatorUser {
179
200
  }
180
201
 
181
202
  // get plugin status
182
- else if ("/" + this._Descriptor.info.title + "/status" === req.pattern && "get" === req.method) {
203
+ else if ("/" + this._Descriptor.info.title + "/api/status" === req.pattern && "get" === req.method) {
183
204
 
184
205
  const initialized = this.initialized && this._Mediator.initialized;
185
206
  const status = initialized ? "INITIALIZED" : "ENABLED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-pluginsmanager-plugin",
3
- "version": "4.7.2",
3
+ "version": "4.8.0",
4
4
  "description": "An abstract parent plugin for node-pluginsmanager",
5
5
  "main": "lib/main.js",
6
6
  "typings": "lib/index.d.ts",
@@ -39,21 +39,21 @@
39
39
  "express-openapi-validate": "0.6.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "16.9.4",
42
+ "@types/node": "17.0.23",
43
43
  "@types/socket.io": "3.0.2",
44
- "@types/ws": "7.4.7",
45
- "check-version-modules": "1.3.3",
44
+ "@types/ws": "8.5.3",
45
+ "check-version-modules": "1.3.5",
46
46
  "coveralls": "3.1.1",
47
47
  "colors": "1.4.0",
48
- "eslint": "7.32.0",
49
- "express": "4.17.1",
50
- "husky": "7.0.2",
51
- "mocha": "9.1.1",
48
+ "eslint": "8.12.0",
49
+ "express": "4.17.3",
50
+ "husky": "7.0.4",
51
+ "mocha": "9.2.2",
52
52
  "nyc": "15.1.0",
53
- "socket.io": "4.2.0",
54
- "socket.io-client": "4.2.0",
55
- "typescript": "4.4.3",
56
- "ws": "8.2.2"
53
+ "socket.io": "4.4.1",
54
+ "socket.io-client": "4.4.1",
55
+ "typescript": "4.6.3",
56
+ "ws": "8.5.0"
57
57
  },
58
58
  "homepage": "https://github.com/Psychopoulet/node-pluginsmanager-plugin#readme",
59
59
  "engines": {