diff --git a/plugins/cloud/package-lock.json b/plugins/cloud/package-lock.json index 100e09be5..375477337 100644 --- a/plugins/cloud/package-lock.json +++ b/plugins/cloud/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/cloud", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/cloud", - "version": "0.1.6", + "version": "0.1.7", "dependencies": { "@eneris/push-receiver": "../../external/push-receiver", "@scrypted/common": "file:../../common", diff --git a/plugins/cloud/package.json b/plugins/cloud/package.json index 8001babab..34a29a08b 100644 --- a/plugins/cloud/package.json +++ b/plugins/cloud/package.json @@ -52,5 +52,5 @@ "@types/nat-upnp": "^1.1.2", "@types/node": "^18.11.18" }, - "version": "0.1.6" + "version": "0.1.7" } diff --git a/plugins/cloud/src/main.ts b/plugins/cloud/src/main.ts index 54b4ec9b7..ec4822555 100644 --- a/plugins/cloud/src/main.ts +++ b/plugins/cloud/src/main.ts @@ -35,7 +35,7 @@ class ScryptedPush extends ScryptedDeviceBase implements BufferConverter { } async convert(data: Buffer | string, fromMimeType: string): Promise { - if (this.cloud.storageSettings.values.hostname) { + if (this.cloud.storageSettings.values.forwardingMode === 'Custom Domain' && this.cloud.storageSettings.values.hostname) { return Buffer.from(`https://${this.cloud.getHostname()}${await this.cloud.getCloudMessagePath()}/${data}`); } @@ -229,6 +229,9 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings, ? this.storageSettings.values.hostname?.toString() : 'localhost'; + if (!ip) + throw new Error('Hostname is required for port Custom Domain setup.'); + if (this.storageSettings.values.forwardingMode === 'Custom Domain') upnpPort = 443; @@ -331,7 +334,7 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings, async whitelist(localUrl: string, ttl: number, baseUrl: string): Promise { const local = Url.parse(localUrl); - if (this.storageSettings.values.hostname) { + if (this.storageSettings.values.forwardingMode === 'Custom Domain' && this.storageSettings.values.hostname) { return Buffer.from(`${baseUrl}${local.path}`); }