cloud: more fixes for having a dangling custom domain value

This commit is contained in:
Koushik Dutta
2023-01-28 20:09:19 -08:00
parent 2edc60d912
commit dc5df78348
3 changed files with 8 additions and 5 deletions

View File

@@ -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",

View File

@@ -52,5 +52,5 @@
"@types/nat-upnp": "^1.1.2",
"@types/node": "^18.11.18"
},
"version": "0.1.6"
"version": "0.1.7"
}

View File

@@ -35,7 +35,7 @@ class ScryptedPush extends ScryptedDeviceBase implements BufferConverter {
}
async convert(data: Buffer | string, fromMimeType: string): Promise<Buffer> {
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<Buffer> {
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}`);
}