diff --git a/app/modules/ws2p/index.ts b/app/modules/ws2p/index.ts index 433d62c694bd2a99fc0eaffc7ddda00796df4901..57c6dbeff398da3f3698f314594761a9a4f3bf48 100644 --- a/app/modules/ws2p/index.ts +++ b/app/modules/ws2p/index.ts @@ -239,26 +239,27 @@ export class WS2PAPI extends stream.Transform { } async getEndpoint() { - if (this.upnpAPI && this.server.conf.ws2p) { - const config = this.upnpAPI.getCurrentConfig() - return !config ? '' : ['WS2P', this.server.conf.ws2p.uuid, config.remotehost, config.port].join(' ') - } - else if (this.server.conf.ws2p - && this.server.conf.ws2p.uuid - && this.server.conf.ws2p.remotehost - && this.server.conf.ws2p.remoteport) { - let ep = ['WS2P', - this.server.conf.ws2p.uuid, - this.server.conf.ws2p.remotehost, - this.server.conf.ws2p.remoteport - ].join(' ') - if (this.server.conf.ws2p.remotepath) { - ep += ` ${this.server.conf.ws2p.remotepath}` + // If WS2P defined and enabled + if (this.server.conf.ws2p !== undefined && (this.server.conf.ws2p.publicAccess || this.server.conf.ws2p.privateAccess)) + { + if (this.server.conf.upnp && this.upnpAPI) { + const config = this.upnpAPI.getCurrentConfig() + return !config ? '' : ['WS2P', this.server.conf.ws2p.uuid, config.remotehost, config.port].join(' ') + } + else if (this.server.conf.ws2p.uuid + && this.server.conf.ws2p.remotehost + && this.server.conf.ws2p.remoteport) { + let ep = ['WS2P', + this.server.conf.ws2p.uuid, + this.server.conf.ws2p.remotehost, + this.server.conf.ws2p.remoteport + ].join(' ') + if (this.server.conf.ws2p.remotepath) { + ep += ` ${this.server.conf.ws2p.remotepath}` + } + return ep } - return ep - } - else { - return '' } + return '' } } \ No newline at end of file