mirror of
https://github.com/koush/scrypted.git
synced 2026-02-13 10:22:57 +00:00
amcrest/unifi: add device management urls
This commit is contained in:
@@ -39,6 +39,19 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
}
|
||||
|
||||
this.updateDeviceInfo();
|
||||
this.updateManagementUrl();
|
||||
}
|
||||
|
||||
updateManagementUrl() {
|
||||
const ip = this.storage.getItem('ip');
|
||||
if (!ip)
|
||||
return;
|
||||
const info = this.info || {};
|
||||
const managementUrl = `http://${ip}`;
|
||||
if (info.managementUrl !== managementUrl) {
|
||||
info.managementUrl = managementUrl;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
getRecordingStreamThumbnail(time: number): Promise<MediaObject> {
|
||||
@@ -412,6 +425,8 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
if (continuousRecording)
|
||||
interfaces.push(ScryptedInterface.VideoRecorder);
|
||||
provider.updateDevice(this.nativeId, this.name, interfaces, type);
|
||||
|
||||
this.updateManagementUrl();
|
||||
}
|
||||
|
||||
async startIntercom(media: MediaObject): Promise<void> {
|
||||
|
||||
@@ -3,8 +3,6 @@ import { ProtectCameraChannelConfig, ProtectCameraConfigInterface, ProtectCamera
|
||||
import child_process, { ChildProcess } from 'child_process';
|
||||
import { ffmpegLogInitialOutput, safeKillFFmpeg } from '@scrypted/common/src/media-helpers';
|
||||
import { fitHeightToWidth } from "@scrypted/common/src/resolution-utils";
|
||||
import { listenZero } from "@scrypted/common/src/listen-cluster";
|
||||
import net from 'net';
|
||||
import WS from 'ws';
|
||||
import { once } from "events";
|
||||
import { FeatureFlagsShim } from "./shim";
|
||||
@@ -57,6 +55,13 @@ export class UnifiCamera extends ScryptedDeviceBase implements Notifier, Interco
|
||||
}
|
||||
|
||||
this.updateState(protectCamera);
|
||||
|
||||
const info = this.info || {};
|
||||
const managementUrl = `https://192.168.2.1/protect/devices/${protectCamera.id}`;
|
||||
if (info?.managementUrl !== managementUrl) {
|
||||
info.managementUrl = managementUrl;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
async setStatusLight(on: boolean) {
|
||||
|
||||
@@ -40,6 +40,8 @@ export class UnifiProtect extends ScryptedDeviceBase implements Settings, Device
|
||||
super(nativeId);
|
||||
|
||||
this.startup = this.discoverDevices(0)
|
||||
|
||||
this.updateManagementUrl();
|
||||
}
|
||||
|
||||
handleUpdatePacket(packet: any) {
|
||||
@@ -536,6 +538,19 @@ export class UnifiProtect extends ScryptedDeviceBase implements Settings, Device
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
updateManagementUrl() {
|
||||
const ip = this.storage.getItem('ip');
|
||||
if (!ip)
|
||||
return;
|
||||
const info = this.info || {};
|
||||
const managementUrl = `https://${ip}/protect/dashboard`;
|
||||
if (info.managementUrl !== managementUrl) {
|
||||
info.managementUrl = managementUrl;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
async putSetting(key: string, value: string | number) {
|
||||
if (key === 'instance-mode') {
|
||||
if (value === 'MIGRATE') {
|
||||
@@ -543,8 +558,11 @@ export class UnifiProtect extends ScryptedDeviceBase implements Settings, Device
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.storage.setItem(key, value.toString());
|
||||
this.discoverDevices(0);
|
||||
|
||||
this.updateManagementUrl();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user