cloud: add ip checker

This commit is contained in:
Koushik Dutta
2023-02-10 08:16:46 -08:00
parent 31150601bf
commit 31faa2e4bd
3 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

@@ -227,7 +227,7 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
// scrypted cloud will replace localhost with requesting ip.
const ip = this.storageSettings.values.forwardingMode === 'Custom Domain'
? this.storageSettings.values.hostname?.toString()
: 'localhost';
: (await axios(`https://${SCRYPTED_SERVER}/_punch/ip`)).data.ip;
if (!ip)
throw new Error('Hostname is required for port Custom Domain setup.');