@apocaliss92/nodelink-js 0.4.18 → 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-EF6BCSCZ.js → chunk-XUL2Y2AL.js} +43 -9
- package/dist/chunk-XUL2Y2AL.js.map +1 -0
- package/dist/cli/rtsp-server.cjs +42 -8
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +1 -1
- package/dist/index.cjs +42 -8
- 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-EF6BCSCZ.js.map +0 -1
|
@@ -8203,6 +8203,9 @@ function computeDeviceCapabilities(params) {
|
|
|
8203
8203
|
const isDoorbellFromModel = typeof params.model === "string" && /doorbell/i.test(params.model);
|
|
8204
8204
|
const lightTypeRaw = supportItem ? supportItem.lightType : void 0;
|
|
8205
8205
|
const lightType = typeof lightTypeRaw === "number" ? lightTypeRaw : typeof lightTypeRaw === "string" ? Number(lightTypeRaw) : void 0;
|
|
8206
|
+
const ledCtrlRaw = supportItem ? supportItem.ledCtrl : void 0;
|
|
8207
|
+
const ledCtrl = typeof ledCtrlRaw === "number" ? ledCtrlRaw : typeof ledCtrlRaw === "string" ? Number(ledCtrlRaw) : void 0;
|
|
8208
|
+
const hasFloodlightFromLedCtrl = typeof ledCtrl === "number" && Number.isFinite(ledCtrl) && ledCtrl > 1;
|
|
8206
8209
|
const hasPtzFromSupport = hasPtzFromSupportItem || (ptzMode ? ptzMode !== "none" && ptzMode !== "0" : false);
|
|
8207
8210
|
const hasPanTiltFromSupport = ptzMode ? ptzMode.includes("pt") || ptzMode === "pt" || ptzMode === "ptz" : false;
|
|
8208
8211
|
const hasZoomFromSupport = ptzMode ? ptzMode.includes("z") : false;
|
|
@@ -8245,8 +8248,10 @@ function computeDeviceCapabilities(params) {
|
|
|
8245
8248
|
hasBattery,
|
|
8246
8249
|
hasIntercom: hasIntercomFromSupport,
|
|
8247
8250
|
hasSiren: hasSirenFromSupport || hasSirenFromAbilities,
|
|
8248
|
-
// lightType >= 2 indicates controllable white LED / floodlight (1 = IR only)
|
|
8249
|
-
|
|
8251
|
+
// lightType >= 2 indicates controllable white LED / floodlight (1 = IR only).
|
|
8252
|
+
// ledCtrl > 1 is a secondary signal that rescues firmwares like the Duo 3
|
|
8253
|
+
// WiFi which under-report lightType (=1) despite having a real spotlight.
|
|
8254
|
+
hasFloodlight: Number.isFinite(lightType) ? lightType >= 2 || hasFloodlightFromLedCtrl : hasFloodlightFromAbilities || hasFloodlightFromLedCtrl,
|
|
8250
8255
|
hasPir: hasPirFromAbilities || hasPirFromSupport,
|
|
8251
8256
|
isDoorbell,
|
|
8252
8257
|
hasAutotracking: ptzDisabledBySupport ? false : hasAutotrackingFromSupport || hasAutotrackingFromAbilities,
|
|
@@ -11232,9 +11237,11 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11232
11237
|
if (!this.sessionGuardIntervalTimer) {
|
|
11233
11238
|
client.once("push", () => {
|
|
11234
11239
|
void this.logActiveSessionsOnStartup();
|
|
11235
|
-
this.
|
|
11236
|
-
|
|
11237
|
-
|
|
11240
|
+
if (this.sessionGuardEnabled) {
|
|
11241
|
+
this.sessionGuardIntervalTimer = setInterval(() => {
|
|
11242
|
+
void this.maybeRebootOnTooManySessions();
|
|
11243
|
+
}, 6e4);
|
|
11244
|
+
}
|
|
11238
11245
|
});
|
|
11239
11246
|
}
|
|
11240
11247
|
}
|
|
@@ -11267,6 +11274,19 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11267
11274
|
_isMultiFocal;
|
|
11268
11275
|
/** Maximum dedicated sessions allowed before triggering a reboot (default: 7). */
|
|
11269
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;
|
|
11270
11290
|
sessionGuardRebootInFlight;
|
|
11271
11291
|
sessionGuardLastRebootAtMs;
|
|
11272
11292
|
/** Track last known session count and IDs for change detection. */
|
|
@@ -11958,7 +11978,9 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
11958
11978
|
} catch {
|
|
11959
11979
|
}
|
|
11960
11980
|
}
|
|
11961
|
-
|
|
11981
|
+
if (this.sessionGuardEnabled) {
|
|
11982
|
+
void this.maybeRebootOnTooManySessions();
|
|
11983
|
+
}
|
|
11962
11984
|
return newClient;
|
|
11963
11985
|
} catch (loginError) {
|
|
11964
11986
|
const prevCooldown = this.socketPoolCooldowns.get(this.host);
|
|
@@ -12268,6 +12290,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
12268
12290
|
logger: this.logger,
|
|
12269
12291
|
debugConfig: generalClient.getDebugConfig?.()
|
|
12270
12292
|
});
|
|
12293
|
+
this.sessionGuardEnabled = opts.enableSessionGuard === true;
|
|
12271
12294
|
const maxSessions = opts.maxDedicatedSessionsBeforeReboot;
|
|
12272
12295
|
if (typeof maxSessions === "number" && Number.isFinite(maxSessions) && maxSessions > 0) {
|
|
12273
12296
|
this.maxDedicatedSessionsBeforeReboot = Math.floor(maxSessions);
|
|
@@ -12441,6 +12464,7 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
|
|
|
12441
12464
|
*/
|
|
12442
12465
|
async maybeRebootOnTooManySessions() {
|
|
12443
12466
|
if (!this.client.isSocketConnected?.()) return;
|
|
12467
|
+
if (this.client.getTransport?.() === "udp") return;
|
|
12444
12468
|
const threshold = this.maxDedicatedSessionsBeforeReboot ?? 10;
|
|
12445
12469
|
if (this.sessionGuardRebootInFlight) return;
|
|
12446
12470
|
const cooldownMs = 10 * 6e4;
|
|
@@ -18592,7 +18616,7 @@ ${xml}`
|
|
|
18592
18616
|
const probed = await this.probeFloodlightSupportByCmd289(ch, {
|
|
18593
18617
|
timeoutMs: 2500
|
|
18594
18618
|
});
|
|
18595
|
-
capabilities.hasFloodlight = probed;
|
|
18619
|
+
capabilities.hasFloodlight = capabilities.hasFloodlight || probed;
|
|
18596
18620
|
}
|
|
18597
18621
|
let dingDongListIds;
|
|
18598
18622
|
let dingDongCfgIds;
|
|
@@ -18785,7 +18809,17 @@ ${xml}`
|
|
|
18785
18809
|
const isSingleMotionModel = normalizedModel ? checkModelMatch(DUAL_LENS_SINGLE_MOTION_MODELS, normalizedModel) : false;
|
|
18786
18810
|
const channelNumValue = typeof channelNum === "string" ? Number.parseInt(channelNum, 10) : channelNum;
|
|
18787
18811
|
const hasDualLensChannelCount = channelNumValue === 2 && Number.isFinite(channelNumValue);
|
|
18788
|
-
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;
|
|
18789
18823
|
if (!isDualLens) {
|
|
18790
18824
|
return {
|
|
18791
18825
|
isDualLens: false,
|
|
@@ -23945,4 +23979,4 @@ export {
|
|
|
23945
23979
|
isTcpFailureThatShouldFallbackToUdp,
|
|
23946
23980
|
autoDetectDeviceType
|
|
23947
23981
|
};
|
|
23948
|
-
//# sourceMappingURL=chunk-
|
|
23982
|
+
//# sourceMappingURL=chunk-XUL2Y2AL.js.map
|