mirror of
https://github.com/koush/scrypted.git
synced 2026-03-20 08:30:24 +00:00
cloud: server id reporting
This commit is contained in:
2
plugins/cloud/.vscode/settings.json
vendored
2
plugins/cloud/.vscode/settings.json
vendored
@@ -1,4 +1,4 @@
|
||||
|
||||
{
|
||||
"scrypted.debugHost": "scrypted-server",
|
||||
"scrypted.debugHost": "scrypted-nvr",
|
||||
}
|
||||
4
plugins/cloud/package-lock.json
generated
4
plugins/cloud/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/cloud",
|
||||
"version": "0.2.43",
|
||||
"version": "0.2.44",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/cloud",
|
||||
"version": "0.2.43",
|
||||
"version": "0.2.44",
|
||||
"dependencies": {
|
||||
"@eneris/push-receiver": "^4.2.0",
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -53,5 +53,5 @@
|
||||
"@types/node": "^22.5.2",
|
||||
"ts-node": "^10.9.2"
|
||||
},
|
||||
"version": "0.2.43"
|
||||
"version": "0.2.44"
|
||||
}
|
||||
|
||||
@@ -258,6 +258,7 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
|
||||
this.converters = [
|
||||
[ScryptedMimeTypes.LocalUrl, ScryptedMimeTypes.Url],
|
||||
[ScryptedMimeTypes.PushEndpoint, ScryptedMimeTypes.Url],
|
||||
['*/*', ScryptedMimeTypes.ServerId],
|
||||
];
|
||||
// legacy cleanup
|
||||
this.fromMimeType = undefined;
|
||||
@@ -723,10 +724,7 @@ 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.startsWith(ScryptedMimeTypes.Url))
|
||||
throw new Error('unsupported cloud url conversion');
|
||||
|
||||
if (fromMimeType.startsWith(ScryptedMimeTypes.LocalUrl)) {
|
||||
if (toMimeType.startsWith(ScryptedMimeTypes.Url) && 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') {
|
||||
@@ -740,7 +738,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.startsWith(ScryptedMimeTypes.PushEndpoint)) {
|
||||
else if (toMimeType.startsWith(ScryptedMimeTypes.Url) && fromMimeType.startsWith(ScryptedMimeTypes.PushEndpoint)) {
|
||||
const validDomain = this.getSSLHostname();
|
||||
if (validDomain)
|
||||
return Buffer.from(`https://${validDomain}${await this.getCloudMessagePath()}/${data}`);
|
||||
@@ -748,6 +746,9 @@ class ScryptedCloud extends ScryptedDeviceBase implements OauthClient, Settings,
|
||||
const url = `http://127.0.0.1/push/${data}`;
|
||||
return this.whitelist(url, 10 * 365 * 24 * 60 * 60 * 1000, `https://${this.getHostname()}${SCRYPTED_CLOUD_MESSAGE_PATH}`);
|
||||
}
|
||||
else if (toMimeType === ScryptedMimeTypes.ServerId) {
|
||||
return this.storageSettings.values.serverId;
|
||||
}
|
||||
|
||||
throw new Error('unsupported cloud url conversion');
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ class ScryptedMimeTypes(str, Enum):
|
||||
RequestMediaObject = "x-scrypted/x-scrypted-request-media-object"
|
||||
RequestMediaStream = "x-scrypted/x-scrypted-request-stream"
|
||||
SchemePrefix = "x-scrypted/x-scrypted-scheme-"
|
||||
ServerId = "text/x-server-id"
|
||||
Url = "text/x-uri"
|
||||
|
||||
class SecuritySystemMode(str, Enum):
|
||||
|
||||
@@ -2478,6 +2478,7 @@ export enum ScryptedMimeTypes {
|
||||
Url = 'text/x-uri',
|
||||
InsecureLocalUrl = 'text/x-insecure-local-uri',
|
||||
LocalUrl = 'text/x-local-uri',
|
||||
ServerId = 'text/x-server-id',
|
||||
|
||||
PushEndpoint = 'text/x-push-endpoint',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user