@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
|
@@ -11237,9 +11237,11 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11237
11237
|
if (!this.sessionGuardIntervalTimer) {
|
|
11238
11238
|
client.once("push", () => {
|
|
11239
11239
|
void this.logActiveSessionsOnStartup();
|
|
11240
|
-
this.
|
|
11241
|
-
|
|
11242
|
-
|
|
11240
|
+
if (this.sessionGuardEnabled) {
|
|
11241
|
+
this.sessionGuardIntervalTimer = setInterval(() => {
|
|
11242
|
+
void this.maybeRebootOnTooManySessions();
|
|
11243
|
+
}, 6e4);
|
|
11244
|
+
}
|
|
11243
11245
|
});
|
|
11244
11246
|
}
|
|
11245
11247
|
}
|
|
@@ -11272,6 +11274,19 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11272
11274
|
_isMultiFocal;
|
|
11273
11275
|
/** Maximum dedicated sessions allowed before triggering a reboot (default: 7). */
|
|
11274
11276
|
maxDedicatedSessionsBeforeReboot;
|
|
11277
|
+
/**
|
|
11278
|
+
* Opt-in: when `false` (default), the lib never starts the 60s periodic
|
|
11279
|
+
* `getOnlineUserList` poll and never schedules an automatic reboot based
|
|
11280
|
+
* on the session count. The post-socket-create probe at line ~1859 is
|
|
11281
|
+
* also skipped. Consumers that want the legacy behaviour can pass
|
|
11282
|
+
* `enableSessionGuard: true` to the constructor.
|
|
11283
|
+
*
|
|
11284
|
+
* Rationale: on BCUDP (battery cameras) the periodic poll wakes the
|
|
11285
|
+
* camera every minute and triggers a perpetual sleeping↔awake cycle —
|
|
11286
|
+
* see issue #18. Even on AC cameras the auto-reboot side effect is
|
|
11287
|
+
* surprising; making it explicit avoids astonishment.
|
|
11288
|
+
*/
|
|
11289
|
+
sessionGuardEnabled = false;
|
|
11275
11290
|
sessionGuardRebootInFlight;
|
|
11276
11291
|
sessionGuardLastRebootAtMs;
|
|
11277
11292
|
/** Track last known session count and IDs for change detection. */
|
|
@@ -11963,7 +11978,9 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11963
11978
|
} catch {
|
|
11964
11979
|
}
|
|
11965
11980
|
}
|
|
11966
|
-
|
|
11981
|
+
if (this.sessionGuardEnabled) {
|
|
11982
|
+
void this.maybeRebootOnTooManySessions();
|
|
11983
|
+
}
|
|
11967
11984
|
return newClient;
|
|
11968
11985
|
} catch (loginError) {
|
|
11969
11986
|
const prevCooldown = this.socketPoolCooldowns.get(this.host);
|
|
@@ -12273,6 +12290,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
12273
12290
|
logger: this.logger,
|
|
12274
12291
|
debugConfig: generalClient.getDebugConfig?.()
|
|
12275
12292
|
});
|
|
12293
|
+
this.sessionGuardEnabled = opts.enableSessionGuard === true;
|
|
12276
12294
|
const maxSessions = opts.maxDedicatedSessionsBeforeReboot;
|
|
12277
12295
|
if (typeof maxSessions === "number" && Number.isFinite(maxSessions) && maxSessions > 0) {
|
|
12278
12296
|
this.maxDedicatedSessionsBeforeReboot = Math.floor(maxSessions);
|
|
@@ -12446,6 +12464,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
12446
12464
|
*/
|
|
12447
12465
|
async maybeRebootOnTooManySessions() {
|
|
12448
12466
|
if (!this.client.isSocketConnected?.()) return;
|
|
12467
|
+
if (this.client.getTransport?.() === "udp") return;
|
|
12449
12468
|
const threshold = this.maxDedicatedSessionsBeforeReboot ?? 10;
|
|
12450
12469
|
if (this.sessionGuardRebootInFlight) return;
|
|
12451
12470
|
const cooldownMs = 10 * 6e4;
|
|
@@ -18790,7 +18809,17 @@ ${xml}`
|
|
|
18790
18809
|
const isSingleMotionModel = normalizedModel ? checkModelMatch(DUAL_LENS_SINGLE_MOTION_MODELS, normalizedModel) : false;
|
|
18791
18810
|
const channelNumValue = typeof channelNum === "string" ? Number.parseInt(channelNum, 10) : channelNum;
|
|
18792
18811
|
const hasDualLensChannelCount = channelNumValue === 2 && Number.isFinite(channelNumValue);
|
|
18793
|
-
const
|
|
18812
|
+
const supportItemForChannel = (() => {
|
|
18813
|
+
if (!supportInfo) return void 0;
|
|
18814
|
+
const items = supportInfo.items;
|
|
18815
|
+
if (!Array.isArray(items)) return void 0;
|
|
18816
|
+
return items.find(
|
|
18817
|
+
(it) => typeof it === "object" && it !== null && "ledCtrl" in it
|
|
18818
|
+
);
|
|
18819
|
+
})();
|
|
18820
|
+
const binoCfgRaw = supportItemForChannel ? supportItemForChannel.binoCfg : void 0;
|
|
18821
|
+
const hasBinoCfgFlag = typeof binoCfgRaw === "number" ? binoCfgRaw > 0 : typeof binoCfgRaw === "string" ? Number(binoCfgRaw) > 0 : false;
|
|
18822
|
+
const isDualLens = hasBinoCfgFlag || isDualMotionModel || isSingleMotionModel || hasDualLensChannelCount;
|
|
18794
18823
|
if (!isDualLens) {
|
|
18795
18824
|
return {
|
|
18796
18825
|
isDualLens: false,
|
|
@@ -23950,4 +23979,4 @@ export {
|
|
|
23950
23979
|
isTcpFailureThatShouldFallbackToUdp,
|
|
23951
23980
|
autoDetectDeviceType
|
|
23952
23981
|
};
|
|
23953
|
-
//# sourceMappingURL=chunk-
|
|
23982
|
+
//# sourceMappingURL=chunk-XUL2Y2AL.js.map
|