@camera.ui/browser 0.0.68 → 0.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/client.d.ts +2 -2
- package/dist/types/packages/client/browser/src/index.d.ts +2 -2
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +4 -5
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +3 -3
- package/dist/types/packages/client/browser/src/proxy/index.d.ts +4 -4
- package/dist/types/packages/client/browser/src/proxy/pluginsManager.d.ts +2 -2
- package/dist/types/packages/client/browser/src/proxy/systemManager.d.ts +2 -2
- package/dist/types/packages/client/browser/src/socket.d.ts +1 -1
- package/dist/types/packages/client/browser/src/types.d.ts +3 -3
- package/dist/types/server/bin/python.d.ts +43 -0
- package/dist/types/server/src/api/database/index.d.ts +24 -0
- package/dist/types/server/src/api/database/types.d.ts +13 -35
- package/dist/types/server/src/api/go2rtc/api/application.d.ts +9 -0
- package/dist/types/server/src/api/go2rtc/api/config.d.ts +9 -0
- package/dist/types/server/src/api/go2rtc/api/index.d.ts +2 -0
- package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +8 -0
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +11 -0
- package/dist/types/server/src/api/go2rtc/index.d.ts +13 -0
- package/dist/types/server/src/api/go2rtc/queue.d.ts +10 -0
- package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +41 -0
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +2 -2
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/config.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/users.schema.d.ts +2 -2
- package/dist/types/server/src/api/services/auth.service.d.ts +20 -0
- package/dist/types/server/src/api/services/cameras.service.d.ts +54 -0
- package/dist/types/server/src/api/services/plugins.service.d.ts +25 -0
- package/dist/types/server/src/api/services/users.service.d.ts +13 -0
- package/dist/types/server/src/api/types/index.d.ts +12 -12
- package/dist/types/server/src/api/utils/constants.d.ts +15 -0
- package/dist/types/server/src/api/websocket/index.d.ts +15 -0
- package/dist/types/server/src/api/websocket/nsp/frame.d.ts +10 -0
- package/dist/types/server/src/api/websocket/nsp/logs.d.ts +11 -0
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +33 -0
- package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +11 -0
- package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +13 -0
- package/dist/types/server/src/api/websocket/nsp/server.d.ts +9 -0
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +20 -0
- package/dist/types/server/src/api/websocket/nsp/streams.d.ts +15 -0
- package/dist/types/server/src/api/{ws → websocket}/types.d.ts +3 -3
- package/dist/types/server/src/api.d.ts +44 -0
- package/dist/types/server/src/camera/base/cameraDevice.d.ts +6 -5
- package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +3 -2
- package/dist/types/server/src/camera/base/index.d.ts +18 -3
- package/dist/types/server/src/camera/controller.d.ts +27 -0
- package/dist/types/server/src/camera/streaming/browser/browser-peer-connection.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/browser/browser-streaming-session.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/browser/webrtc-browser-connection.d.ts +5 -5
- package/dist/types/server/src/camera/streaming/peer-connection.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/streaming-session.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +5 -5
- package/dist/types/server/src/camera/types.d.ts +29 -22
- package/dist/types/server/src/decoder/index.d.ts +11 -0
- package/dist/types/server/src/decoder/types.d.ts +7 -3
- package/dist/types/server/src/decoder/worker/index.d.ts +3 -0
- package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +36 -0
- package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +17 -0
- package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +22 -0
- package/dist/types/server/src/go2rtc/index.d.ts +25 -0
- package/dist/types/server/src/nats/constants.d.ts +1 -0
- package/dist/types/server/src/nats/index.d.ts +34 -0
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +96 -0
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +31 -0
- package/dist/types/server/src/nats/proxy/index.d.ts +4 -0
- package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +12 -0
- package/dist/types/server/src/nats/proxy/systemManager.d.ts +8 -0
- package/dist/types/server/src/nats/queue.d.ts +17 -0
- package/dist/types/server/src/nats/server.d.ts +33 -0
- package/dist/types/server/src/nats/types.d.ts +21 -13
- package/dist/types/server/src/nats/utils.d.ts +4 -0
- package/dist/types/server/src/nats/websocket.d.ts +22 -0
- package/dist/types/server/src/plugins/base.d.ts +7 -0
- package/dist/types/server/src/plugins/index.d.ts +29 -0
- package/dist/types/server/src/plugins/node/api.d.ts +42 -0
- package/dist/types/server/src/plugins/node/cameraStorage.d.ts +108 -0
- package/dist/types/server/src/plugins/node/config.d.ts +104 -0
- package/dist/types/server/src/plugins/node/logger.d.ts +14 -0
- package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +44 -0
- package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +47 -0
- package/dist/types/server/src/plugins/node/proxy/index.d.ts +4 -0
- package/dist/types/server/src/plugins/node/proxy/pluginsManager.d.ts +38 -0
- package/dist/types/server/src/plugins/node/proxy/queue.d.ts +18 -0
- package/dist/types/server/src/plugins/node/proxy/systemManager.d.ts +36 -0
- package/dist/types/server/src/plugins/node/schema.d.ts +268 -0
- package/dist/types/server/src/plugins/node/storageController.d.ts +28 -0
- package/dist/types/server/src/plugins/plugin.d.ts +42 -0
- package/dist/types/server/src/plugins/types.d.ts +3 -3
- package/dist/types/server/src/plugins/worker-ipc.d.ts +22 -0
- package/dist/types/server/src/plugins/worker.d.ts +30 -0
- package/dist/types/server/src/services/config/constants.d.ts +6 -0
- package/dist/types/server/src/services/config/index.d.ts +60 -0
- package/dist/types/server/src/services/logger/index.d.ts +28 -0
- package/dist/types/server/src/utils/index.d.ts +6 -0
- package/dist/types/shared/types/index.d.ts +12 -12
- package/package.json +6 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeviceManager, PluginsManager, SystemManager } from './proxy';
|
|
2
|
-
import type { CameraUiClientConfig } from './types';
|
|
1
|
+
import { DeviceManager, PluginsManager, SystemManager } from './proxy/index.js';
|
|
2
|
+
import type { CameraUiClientConfig } from './types.js';
|
|
3
3
|
export interface API {
|
|
4
4
|
deviceManager: DeviceManager;
|
|
5
5
|
pluginsManager: PluginsManager;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './client';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './types.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BrowserCameraDevice } from '../../../../../server/src/camera/base/cameraDeviceBrowser';
|
|
2
|
-
import type { BaseLogger, Camera, CameraSource, IceServer, OnSetEvent, StateValues } from '../../../../../shared/types';
|
|
3
|
-
import type { SocketService } from '../socket';
|
|
1
|
+
import { BrowserCameraDevice } from '../../../../../server/src/camera/base/cameraDeviceBrowser.js';
|
|
2
|
+
import type { BaseLogger, Camera, CameraSource, IceServer, OnSetEvent, StateValues } from '../../../../../shared/types/index.js';
|
|
3
|
+
import type { SocketService } from '../socket.js';
|
|
4
4
|
export declare class CameraDeviceProxy extends BrowserCameraDevice {
|
|
5
5
|
private socketService;
|
|
6
6
|
get sources(): CameraSource[];
|
|
@@ -9,9 +9,8 @@ export declare class CameraDeviceProxy extends BrowserCameraDevice {
|
|
|
9
9
|
disconnect(): Promise<void>;
|
|
10
10
|
reboot(): Promise<void>;
|
|
11
11
|
getIceServers(): Promise<IceServer[]>;
|
|
12
|
-
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
13
12
|
updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
|
|
14
13
|
refreshStates(): Promise<void>;
|
|
15
14
|
cleanup(): Promise<void>;
|
|
16
|
-
private
|
|
15
|
+
private listenToMessages;
|
|
17
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BrowserCameraDevice } from '../../../../../server/src/camera/base/cameraDeviceBrowser';
|
|
2
|
-
import type { BaseLogger, DeviceManagerBrowserProxyMethods } from '../../../../../shared/types';
|
|
3
|
-
import type { SocketService } from '../socket';
|
|
1
|
+
import { BrowserCameraDevice } from '../../../../../server/src/camera/base/cameraDeviceBrowser.js';
|
|
2
|
+
import type { BaseLogger, DeviceManagerBrowserProxyMethods } from '../../../../../shared/types/index.js';
|
|
3
|
+
import type { SocketService } from '../socket.js';
|
|
4
4
|
export declare class DeviceManager implements DeviceManagerBrowserProxyMethods {
|
|
5
5
|
private socketService;
|
|
6
6
|
private devices;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './cameraDevice';
|
|
2
|
-
export * from './deviceManager';
|
|
3
|
-
export * from './pluginsManager';
|
|
4
|
-
export * from './systemManager';
|
|
1
|
+
export * from './cameraDevice.js';
|
|
2
|
+
export * from './deviceManager.js';
|
|
3
|
+
export * from './pluginsManager.js';
|
|
4
|
+
export * from './systemManager.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseLogger, PluginsManagerBrowserProxyMethods } from '../../../../../shared/types';
|
|
2
|
-
import type { SocketService } from '../socket';
|
|
1
|
+
import type { BaseLogger, PluginsManagerBrowserProxyMethods } from '../../../../../shared/types/index.js';
|
|
2
|
+
import type { SocketService } from '../socket.js';
|
|
3
3
|
export declare class PluginsManager implements PluginsManagerBrowserProxyMethods {
|
|
4
4
|
private socketService;
|
|
5
5
|
private logger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseLogger, SystemManagerBrowserProxyMethods } from '../../../../../shared/types';
|
|
2
|
-
import type { SocketService } from '../socket';
|
|
1
|
+
import type { BaseLogger, SystemManagerBrowserProxyMethods } from '../../../../../shared/types/index.js';
|
|
2
|
+
import type { SocketService } from '../socket.js';
|
|
3
3
|
export declare class SystemManager implements SystemManagerBrowserProxyMethods {
|
|
4
4
|
private socketService;
|
|
5
5
|
private logger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Manager, type Socket } from 'socket.io-client';
|
|
2
|
-
import type { ManagerNames, WebsocketClientRequest } from '../../../../shared/types';
|
|
2
|
+
import type { ManagerNames, WebsocketClientRequest } from '../../../../shared/types/index.js';
|
|
3
3
|
export declare class SocketService {
|
|
4
4
|
manager: Manager;
|
|
5
5
|
private token;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BaseLogger } from '../../../../shared/types';
|
|
2
|
-
export type { AudioState, BaseLogger, BasicBrowserPeerConnection, BrowserCameraDevice, Camera, CameraConfig, CameraInput, DoorbellState, FfmpegOptions, Go2RtcAnswerMessage, Go2RtcIceCandidateMessage, Go2RtcIncomingMessage, Go2RtcOfferMessage, Go2RtcOutgoingMessage, LightState, MotionState, ObjectState, SirenState, } from '../../../../shared/types';
|
|
3
|
-
export { BrowserStreamingSession } from '../../../../shared/types';
|
|
1
|
+
import type { BaseLogger } from '../../../../shared/types/index.js';
|
|
2
|
+
export type { AudioState, BaseLogger, BasicBrowserPeerConnection, BrowserCameraDevice, Camera, CameraConfig, CameraInput, DoorbellState, FfmpegOptions, Go2RtcAnswerMessage, Go2RtcIceCandidateMessage, Go2RtcIncomingMessage, Go2RtcOfferMessage, Go2RtcOutgoingMessage, LightState, MotionState, ObjectState, SirenState, } from '../../../../shared/types/index.js';
|
|
3
|
+
export { BrowserStreamingSession } from '../../../../shared/types/index.js';
|
|
4
4
|
export type CameraUiClientConfig = WithCredentials | WithToken;
|
|
5
5
|
interface BaseConfig {
|
|
6
6
|
endpoint: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PortablePython } from '@bjia56/portable-python';
|
|
2
|
+
export declare const SERVER_PY_VERSION = "3.11";
|
|
3
|
+
export declare class PythonInstaller {
|
|
4
|
+
static readonly versions: string[];
|
|
5
|
+
readonly python: PortablePython;
|
|
6
|
+
readonly venvPath?: string;
|
|
7
|
+
readonly installPath: string;
|
|
8
|
+
private _version;
|
|
9
|
+
private identifier;
|
|
10
|
+
private logger;
|
|
11
|
+
private configService;
|
|
12
|
+
get isInstalled(): boolean;
|
|
13
|
+
get pluginPythonPath(): string;
|
|
14
|
+
get serverPythonPath(): string;
|
|
15
|
+
get pluginPackagesPath(): string;
|
|
16
|
+
get serverPackagesPath(): string;
|
|
17
|
+
get version(): string;
|
|
18
|
+
private get logPrefix();
|
|
19
|
+
constructor(identifier: string, venvDir?: string, version?: string);
|
|
20
|
+
install(): Promise<void>;
|
|
21
|
+
installPluginPython(): Promise<void>;
|
|
22
|
+
uninstall(): Promise<void>;
|
|
23
|
+
updatePluginDependencies(requirementsPath: string): Promise<void>;
|
|
24
|
+
updateServerDependencies(): Promise<void>;
|
|
25
|
+
installPluginPackages(pkgs: string[]): Promise<string>;
|
|
26
|
+
installServerPackages(pkgs: string[]): Promise<string>;
|
|
27
|
+
uninstallPluginPackages(pkgs: string[]): Promise<string>;
|
|
28
|
+
uninstallServerPackages(pkgs: string[]): Promise<string>;
|
|
29
|
+
private installPluginRequirements;
|
|
30
|
+
private installServerRequirements;
|
|
31
|
+
private updateRequirements;
|
|
32
|
+
private analyzeDependencies;
|
|
33
|
+
private updateDependencies;
|
|
34
|
+
private installRequirements;
|
|
35
|
+
private installPackages;
|
|
36
|
+
private uninstallPackages;
|
|
37
|
+
private getInstalledPackages;
|
|
38
|
+
private ensureVenv;
|
|
39
|
+
private createVenv;
|
|
40
|
+
private removeVenv;
|
|
41
|
+
private cleanPackageName;
|
|
42
|
+
private difference;
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Database as DB, RootDatabase as RootDB } from 'lmdb';
|
|
2
|
+
import type { FastifyInstance } from 'fastify';
|
|
3
|
+
import type { Plugin } from '../../plugins/plugin.js';
|
|
4
|
+
import type { DBAuth, DBCamera, DBPlugin, DBSettings, DBUser } from './types.js';
|
|
5
|
+
export declare class Database {
|
|
6
|
+
private db;
|
|
7
|
+
authDB: RootDB<DBAuth, 'auth'>;
|
|
8
|
+
camerasDB: DB<DBCamera[], 'cameras'>;
|
|
9
|
+
pluginsDB: DB<DBPlugin[], 'plugins'>;
|
|
10
|
+
settingsDB: DB<DBSettings, 'settings'>;
|
|
11
|
+
usersDB: DB<DBUser[], 'users'>;
|
|
12
|
+
private initialized;
|
|
13
|
+
private app;
|
|
14
|
+
private configService;
|
|
15
|
+
private logger;
|
|
16
|
+
constructor(app: FastifyInstance);
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
initialize(): Promise<Database>;
|
|
19
|
+
updateCameras(): Promise<void>;
|
|
20
|
+
createPluginDatabase(plugin: Plugin): Promise<void>;
|
|
21
|
+
private ensureDatabases;
|
|
22
|
+
private updateConfig;
|
|
23
|
+
private generateAdmin;
|
|
24
|
+
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import type { ClientData, JwtTokenEncoded } from '../types';
|
|
2
|
-
export interface
|
|
3
|
-
readonly _id: string;
|
|
4
|
-
_rev?: string;
|
|
5
|
-
settings: DBSetting;
|
|
6
|
-
}
|
|
7
|
-
export interface DBSetting {
|
|
8
|
-
}
|
|
9
|
-
export interface DBTokens {
|
|
10
|
-
readonly _id: string;
|
|
11
|
-
_rev?: string;
|
|
1
|
+
import type { ClientData, JwtTokenEncoded } from '../types/index.js';
|
|
2
|
+
export interface DBAuth {
|
|
12
3
|
tokens: JwtTokenEncoded[];
|
|
13
4
|
clients: ClientData[];
|
|
14
5
|
}
|
|
15
|
-
export interface
|
|
6
|
+
export interface DBCamera extends BaseCamera {
|
|
7
|
+
sources: CameraInputSettings[];
|
|
8
|
+
extensions: CameraExtensions;
|
|
9
|
+
interface: CameraUiSettings;
|
|
10
|
+
recording: CameraRecordingSettings;
|
|
11
|
+
}
|
|
12
|
+
export interface DBPlugin {
|
|
16
13
|
readonly _id: string;
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
pluginName: string;
|
|
15
|
+
storage: DBPluginStorage;
|
|
16
|
+
}
|
|
17
|
+
export interface DBSettings {
|
|
19
18
|
}
|
|
20
19
|
export interface DBUser {
|
|
21
20
|
readonly _id: string;
|
|
@@ -44,16 +43,6 @@ export interface DBCamviewLayoutCamera {
|
|
|
44
43
|
readonly _id: string;
|
|
45
44
|
name: string;
|
|
46
45
|
}
|
|
47
|
-
export interface DBPlugins {
|
|
48
|
-
readonly _id: string;
|
|
49
|
-
_rev?: string;
|
|
50
|
-
plugins: DBPlugin[];
|
|
51
|
-
}
|
|
52
|
-
export interface DBPlugin {
|
|
53
|
-
readonly _id: string;
|
|
54
|
-
pluginName: string;
|
|
55
|
-
storage: DBPluginStorage;
|
|
56
|
-
}
|
|
57
46
|
export interface DBPluginStorage {
|
|
58
47
|
[key: string]: {
|
|
59
48
|
config: DBPluginStorageValue;
|
|
@@ -62,11 +51,6 @@ export interface DBPluginStorage {
|
|
|
62
51
|
export interface DBPluginStorageValue {
|
|
63
52
|
[key: string]: any;
|
|
64
53
|
}
|
|
65
|
-
export interface DBCameras {
|
|
66
|
-
readonly _id: string;
|
|
67
|
-
_rev?: string;
|
|
68
|
-
cameras: DBCamera[];
|
|
69
|
-
}
|
|
70
54
|
export interface BaseCamera {
|
|
71
55
|
readonly _id: string;
|
|
72
56
|
nativeId?: string;
|
|
@@ -84,12 +68,6 @@ export interface BaseCamera {
|
|
|
84
68
|
objectZones: CameraZone[];
|
|
85
69
|
motionTimeout: number;
|
|
86
70
|
}
|
|
87
|
-
export interface DBCamera extends BaseCamera {
|
|
88
|
-
sources: CameraInputSettings[];
|
|
89
|
-
extensions: CameraExtensions;
|
|
90
|
-
interface: CameraUiSettings;
|
|
91
|
-
recording: CameraRecordingSettings;
|
|
92
|
-
}
|
|
93
71
|
export interface Camera extends BaseCamera {
|
|
94
72
|
hasAudioDetector: boolean;
|
|
95
73
|
hasMotionDetector: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RequestQueue } from '../queue.js';
|
|
2
|
+
import type { ApplicationResponse, ExitData } from '../types.js';
|
|
3
|
+
export declare class ApplicationApi {
|
|
4
|
+
private requestQueue;
|
|
5
|
+
constructor(requestQueue: RequestQueue);
|
|
6
|
+
close(data: ExitData): Promise<void>;
|
|
7
|
+
info(): Promise<ApplicationResponse>;
|
|
8
|
+
restart(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RequestQueue } from '../queue.js';
|
|
2
|
+
import type { AxiosResponse } from 'axios';
|
|
3
|
+
export declare class ConfigApi {
|
|
4
|
+
private requestQueue;
|
|
5
|
+
constructor(requestQueue: RequestQueue);
|
|
6
|
+
getConfig(): Promise<AxiosResponse>;
|
|
7
|
+
rewriteConfig(data: Record<string, any>): Promise<AxiosResponse>;
|
|
8
|
+
mergeConfig(data: Record<string, any>): Promise<AxiosResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RequestQueue } from '../queue.js';
|
|
2
|
+
import type { SourceData } from '../types.js';
|
|
3
|
+
export declare class SnapshotApi {
|
|
4
|
+
private requestQueue;
|
|
5
|
+
constructor(requestQueue: RequestQueue);
|
|
6
|
+
jpeg(data: SourceData): Promise<ArrayBuffer>;
|
|
7
|
+
mp4(data: SourceData): Promise<ArrayBuffer>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RequestQueue } from '../queue.js';
|
|
2
|
+
import type { AxiosResponse } from 'axios';
|
|
3
|
+
import type { SourceData, StreamData } from '../types.js';
|
|
4
|
+
export declare class StreamsApi {
|
|
5
|
+
private requestQueue;
|
|
6
|
+
constructor(requestQueue: RequestQueue);
|
|
7
|
+
createStream(data: StreamData): Promise<AxiosResponse>;
|
|
8
|
+
deleteStream(data: SourceData): Promise<AxiosResponse>;
|
|
9
|
+
getStreamInfo(data: SourceData): Promise<AxiosResponse>;
|
|
10
|
+
updateStreamSource(data: StreamData): Promise<AxiosResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApplicationApi } from './api/application.js';
|
|
2
|
+
import { ConfigApi } from './api/config.js';
|
|
3
|
+
import { SnapshotApi } from './api/snapshot.js';
|
|
4
|
+
import { StreamsApi } from './api/streams.js';
|
|
5
|
+
export declare class Go2RtcApi {
|
|
6
|
+
private requestQueue;
|
|
7
|
+
applicationApi: ApplicationApi;
|
|
8
|
+
configApi: ConfigApi;
|
|
9
|
+
snapshotApi: SnapshotApi;
|
|
10
|
+
streamsApi: StreamsApi;
|
|
11
|
+
constructor();
|
|
12
|
+
clear(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Algorithm } from 'jsonwebtoken';
|
|
2
|
+
import type { Socket } from 'socket.io';
|
|
3
|
+
export declare class UnauthorizedError extends Error {
|
|
4
|
+
inner: {
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
data: {
|
|
8
|
+
message: string;
|
|
9
|
+
code: string;
|
|
10
|
+
type: 'UnauthorizedError';
|
|
11
|
+
};
|
|
12
|
+
constructor(code: string, error: {
|
|
13
|
+
message: string;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export declare const isUnauthorizedError: (error: unknown) => error is UnauthorizedError;
|
|
17
|
+
declare module 'socket.io' {
|
|
18
|
+
interface Socket extends ExtendedSocket {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
interface ExtendedSocket {
|
|
22
|
+
encodedToken?: string;
|
|
23
|
+
decodedToken?: any;
|
|
24
|
+
user?: any;
|
|
25
|
+
}
|
|
26
|
+
type SocketIOMiddleware = (socket: Socket, next: (error?: UnauthorizedError) => void) => void;
|
|
27
|
+
interface CompleteDecodedToken {
|
|
28
|
+
header: {
|
|
29
|
+
alg: Algorithm;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
payload: any;
|
|
33
|
+
}
|
|
34
|
+
type SecretCallback = (decodedToken: CompleteDecodedToken) => Promise<string> | string;
|
|
35
|
+
export interface AuthorizeOptions {
|
|
36
|
+
secret: string | SecretCallback;
|
|
37
|
+
algorithms?: Algorithm[];
|
|
38
|
+
onAuthentication?: (decodedToken: any) => Promise<any> | any;
|
|
39
|
+
}
|
|
40
|
+
export declare const authorize: (options: AuthorizeOptions) => SocketIOMiddleware;
|
|
41
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { MultipartFile } from '../types';
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
import type { MultipartFile } from '../types/index.js';
|
|
3
3
|
export declare const ACCEPTED_BACKUP_TYPES: string[];
|
|
4
4
|
export declare const MAX_BACKUP_FILE_SIZE = 50000000;
|
|
5
5
|
export declare const downloadBackupSchema: zod.ZodObject<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import zod from 'zod';
|
|
2
2
|
export declare const logLevelSchema: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"trace">]>;
|
|
3
3
|
export declare const loggerSchema: zod.ZodObject<{
|
|
4
4
|
level: zod.ZodDefault<zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"trace">]>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import zod from 'zod';
|
|
2
2
|
export declare const logLevelGo2rtcSchema: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>;
|
|
3
3
|
export declare const logSchema: zod.ZodObject<{
|
|
4
4
|
format: zod.ZodDefault<zod.ZodString>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { MultipartFile } from '../types';
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
import type { MultipartFile } from '../types/index.js';
|
|
3
3
|
export declare const ACCEPTED_IMAGE_TYPES: string[];
|
|
4
4
|
export declare const MAX_IMAGE_FILE_SIZE = 5000000;
|
|
5
5
|
export declare const userPreferencesCamviewGridsLayoutCameras: zod.ZodObject<{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ClientData, JwtTokenClientData, JwtTokenEncoded } from '../types/index.js';
|
|
2
|
+
export declare class AuthService {
|
|
3
|
+
private configService;
|
|
4
|
+
private dbs;
|
|
5
|
+
constructor();
|
|
6
|
+
findById(id: string): JwtTokenEncoded | undefined;
|
|
7
|
+
findByRefreshToken(refresh_token: string): JwtTokenEncoded | undefined;
|
|
8
|
+
findByToken(access_token: string): JwtTokenEncoded | undefined;
|
|
9
|
+
clientDataById(id: string): ClientData | undefined;
|
|
10
|
+
clientDataByToken(acces_token: string): ClientData | undefined;
|
|
11
|
+
insert(jwtToken: JwtTokenEncoded, clientData?: ClientData): Promise<void>;
|
|
12
|
+
invalidateAll(): Promise<void>;
|
|
13
|
+
invalidateById(id: string): Promise<void>;
|
|
14
|
+
invalidateByRefreshToken(refresh_token: string): Promise<void>;
|
|
15
|
+
invalidateByToken(access_token: string): Promise<void>;
|
|
16
|
+
listTokens(): JwtTokenEncoded[];
|
|
17
|
+
listClientData(): Promise<ClientData[]>;
|
|
18
|
+
listTokensAndClientData(): JwtTokenClientData[];
|
|
19
|
+
patchTokenByRefreshToken(refresh_token: string, newJwtToken: JwtTokenEncoded): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type CameraExtension } from '../../plugins/types.js';
|
|
2
|
+
import type { Camera, CameraZone, DBCamera } from '../database/types.js';
|
|
3
|
+
type DeepPartial<T> = T extends object ? {
|
|
4
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
5
|
+
} : T;
|
|
6
|
+
export declare class CamerasService {
|
|
7
|
+
private configService;
|
|
8
|
+
private api;
|
|
9
|
+
private dbs;
|
|
10
|
+
private go2rtcApi;
|
|
11
|
+
private usersService;
|
|
12
|
+
private pluginsService;
|
|
13
|
+
constructor();
|
|
14
|
+
createCamera(cameraData: DBCamera): Promise<DBCamera>;
|
|
15
|
+
createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
|
|
16
|
+
createZone(cameraname: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
|
|
17
|
+
patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
|
|
18
|
+
removeZoneByName(cameraname: string, zonename: string, zoneType: 'motion' | 'object'): Promise<void>;
|
|
19
|
+
createCameraSource(cameraname: string, sourceName: string, address: string): Promise<void>;
|
|
20
|
+
resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
|
|
21
|
+
list(): DBCamera[];
|
|
22
|
+
listTransformed(): Camera[];
|
|
23
|
+
listByPluginId(pluginId: string): DBCamera[];
|
|
24
|
+
listTransformedByPluginId(pluginId: string): Camera[];
|
|
25
|
+
listByExtension(pluginName: string): DBCamera[];
|
|
26
|
+
listTransformedByExtension(pluginName: string, extensions: CameraExtension[]): Camera[];
|
|
27
|
+
findById(id: string): DBCamera | undefined;
|
|
28
|
+
findTransformedById(id: string): Camera | undefined;
|
|
29
|
+
findByName(cameraname: string): DBCamera | undefined;
|
|
30
|
+
findTransformedByName(cameraname: string): Camera | undefined;
|
|
31
|
+
findByPluginAndName(cameraname: string, pluginId: string): DBCamera | undefined;
|
|
32
|
+
findTransformedByPluginAndName(cameraname: string, pluginId: string): Camera | undefined;
|
|
33
|
+
patchCameraByName(cameraname: string, cameraData: DeepPartial<DBCamera>): Promise<DBCamera | undefined>;
|
|
34
|
+
enableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
|
|
35
|
+
disableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
|
|
36
|
+
addExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
|
|
37
|
+
removeExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
|
|
38
|
+
removeExtension(pluginName: string): Promise<void>;
|
|
39
|
+
removeByName(cameraname: string): Promise<void>;
|
|
40
|
+
removeById(id: string): Promise<void>;
|
|
41
|
+
removeByPluginId(pluginId: string): Promise<void>;
|
|
42
|
+
removeByPluginIdAndName(cameraname: string, pluginId: string): Promise<void>;
|
|
43
|
+
removeAll(): Promise<void>;
|
|
44
|
+
transformCamera(camera: DBCamera): Camera;
|
|
45
|
+
cameraSourcesChanged(oldCamera: DBCamera, newCamera: DBCamera): boolean;
|
|
46
|
+
private addCameraSources;
|
|
47
|
+
private removeCameraSources;
|
|
48
|
+
private generateWsUrls;
|
|
49
|
+
private generateRTSPUrls;
|
|
50
|
+
private generateFFmpegUrls;
|
|
51
|
+
private generateWWWUrls;
|
|
52
|
+
private extensionIsEnabled;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Plugin } from '../../plugins/plugin.js';
|
|
2
|
+
import type { PluginWorker } from '../../plugins/worker.js';
|
|
3
|
+
import type { DBPlugin } from '../database/types.js';
|
|
4
|
+
export declare class PluginsService {
|
|
5
|
+
private configService;
|
|
6
|
+
private dbs;
|
|
7
|
+
private pluginManager;
|
|
8
|
+
constructor();
|
|
9
|
+
listPlugins(): Plugin[];
|
|
10
|
+
listPluginProcesses(): PluginWorker[];
|
|
11
|
+
getPluginByName(pluginName: string): Plugin | undefined;
|
|
12
|
+
getPluginById(id: string): Plugin | undefined;
|
|
13
|
+
getPluginProcessByName(pluginName: string): PluginWorker | undefined;
|
|
14
|
+
getPluginProcessById(id: string): PluginWorker | undefined;
|
|
15
|
+
installedPlugins(): Plugin[];
|
|
16
|
+
installedPluginProcesses(): PluginWorker[];
|
|
17
|
+
listPluginDb(): DBPlugin[];
|
|
18
|
+
getPluginDbByName(pluginName: string): DBPlugin | undefined;
|
|
19
|
+
getPluginDbById(id: string): DBPlugin | undefined;
|
|
20
|
+
insertPluginDb(pluginName: string): Promise<DBPlugin>;
|
|
21
|
+
removePluginDbByName(pluginName: string): Promise<void>;
|
|
22
|
+
removePluginDbById(id: string): Promise<void>;
|
|
23
|
+
removeAllPluginsDb(): Promise<void>;
|
|
24
|
+
removeOrphanPluginsDb(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DBUser } from '../database/types.js';
|
|
2
|
+
export declare class UsersService {
|
|
3
|
+
private configService;
|
|
4
|
+
private dbs;
|
|
5
|
+
constructor();
|
|
6
|
+
createUser(userData: DBUser): Promise<DBUser>;
|
|
7
|
+
findById(id: string): DBUser | undefined;
|
|
8
|
+
findByName(username: string): DBUser | undefined;
|
|
9
|
+
list(): DBUser[];
|
|
10
|
+
patchUser(username: string, userData: Partial<DBUser>): Promise<DBUser | undefined>;
|
|
11
|
+
removeByName(username: string): Promise<void>;
|
|
12
|
+
removeAll(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type { Readable } from 'stream';
|
|
4
|
-
import type { CameraExtension, PluginContract, PluginRootSchema } from '../../plugins/types';
|
|
5
|
-
import type { LoggingLevel } from '../../services/config/types';
|
|
6
|
-
import type { CameraExtensions, CameraZone, DBCamera, DBCamviewLayout, DBRoles, DBUser } from '../database/types';
|
|
7
|
-
import type { ApplicationResponse } from '../go2rtc/types';
|
|
8
|
-
import type { RestoreBackupInput } from '../schemas/backup.schema';
|
|
9
|
-
import type { CreateCameraInput, PatchCameraInput, PreviewCameraInput } from '../schemas/cameras.schema';
|
|
10
|
-
import type { PatchConfigInput } from '../schemas/config.schema';
|
|
11
|
-
import type { PatchGo2RtcConfigInput } from '../schemas/go2rtc.schema';
|
|
12
|
-
import type { CreateUserInput, LoginUserInput, PatchUserInput } from '../schemas/users.schema';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { Readable } from 'node:stream';
|
|
4
|
+
import type { CameraExtension, PluginContract, PluginRootSchema } from '../../plugins/types.js';
|
|
5
|
+
import type { LoggingLevel } from '../../services/config/types.js';
|
|
6
|
+
import type { CameraExtensions, CameraZone, DBCamera, DBCamviewLayout, DBRoles, DBUser } from '../database/types.js';
|
|
7
|
+
import type { ApplicationResponse } from '../go2rtc/types.js';
|
|
8
|
+
import type { RestoreBackupInput } from '../schemas/backup.schema.js';
|
|
9
|
+
import type { CreateCameraInput, PatchCameraInput, PreviewCameraInput } from '../schemas/cameras.schema.js';
|
|
10
|
+
import type { PatchConfigInput } from '../schemas/config.schema.js';
|
|
11
|
+
import type { PatchGo2RtcConfigInput } from '../schemas/go2rtc.schema.js';
|
|
12
|
+
import type { CreateUserInput, LoginUserInput, PatchUserInput } from '../schemas/users.schema.js';
|
|
13
13
|
export interface BusboyFileStream extends Readable {
|
|
14
14
|
truncated: boolean;
|
|
15
15
|
bytesRead: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const HOST_CERT_FILENAME = "camera.ui.cert.pem";
|
|
2
|
+
export declare const HOST_KEY_FILENAME = "camera.ui.key.pem";
|
|
3
|
+
export declare const ROOT_CERT_FILENAME = "camera.ui.root.cert.pem";
|
|
4
|
+
export declare const ROOT_KEY_FILENAME = "camera.ui.root.key.pem";
|
|
5
|
+
export declare const P12_FILENAME = "camera.ui.p12";
|
|
6
|
+
export declare const P12_PASSWORD = "camera.ui";
|
|
7
|
+
export declare const DEFAULTS: {
|
|
8
|
+
C: string;
|
|
9
|
+
ST: string;
|
|
10
|
+
L: string;
|
|
11
|
+
O: string;
|
|
12
|
+
OU: string;
|
|
13
|
+
CN: string;
|
|
14
|
+
ROOT_CN: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Server } from 'socket.io';
|
|
2
|
+
import type { FastifyInstance } from 'fastify';
|
|
3
|
+
import type { ServerOptions } from 'socket.io';
|
|
4
|
+
import type { SocketNsp, SocketNspMap } from './types.js';
|
|
5
|
+
export declare class SocketService {
|
|
6
|
+
io: Server;
|
|
7
|
+
namespaces: Map<SocketNsp, SocketNspMap>;
|
|
8
|
+
adminNsp: SocketNsp[];
|
|
9
|
+
private logger;
|
|
10
|
+
private authService;
|
|
11
|
+
private configService;
|
|
12
|
+
constructor(app: FastifyInstance, opts: Partial<ServerOptions>);
|
|
13
|
+
private registerNamespaces;
|
|
14
|
+
private setupConnection;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
+
import type { SocketNsp } from '../types.js';
|
|
3
|
+
export declare class FrameNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
readonly connectedClients: Map<string, Set<Socket>>;
|
|
7
|
+
private decoder;
|
|
8
|
+
constructor(io: Server);
|
|
9
|
+
private handleConnection;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
+
import type { SocketNsp } from '../types.js';
|
|
3
|
+
export declare class LogsNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
private nativeTail?;
|
|
7
|
+
private configService;
|
|
8
|
+
constructor(io: Server);
|
|
9
|
+
connect(socket: Socket, filter?: string[]): void;
|
|
10
|
+
private tailLogFromFileNative;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Namespace, Server } from 'socket.io';
|
|
2
|
+
import type { CpuInfo, CpuTempInfo, MemoryInfo, NetworkInfo, PluginProcessesInfo, ProcessesInfo, SocketNsp } from '../types.js';
|
|
3
|
+
export declare class MetricsNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
private logger;
|
|
7
|
+
private configService;
|
|
8
|
+
private pluginManager;
|
|
9
|
+
private go2rtc;
|
|
10
|
+
private cpuHistory;
|
|
11
|
+
private cpuTempHistory;
|
|
12
|
+
private memHistory;
|
|
13
|
+
private networkHistory;
|
|
14
|
+
private processServerHistory;
|
|
15
|
+
private processGo2RtcHistory;
|
|
16
|
+
private processPluginsHistory;
|
|
17
|
+
private memoryInfo?;
|
|
18
|
+
constructor(io: Server);
|
|
19
|
+
getProcessesInfo(payload: any, callback?: Function): Promise<ProcessesInfo>;
|
|
20
|
+
getPluginsProcessesInfo(payload: any, callback?: Function): Promise<PluginProcessesInfo>;
|
|
21
|
+
getServerCpuInfo(payload?: any, callback?: Function): Promise<CpuInfo>;
|
|
22
|
+
getServerMemoryInfo(payload?: any, callback?: Function): Promise<MemoryInfo>;
|
|
23
|
+
getCpuTempInfo(payload?: any, callback?: Function): Promise<CpuTempInfo>;
|
|
24
|
+
getNetworkUsageInfo(payload?: any, callback?: Function): Promise<NetworkInfo>;
|
|
25
|
+
private getCpuTemp;
|
|
26
|
+
private getProcesses;
|
|
27
|
+
private getCpuLoad;
|
|
28
|
+
private getCpuLoadAlt;
|
|
29
|
+
private getCpuTempLegacy;
|
|
30
|
+
private getCpuTempAlt;
|
|
31
|
+
private getMemoryUsage;
|
|
32
|
+
private getCurrentNetworkUsage;
|
|
33
|
+
}
|