@apocaliss92/nodelink-js 0.4.28 โ 0.4.30
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/README.md +20 -13
- package/dist/{chunk-NQ7D5TLR.js โ chunk-AZZKLRJV.js} +11 -1
- package/dist/chunk-AZZKLRJV.js.map +1 -0
- package/dist/cli/rtsp-server.cjs +10 -0
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +1 -1
- package/dist/index.cjs +75 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +66 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-NQ7D5TLR.js.map +0 -1
package/README.md
CHANGED
|
@@ -39,27 +39,34 @@ await api.onSimpleEvent((event) => {
|
|
|
39
39
|
|
|
40
40
|
## Email Push for Battery Cameras
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Battery cameras (Argus, Go, โฆ) can't reliably keep a TCP/ONVIF push subscription alive while sleeping. The manager app embeds an SMTP server so the camera can deliver motion alerts via email โ the most resilient path for sleep-heavy devices.
|
|
42
|
+
Battery cameras (Argus, Go, โฆ) can't reliably keep a TCP/ONVIF push subscription alive while sleeping. The library ships an embedded SMTP intake (`createEmailPushServer`) so cameras can deliver motion alerts via e-mail โ the most resilient path for sleep-heavy devices. Both the manager UI and the [Scrypted Reolink Native plugin](https://github.com/apocaliss92/scrypted-reolink-native) consume the same intake.
|
|
45
43
|
|
|
46
44
|
**Flow**:
|
|
47
45
|
|
|
48
|
-
1.
|
|
49
|
-
2. Each camera
|
|
50
|
-
3.
|
|
51
|
-
|
|
46
|
+
1. Spin up the SMTP server. In the manager UI: **Settings โ Email Push** (default port `2525`, random `nodelink-<hex>` + 18-byte base64url credentials auto-generated on first boot). Programmatic: `createEmailPushServer({ config, cameraResolver, logger })` from this package.
|
|
47
|
+
2. Each camera is reachable at `cam-<cameraId>@<domain>`. The intake matches the recipient local-part against the consumer's `cameraResolver` callback to decide which camera owns the message.
|
|
48
|
+
3. Configure the camera-side SMTP one of three ways:
|
|
49
|
+
- **Auto** โ manager: **Email Push** tab in the camera modal โ *Auto-configure*. Scrypted: open the camera's Settings โ **E-mail Push** group โ *Auto-configure from Email Push Server*. Both call `setupEmailPushToManager` under the hood.
|
|
50
|
+
- **API** โ `await api.setupEmailPushToManager({ managerHost, managerPort, recipientLocalPart, domain, authUsername, authPassword, triggerTypes, attachmentType }, channel)`. The lib auto-wraps a bare username as `<user@domain>` so MAIL FROM stays RFC 5321 compliant.
|
|
51
|
+
- **Manual** โ fill the Reolink app form: server = manager LAN IP, port = `2525`, sender = `authUsername`, password = `authPassword`, TLS off, receiver = `cam-<id>@<domain>`.
|
|
52
|
+
4. On motion, the camera sends an e-mail. The intake parses it, classifies the trigger (`MD` / `people` / `vehicle`), and emits an `EmailPushEvent` on the shared bus. Snapshots are kept in memory only (no disk persistence) โ they're forwarded to whatever per-event handler the consumer wires (MQTT image entities in the manager, `motionDetected` flip in the Scrypted plugin).
|
|
53
|
+
|
|
54
|
+
See [documentation/baichuan-api/email.md](./documentation/baichuan-api/email.md) for the full Baichuan API surface and [documentation/baichuan-api/time.md](./documentation/baichuan-api/time.md) for the related NTP / DST / system clock setters.
|
|
55
|
+
|
|
56
|
+
**Library entry points**:
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
- `createEmailPushServer({ config, cameraResolver, logger, loadTls? })` โ factory returning `{ start, stop, restart, updateConfig, getStatus }`
|
|
59
|
+
- `subscribeEmailPushEvents({ cameraId? | match?, channel? })` on a `ReolinkBaichuanApi` instance โ bridges per-camera SMTP events into the same `onSimpleEvent` stream native Baichuan push uses
|
|
60
|
+
- `getRecentEmailPushEvents(limit)` โ bounded in-memory ring buffer of accepted deliveries
|
|
61
|
+
- `setupEmailPushToManager(params, channel)` โ orchestrator: `setEmail` + `setEmailTask` + optional `testEmail`
|
|
62
|
+
- `getEmail`, `setEmail`, `testEmail`, `getEmailTask`, `setEmailTask` โ low-level Baichuan accessors
|
|
54
63
|
|
|
55
|
-
**Key tRPC procedures**:
|
|
64
|
+
**Key manager tRPC procedures**:
|
|
56
65
|
|
|
57
66
|
- `emailPush.status`, `emailPush.start/stop/restart`, `emailPush.updateSettings`
|
|
58
67
|
- `emailPush.getCameraAddress`, `emailPush.listCameraAddresses`
|
|
59
|
-
- `emailPush.recentEvents
|
|
60
|
-
- `baichuan.
|
|
61
|
-
- `baichuan.getEmailTask`, `baichuan.setEmailTask`
|
|
62
|
-
- `baichuan.setupEmailPushToManager` (one-shot orchestrator)
|
|
68
|
+
- `emailPush.recentEvents` (last 300, in-memory)
|
|
69
|
+
- `baichuan.setupEmailPushToManager`, `baichuan.getEmail/setEmail/testEmail`, `baichuan.getEmailTask/setEmailTask`
|
|
63
70
|
|
|
64
71
|
---
|
|
65
72
|
|
|
@@ -13204,6 +13204,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
13204
13204
|
*/
|
|
13205
13205
|
subscribeEmailPushEvents(params) {
|
|
13206
13206
|
const channel = params.channel ?? 0;
|
|
13207
|
+
const onEvent = params.onEvent;
|
|
13207
13208
|
const matches = "match" in params ? params.match : (event) => event.cameraId === params.cameraId;
|
|
13208
13209
|
const off = onEmailPushEvent((event) => {
|
|
13209
13210
|
if (!matches(event)) return;
|
|
@@ -13219,6 +13220,15 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
13219
13220
|
timestamp: event.receivedAtMs
|
|
13220
13221
|
});
|
|
13221
13222
|
}
|
|
13223
|
+
if (onEvent) {
|
|
13224
|
+
try {
|
|
13225
|
+
onEvent(event);
|
|
13226
|
+
} catch (err) {
|
|
13227
|
+
this.logger.warn?.(
|
|
13228
|
+
`[ReolinkBaichuanApi] subscribeEmailPushEvents onEvent threw: ${err instanceof Error ? err.message : err}`
|
|
13229
|
+
);
|
|
13230
|
+
}
|
|
13231
|
+
}
|
|
13222
13232
|
});
|
|
13223
13233
|
return off;
|
|
13224
13234
|
}
|
|
@@ -24723,4 +24733,4 @@ export {
|
|
|
24723
24733
|
isTcpFailureThatShouldFallbackToUdp,
|
|
24724
24734
|
autoDetectDeviceType
|
|
24725
24735
|
};
|
|
24726
|
-
//# sourceMappingURL=chunk-
|
|
24736
|
+
//# sourceMappingURL=chunk-AZZKLRJV.js.map
|