cloud: update registration when port forwarding is disabled

This commit is contained in:
Koushik Dutta
2023-01-26 13:22:01 -08:00
parent fdda9267f7
commit 9515f6136b
3 changed files with 15 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/cloud",
"version": "0.0.52",
"version": "0.0.53",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/cloud",
"version": "0.0.52",
"version": "0.0.53",
"dependencies": {
"@eneris/push-receiver": "../../external/push-receiver",
"@scrypted/common": "file:../../common",

View File

@@ -50,5 +50,5 @@
"@types/nat-upnp": "^1.1.2",
"@types/node": "^18.11.18"
},
"version": "0.0.52"
"version": "0.0.53"
}

View File

@@ -207,8 +207,10 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
}
async refreshPortForward() {
if (this.storageSettings.values.forwardingMode === 'Disabled')
if (this.storageSettings.values.forwardingMode === 'Disabled') {
this.updatePortForward(0);
return;
}
let { upnpPort } = this.storageSettings.values;
if (!upnpPort)
@@ -217,6 +219,15 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
if (this.storageSettings.values.forwardingMode === 'Router Forward')
return this.updatePortForward(upnpPort);
if (upnpPort === 443) {
this.upnpStatus = 'Error: Port 443 Not Allowed';
const err = 'Scrypted Cloud does not allow reserving port 443 with UPNP. Set up a manual port forward if this is intended.';
this.log.a(err);
this.console.error(err);
this.onDeviceEvent(ScryptedInterface.Settings, undefined);
return;
}
const [localAddress] = await endpointManager.getLocalAddresses();
this.upnpClient.portMapping({
public: {