@camera.ui/server 0.0.78 → 0.0.79
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/server/package.json +1 -1
- package/dist/server/src/services/config/constants.js +2 -2
- package/dist/server/src/services/config/constants.js.map +1 -1
- package/dist/server/src/services/config/defaults.d.ts +2 -1
- package/dist/server/src/services/config/defaults.js +11 -7
- package/dist/server/src/services/config/defaults.js.map +1 -1
- package/package.json +1 -1
- package/CLAUDE.md +0 -91
package/dist/server/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ffmpegPath, isFfmpegAvailable } from 'node-av/ffmpeg';
|
|
2
2
|
import { platform } from 'node:os';
|
|
3
|
-
import { DEFAULT_CONFIG_LOGGER, DEFAULT_CONFIG_PLUGINS, DEFAULT_CONFIG_PORT, DEFAULT_CONFIG_SSL, DEFAULT_GO2RTC_CONFIG_API, DEFAULT_GO2RTC_CONFIG_FFMPEG, DEFAULT_GO2RTC_CONFIG_LOGGER, DEFAULT_GO2RTC_CONFIG_RTMP, DEFAULT_GO2RTC_CONFIG_RTSP, DEFAULT_GO2RTC_CONFIG_SRTP, DEFAULT_GO2RTC_CONFIG_WEBRTC, } from './defaults.js';
|
|
3
|
+
import { DEFAULT_CONFIG_LOGGER, DEFAULT_CONFIG_PLUGINS, DEFAULT_CONFIG_PORT, DEFAULT_CONFIG_SSL, DEFAULT_GO2RTC_CONFIG_API, DEFAULT_GO2RTC_CONFIG_FFMPEG, DEFAULT_GO2RTC_CONFIG_LOGGER, DEFAULT_GO2RTC_CONFIG_RTMP, DEFAULT_GO2RTC_CONFIG_RTSP, DEFAULT_GO2RTC_CONFIG_SRTP, DEFAULT_GO2RTC_CONFIG_WEBRTC, ELECTRON_PORT_OFFSET, } from './defaults.js';
|
|
4
4
|
// asar = true => app.asar.unpacked
|
|
5
5
|
// asar = false => app
|
|
6
6
|
export const ELECTRON_ASAR_UNPACKED = 'app';
|
|
@@ -18,7 +18,7 @@ export const DEFAULT_CONFIG = {
|
|
|
18
18
|
workers: {
|
|
19
19
|
enabled: false,
|
|
20
20
|
address: '',
|
|
21
|
-
port: 7422,
|
|
21
|
+
port: 7422 + ELECTRON_PORT_OFFSET,
|
|
22
22
|
master: '',
|
|
23
23
|
token: '',
|
|
24
24
|
name: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/services/config/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/services/config/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAKvB,mCAAmC;AACnC,sBAAsB;AACtB,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAgB;IAC9C;QACE,IAAI,EAAE,CAAC,8BAA8B,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,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,0BAA0B,CAAC;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,4BAA4B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { API, Ffmpeg, IConfigSSL, Log, Logger, PluginsSettings, RTMP, RTSP, SRTP, Webrtc } from './types.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ELECTRON_PORT_OFFSET: number;
|
|
3
|
+
export declare const DEFAULT_CONFIG_PORT: number;
|
|
3
4
|
export declare const DEFAULT_CONFIG_SSL: IConfigSSL;
|
|
4
5
|
export declare const DEFAULT_CONFIG_LOGGER: Logger;
|
|
5
6
|
export declare const DEFAULT_CONFIG_PLUGINS: PluginsSettings;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { IS_ELECTRON } from '@camera.ui/common/utils';
|
|
2
|
+
export const ELECTRON_PORT_OFFSET = IS_ELECTRON ? 100 : 0;
|
|
3
|
+
const withOffset = (base) => base + ELECTRON_PORT_OFFSET;
|
|
4
|
+
const listenWithOffset = (host, base) => `${host}:${withOffset(base)}`;
|
|
1
5
|
// server
|
|
2
|
-
export const DEFAULT_CONFIG_PORT = 3443;
|
|
6
|
+
export const DEFAULT_CONFIG_PORT = withOffset(3443);
|
|
3
7
|
export const DEFAULT_CONFIG_SSL = {
|
|
4
8
|
certFile: '',
|
|
5
9
|
keyFile: '',
|
|
@@ -21,26 +25,26 @@ export const DEFAULT_GO2RTC_CONFIG_LOGGER = {
|
|
|
21
25
|
export const DEFAULT_GO2RTC_CONFIG_API = {
|
|
22
26
|
origin: '*',
|
|
23
27
|
listen: '',
|
|
24
|
-
tls_listen: '127.0.0.1
|
|
28
|
+
tls_listen: listenWithOffset('127.0.0.1', 2000),
|
|
25
29
|
tls_cert: '',
|
|
26
30
|
tls_key: '',
|
|
27
31
|
tls_ca: '',
|
|
28
32
|
};
|
|
29
33
|
export const DEFAULT_GO2RTC_CONFIG_RTSP = {
|
|
30
|
-
listen: '0.0.0.0
|
|
34
|
+
listen: listenWithOffset('0.0.0.0', 2001),
|
|
31
35
|
default_query: 'video=all&audio=all',
|
|
32
36
|
username: 'admin',
|
|
33
37
|
password: 'admin',
|
|
34
38
|
};
|
|
35
39
|
export const DEFAULT_GO2RTC_CONFIG_SRTP = {
|
|
36
|
-
listen: '0.0.0.0
|
|
40
|
+
listen: listenWithOffset('0.0.0.0', 2002),
|
|
37
41
|
};
|
|
38
42
|
export const DEFAULT_GO2RTC_CONFIG_RTMP = {
|
|
39
|
-
listen: '0.0.0.0
|
|
43
|
+
listen: listenWithOffset('0.0.0.0', 2003),
|
|
40
44
|
};
|
|
41
45
|
export const DEFAULT_GO2RTC_CONFIG_WEBRTC = {
|
|
42
|
-
listen:
|
|
43
|
-
candidates: [
|
|
46
|
+
listen: `:${withOffset(2004)}/tcp`,
|
|
47
|
+
candidates: [`stun:${withOffset(2004)}`],
|
|
44
48
|
};
|
|
45
49
|
export const DEFAULT_GO2RTC_CONFIG_FFMPEG = {
|
|
46
50
|
bin: 'ffmpeg',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../src/services/config/defaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../src/services/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,GAAG,oBAAoB,CAAC;AACzE,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,IAAY,EAAU,EAAE,CAAC,GAAG,IAAI,IA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M,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM;IAClC,UAAU,EAAE,CAAC,QAAQ,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;CACzC,CAAC;AACF,MAAM,CAAC,MAAM,4BAA4B,GAAW;IAClD,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE,qHAAqH;IAC3H,8CAA8C;IAC9C,IAAI,EAAE,mKAAmK;IACzK,MAAM,EAAE,gEAAgE;CACzE,CAAC"}
|
package/package.json
CHANGED
package/CLAUDE.md
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# camera.ui server — code style
|
|
2
|
-
|
|
3
|
-
These rules apply to every `.ts` file under `server/src/` (excluding `_camera_ui_tools/`, `.tmp/`, `node_modules/`, `dist/`, `test/`). Apply them to new code automatically — no need to ask.
|
|
4
|
-
|
|
5
|
-
## Comments
|
|
6
|
-
|
|
7
|
-
- **No JSDoc.** Never write `/** ... */` blocks — not on classes, not on functions, not on types, not as section banners.
|
|
8
|
-
- **Inline `//` comments only when the *why* is non-obvious** — hidden constraint, subtle invariant, workaround for a specific bug, surprising behavior. Skip comments that restate what the code does or that just label sections (`// ── Foo ──`).
|
|
9
|
-
- Preserve `// eslint-disable-*`, `// @ts-*`, `// prettier-ignore` directives — they are not regular comments.
|
|
10
|
-
|
|
11
|
-
## Exports
|
|
12
|
-
|
|
13
|
-
- Top-level exported functions use the `function` keyword, not arrow form:
|
|
14
|
-
```ts
|
|
15
|
-
// ✅
|
|
16
|
-
export function foo(x: number): string { ... }
|
|
17
|
-
|
|
18
|
-
// ❌
|
|
19
|
-
export const foo = (x: number): string => { ... };
|
|
20
|
-
```
|
|
21
|
-
- Arrow form is fine for non-function exports (constants, schemas, instances) and for exports that genuinely need to capture closure or be passed as values.
|
|
22
|
-
|
|
23
|
-
## Class member order
|
|
24
|
-
|
|
25
|
-
Top-to-bottom inside every class:
|
|
26
|
-
|
|
27
|
-
1. public properties (incl. `public readonly`)
|
|
28
|
-
2. private / protected properties
|
|
29
|
-
3. constructor
|
|
30
|
-
4. public methods (getters/setters grouped with their visibility)
|
|
31
|
-
5. private / protected methods
|
|
32
|
-
|
|
33
|
-
Static members stay grouped with their visibility tier. Decorators stay attached to their target.
|
|
34
|
-
|
|
35
|
-
## Constructor parameter properties
|
|
36
|
-
|
|
37
|
-
Use the TS shorthand whenever a constructor parameter is just assigned to a same-named field:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
// ✅
|
|
41
|
-
class Foo {
|
|
42
|
-
constructor(private bar: Bar, public readonly baz: Baz) {}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ❌
|
|
46
|
-
class Foo {
|
|
47
|
-
private bar: Bar;
|
|
48
|
-
public readonly baz: Baz;
|
|
49
|
-
|
|
50
|
-
constructor(bar: Bar, baz: Baz) {
|
|
51
|
-
this.bar = bar;
|
|
52
|
-
this.baz = baz;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Skip the shorthand when the field is populated differently — `container.resolve<...>('foo')`, `new XService()`, transformations like `this.bar = bar.normalize()`, computed values, defaults via `??`, or `#privateField` syntax. Mix freely: convert the fields that qualify, leave the rest as field declarations.
|
|
58
|
-
|
|
59
|
-
## Imports
|
|
60
|
-
|
|
61
|
-
Three groups, separated by exactly one blank line, top to bottom:
|
|
62
|
-
|
|
63
|
-
1. **External value imports** — any specifier NOT starting with `.` or `..` (npm packages, `node:*`, `@scope/*`)
|
|
64
|
-
2. **Internal / relative value imports** — `./`, `../`
|
|
65
|
-
3. **Type imports** — every `import type` line, external and internal mixed in one block
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
import { container } from 'tsyringe';
|
|
69
|
-
import { open } from 'lmdb';
|
|
70
|
-
|
|
71
|
-
import { ConfigService } from '../services/config/index.js';
|
|
72
|
-
import { LoggerService } from '../services/logger/index.js';
|
|
73
|
-
|
|
74
|
-
import type { Database as DB } from 'lmdb';
|
|
75
|
-
import type { ConfigServiceInterface } from '../services/config/index.js';
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Code reuse
|
|
79
|
-
|
|
80
|
-
If a function body or 3+ line block is duplicated across files in the same folder, extract it into a helper file (next to the call sites or in an existing utils file). Don't extract just because something *looks* similar — only when the logic is identical and the abstraction is genuinely useful. Don't pre-design for hypothetical future reuse.
|
|
81
|
-
|
|
82
|
-
## After making changes
|
|
83
|
-
|
|
84
|
-
When a refactor / cleanup pass is done, run from `server/`:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm run format
|
|
88
|
-
npm run lint:fix
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Fix any remaining lint errors manually.
|