@logux/server 0.10.4 → 0.10.5

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.
@@ -597,7 +597,7 @@ interface GetProcessor {
597
597
  }
598
598
 
599
599
  interface PostProcessor {
600
- isValid(command: object): false
600
+ isValid(command: object): boolean
601
601
  command(command: object, request: object): Promise<void>
602
602
  }
603
603
 
@@ -378,12 +378,12 @@ export class BaseServer {
378
378
  if (!this.authenticator) {
379
379
  throw new Error('You must set authentication callback by server.auth()')
380
380
  }
381
- this.http = await createHttpServer(this.options)
382
- this.ws = new WebSocket.Server({ server: this.http })
381
+ this.httpServer = await createHttpServer(this.options)
382
+ this.ws = new WebSocket.Server({ server: this.httpServer })
383
383
  if (!this.options.server) {
384
384
  await new Promise((resolve, reject) => {
385
385
  this.ws.on('error', reject)
386
- this.http.listen(this.options.port, this.options.host, resolve)
386
+ this.httpServer.listen(this.options.port, this.options.host, resolve)
387
387
  })
388
388
  }
389
389
  bindControlServer(this, this.httpListener)
@@ -395,12 +395,12 @@ export class BaseServer {
395
395
  this.ws.close()
396
396
  })
397
397
  )
398
- if (this.http) {
398
+ if (this.httpServer) {
399
399
  this.unbind.push(
400
400
  () =>
401
401
  new Promise(resolve => {
402
- this.http.on('close', resolve)
403
- this.http.close()
402
+ this.httpServer.on('close', resolve)
403
+ this.httpServer.close()
404
404
  })
405
405
  )
406
406
  }
@@ -18,7 +18,7 @@ function isValidBody(body) {
18
18
 
19
19
  export function bindControlServer(app, custom) {
20
20
  let masks = app.options.controlMask.split(/,\s*/).map(i => ip.cidrSubnet(i))
21
- app.http.on('request', async (req, res) => {
21
+ app.httpServer.on('request', async (req, res) => {
22
22
  let urlString = req.url
23
23
  if (/^\/\w+%3F/.test(urlString)) urlString = decodeURIComponent(urlString)
24
24
  let reqUrl = new URL(urlString, 'http://localhost')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logux/server",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "description": "Build own Logux server or make proxy between WebSocket and HTTP backend on any language",
5
5
  "keywords": [
6
6
  "logux",
@@ -35,7 +35,7 @@
35
35
  "dotenv": "^10.0.0",
36
36
  "globby": "^11.0.4",
37
37
  "ip": "^1.1.5",
38
- "nanocolors": "^0.2.10",
38
+ "nanocolors": "^0.2.12",
39
39
  "nanodelay": "^2.0.1",
40
40
  "nanoevents": "^6.0.1",
41
41
  "nanoid": "^3.1.28",