@apocaliss92/nodelink-js 0.4.31 → 0.4.33
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 +34 -2
- package/dist/{chunk-XVFCEFM6.js → chunk-OZL6C2YJ.js} +50 -1
- package/dist/{chunk-XVFCEFM6.js.map → chunk-OZL6C2YJ.js.map} +1 -1
- package/dist/cli/rtsp-server.cjs +49 -0
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +1 -1
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/rtsp-server.cjs
CHANGED
|
@@ -19143,6 +19143,13 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
19143
19143
|
* Once closed, the API instance should not be reused.
|
|
19144
19144
|
*/
|
|
19145
19145
|
_closed = false;
|
|
19146
|
+
/**
|
|
19147
|
+
* Off-handle for the auto-bridge between the global email-push bus
|
|
19148
|
+
* and this api's `simpleEventListeners`. Set in the constructor
|
|
19149
|
+
* when `emailPushCameraId` is provided; released in `close()`.
|
|
19150
|
+
* `undefined` means no bridge was requested for this api.
|
|
19151
|
+
*/
|
|
19152
|
+
emailPushAutoBridgeOff;
|
|
19146
19153
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
19147
19154
|
// SOCKET POOL - Tag-based socket management
|
|
19148
19155
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -19515,6 +19522,21 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
19515
19522
|
// check every 10s
|
|
19516
19523
|
simpleEventWatchdogSilenceThresholdMs = 5 * 6e4;
|
|
19517
19524
|
// 5 min without events
|
|
19525
|
+
/**
|
|
19526
|
+
* Whether the silence-based resubscribe path of the watchdog is
|
|
19527
|
+
* enabled. On UDP (battery cameras) silence is the *normal* state
|
|
19528
|
+
* while the device sleeps — firing `ensureSimpleEventSubscribed`
|
|
19529
|
+
* every 5 minutes wakes the camera on every tick, drains the
|
|
19530
|
+
* battery, and is observably wrong because the cam emits a
|
|
19531
|
+
* sleep/awake push when it actually wakes for motion.
|
|
19532
|
+
*
|
|
19533
|
+
* Defaults: `false` on UDP, `true` on TCP / `auto`. The subscription-
|
|
19534
|
+
* failed recovery path (Case 2) stays active regardless — it only
|
|
19535
|
+
* runs when the connection is alive, doesn't wake anyone, and is
|
|
19536
|
+
* useful on every transport when the initial subscribe call lost
|
|
19537
|
+
* the response packet.
|
|
19538
|
+
*/
|
|
19539
|
+
eventWatchdogSilenceResubscribeEnabled = true;
|
|
19518
19540
|
statePollingInterval;
|
|
19519
19541
|
udpSleepInferenceInterval;
|
|
19520
19542
|
udpLastInferredSleepStateByChannel = /* @__PURE__ */ new Map();
|
|
@@ -20472,6 +20494,12 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
20472
20494
|
} else {
|
|
20473
20495
|
this.eventResubscribeEnabled = opts.transport !== "udp";
|
|
20474
20496
|
}
|
|
20497
|
+
const explicitWatchdogResubscribe = opts.enableEventWatchdogSilenceResubscribe;
|
|
20498
|
+
if (typeof explicitWatchdogResubscribe === "boolean") {
|
|
20499
|
+
this.eventWatchdogSilenceResubscribeEnabled = explicitWatchdogResubscribe;
|
|
20500
|
+
} else {
|
|
20501
|
+
this.eventWatchdogSilenceResubscribeEnabled = opts.transport !== "udp";
|
|
20502
|
+
}
|
|
20475
20503
|
const maxSessions = opts.maxDedicatedSessionsBeforeReboot;
|
|
20476
20504
|
if (typeof maxSessions === "number" && Number.isFinite(maxSessions) && maxSessions > 0) {
|
|
20477
20505
|
this.maxDedicatedSessionsBeforeReboot = Math.floor(maxSessions);
|
|
@@ -20485,6 +20513,12 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
20485
20513
|
this.rebootAfterConsecutiveEconnreset = Math.floor(econnresetThreshold);
|
|
20486
20514
|
}
|
|
20487
20515
|
this.setupGeneralClientListeners();
|
|
20516
|
+
if (opts.emailPushCameraId) {
|
|
20517
|
+
this.emailPushAutoBridgeOff = this.subscribeEmailPushEvents({
|
|
20518
|
+
cameraId: opts.emailPushCameraId,
|
|
20519
|
+
channel: opts.emailPushChannel ?? 0
|
|
20520
|
+
});
|
|
20521
|
+
}
|
|
20488
20522
|
}
|
|
20489
20523
|
/**
|
|
20490
20524
|
* CGI forward: fetch RTSP URL for a channel via `GetRtspUrl`.
|
|
@@ -21288,6 +21322,14 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
21288
21322
|
if (this.simpleEventSubscribed && this.simpleEventLastReceivedAt > 0) {
|
|
21289
21323
|
const silence = now - this.simpleEventLastReceivedAt;
|
|
21290
21324
|
if (silence < this.simpleEventWatchdogSilenceThresholdMs) return;
|
|
21325
|
+
if (!this.eventWatchdogSilenceResubscribeEnabled) {
|
|
21326
|
+
this.logger.debug?.(
|
|
21327
|
+
`[ReolinkBaichuanApi] event watchdog: silence-based resubscribe disabled (UDP / battery), skipping`,
|
|
21328
|
+
{ host: this.host, silenceMs: silence }
|
|
21329
|
+
);
|
|
21330
|
+
this.simpleEventLastReceivedAt = now;
|
|
21331
|
+
return;
|
|
21332
|
+
}
|
|
21291
21333
|
(this.logger.warn ?? this.logger.log).call(
|
|
21292
21334
|
this.logger,
|
|
21293
21335
|
`[ReolinkBaichuanApi] event watchdog: no events for ${Math.round(silence / 6e4)} min, forcing resubscribe`,
|
|
@@ -21608,6 +21650,13 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
21608
21650
|
async close(options) {
|
|
21609
21651
|
if (this._closed) return;
|
|
21610
21652
|
this._closed = true;
|
|
21653
|
+
if (this.emailPushAutoBridgeOff) {
|
|
21654
|
+
try {
|
|
21655
|
+
this.emailPushAutoBridgeOff();
|
|
21656
|
+
} catch {
|
|
21657
|
+
}
|
|
21658
|
+
this.emailPushAutoBridgeOff = void 0;
|
|
21659
|
+
}
|
|
21611
21660
|
if (this.sessionGuardIntervalTimer) {
|
|
21612
21661
|
clearInterval(this.sessionGuardIntervalTimer);
|
|
21613
21662
|
this.sessionGuardIntervalTimer = void 0;
|