Skip to content

Commit

Permalink
cloud: fix short lived regression
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Sep 2, 2024
1 parent b5593d6 commit 4e923a7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/cloud/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

{
"scrypted.debugHost": "127.0.0.1",
"scrypted.debugHost": "scrypted-nvr",
}
4 changes: 2 additions & 2 deletions plugins/cloud/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
"@types/node": "^22.1.0",
"ts-node": "^10.9.2"
},
"version": "0.2.34"
"version": "0.2.35"
}
6 changes: 3 additions & 3 deletions plugins/cloud/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,10 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
}

async convertMedia(data: string | Buffer | any, fromMimeType: string, toMimeType: string, options?: MediaObjectOptions): Promise<MediaObject | Buffer | any> {
if (toMimeType !== ScryptedMimeTypes.Url)
if (!toMimeType.startsWith(ScryptedMimeTypes.Url))
throw new Error('unsupported cloud url conversion');

if (fromMimeType === ScryptedMimeTypes.LocalUrl) {
if (fromMimeType.startsWith(ScryptedMimeTypes.LocalUrl)) {
// if cloudflare is enabled and the plugin isn't set up as a custom domain, try to use the cloudflare url for
// short lived urls.
if (this.cloudflareTunnel && this.storageSettings.values.forwardingMode !== 'Custom Domain') {
Expand All @@ -746,7 +746,7 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
}
return this.whitelist(data.toString(), 10 * 365 * 24 * 60 * 60 * 1000, `https://${this.getHostname()}`);
}
else if (fromMimeType === ScryptedMimeTypes.PushEndpoint) {
else if (fromMimeType.startsWith(ScryptedMimeTypes.PushEndpoint)) {
const validDomain = this.getSSLHostname();
if (validDomain)
return Buffer.from(`https://${validDomain}${await this.getCloudMessagePath()}/${data}`);
Expand Down

0 comments on commit 4e923a7

Please sign in to comment.