@apocaliss92/nodelink-js 0.4.19 → 0.4.20
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/{chunk-5M7BGMLV.js → chunk-XUL2Y2AL.js} +35 -6
- package/dist/chunk-XUL2Y2AL.js.map +1 -0
- package/dist/cli/rtsp-server.cjs +34 -5
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +1 -1
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5M7BGMLV.js.map +0 -1
package/dist/cli/rtsp-server.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -19591,9 +19591,11 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
19591
19591
|
if (!this.sessionGuardIntervalTimer) {
|
|
19592
19592
|
client.once("push", () => {
|
|
19593
19593
|
void this.logActiveSessionsOnStartup();
|
|
19594
|
-
this.
|
|
19595
|
-
|
|
19596
|
-
|
|
19594
|
+
if (this.sessionGuardEnabled) {
|
|
19595
|
+
this.sessionGuardIntervalTimer = setInterval(() => {
|
|
19596
|
+
void this.maybeRebootOnTooManySessions();
|
|
19597
|
+
}, 6e4);
|
|
19598
|
+
}
|
|
19597
19599
|
});
|
|
19598
19600
|
}
|
|
19599
19601
|
}
|
|
@@ -19626,6 +19628,19 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
19626
19628
|
_isMultiFocal;
|
|
19627
19629
|
/** Maximum dedicated sessions allowed before triggering a reboot (default: 7). */
|
|
19628
19630
|
maxDedicatedSessionsBeforeReboot;
|
|
19631
|
+
/**
|
|
19632
|
+
* Opt-in: when `false` (default), the lib never starts the 60s periodic
|
|
19633
|
+
* `getOnlineUserList` poll and never schedules an automatic reboot based
|
|
19634
|
+
* on the session count. The post-socket-create probe at line ~1859 is
|
|
19635
|
+
* also skipped. Consumers that want the legacy behaviour can pass
|
|
19636
|
+
* `enableSessionGuard: true` to the constructor.
|
|
19637
|
+
*
|
|
19638
|
+
* Rationale: on BCUDP (battery cameras) the periodic poll wakes the
|
|
19639
|
+
* camera every minute and triggers a perpetual sleeping↔awake cycle —
|
|
19640
|
+
* see issue #18. Even on AC cameras the auto-reboot side effect is
|
|
19641
|
+
* surprising; making it explicit avoids astonishment.
|
|
19642
|
+
*/
|
|
19643
|
+
sessionGuardEnabled = false;
|
|
19629
19644
|
sessionGuardRebootInFlight;
|
|
19630
19645
|
sessionGuardLastRebootAtMs;
|
|
19631
19646
|
/** Track last known session count and IDs for change detection. */
|
|
@@ -20317,7 +20332,9 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
20317
20332
|
} catch {
|
|
20318
20333
|
}
|
|
20319
20334
|
}
|
|
20320
|
-
|
|
20335
|
+
if (this.sessionGuardEnabled) {
|
|
20336
|
+
void this.maybeRebootOnTooManySessions();
|
|
20337
|
+
}
|
|
20321
20338
|
return newClient;
|
|
20322
20339
|
} catch (loginError) {
|
|
20323
20340
|
const prevCooldown = this.socketPoolCooldowns.get(this.host);
|
|
@@ -20627,6 +20644,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
20627
20644
|
logger: this.logger,
|
|
20628
20645
|
debugConfig: generalClient.getDebugConfig?.()
|
|
20629
20646
|
});
|
|
20647
|
+
this.sessionGuardEnabled = opts.enableSessionGuard === true;
|
|
20630
20648
|
const maxSessions = opts.maxDedicatedSessionsBeforeReboot;
|
|
20631
20649
|
if (typeof maxSessions === "number" && Number.isFinite(maxSessions) && maxSessions > 0) {
|
|
20632
20650
|
this.maxDedicatedSessionsBeforeReboot = Math.floor(maxSessions);
|
|
@@ -20800,6 +20818,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
20800
20818
|
*/
|
|
20801
20819
|
async maybeRebootOnTooManySessions() {
|
|
20802
20820
|
if (!this.client.isSocketConnected?.()) return;
|
|
20821
|
+
if (this.client.getTransport?.() === "udp") return;
|
|
20803
20822
|
const threshold = this.maxDedicatedSessionsBeforeReboot ?? 10;
|
|
20804
20823
|
if (this.sessionGuardRebootInFlight) return;
|
|
20805
20824
|
const cooldownMs = 10 * 6e4;
|
|
@@ -27144,7 +27163,17 @@ ${xml}`
|
|
|
27144
27163
|
const isSingleMotionModel = normalizedModel ? checkModelMatch(DUAL_LENS_SINGLE_MOTION_MODELS, normalizedModel) : false;
|
|
27145
27164
|
const channelNumValue = typeof channelNum === "string" ? Number.parseInt(channelNum, 10) : channelNum;
|
|
27146
27165
|
const hasDualLensChannelCount = channelNumValue === 2 && Number.isFinite(channelNumValue);
|
|
27147
|
-
const
|
|
27166
|
+
const supportItemForChannel = (() => {
|
|
27167
|
+
if (!supportInfo) return void 0;
|
|
27168
|
+
const items = supportInfo.items;
|
|
27169
|
+
if (!Array.isArray(items)) return void 0;
|
|
27170
|
+
return items.find(
|
|
27171
|
+
(it) => typeof it === "object" && it !== null && "ledCtrl" in it
|
|
27172
|
+
);
|
|
27173
|
+
})();
|
|
27174
|
+
const binoCfgRaw = supportItemForChannel ? supportItemForChannel.binoCfg : void 0;
|
|
27175
|
+
const hasBinoCfgFlag = typeof binoCfgRaw === "number" ? binoCfgRaw > 0 : typeof binoCfgRaw === "string" ? Number(binoCfgRaw) > 0 : false;
|
|
27176
|
+
const isDualLens = hasBinoCfgFlag || isDualMotionModel || isSingleMotionModel || hasDualLensChannelCount;
|
|
27148
27177
|
if (!isDualLens) {
|
|
27149
27178
|
return {
|
|
27150
27179
|
isDualLens: false,
|