eufy-security-client 3.8.0 → 4.0.0-dev.31
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 +24 -0
- package/build/eufysecurity.d.ts +2 -0
- package/build/eufysecurity.js +17 -0
- package/build/eufysecurity.js.map +1 -1
- package/build/http/api.d.ts +2 -0
- package/build/http/api.js +39 -6
- package/build/http/api.js.map +1 -1
- package/build/http/decodeImageV2.d.ts +51 -0
- package/build/http/decodeImageV2.js +359 -0
- package/build/http/decodeImageV2.js.map +1 -0
- package/build/http/device.d.ts +13 -1
- package/build/http/device.js +70 -15
- package/build/http/device.js.map +1 -1
- package/build/http/interfaces.d.ts +1 -0
- package/build/http/models.d.ts +1 -0
- package/build/http/station.d.ts +9 -1
- package/build/http/station.js +108 -31
- package/build/http/station.js.map +1 -1
- package/build/http/types.d.ts +4 -0
- package/build/http/types.js +218 -7
- package/build/http/types.js.map +1 -1
- package/build/http/utils.js +19 -0
- package/build/http/utils.js.map +1 -1
- package/build/p2p/adts.d.ts +12 -0
- package/build/p2p/adts.js +185 -0
- package/build/p2p/adts.js.map +1 -0
- package/build/p2p/interfaces.d.ts +10 -0
- package/build/p2p/session.d.ts +3 -1
- package/build/p2p/session.js +138 -30
- package/build/p2p/session.js.map +1 -1
- package/build/p2p/types.d.ts +1 -0
- package/build/p2p/types.js +1 -0
- package/build/p2p/types.js.map +1 -1
- package/build/p2p/utils.d.ts +11 -0
- package/build/p2p/utils.js +76 -4
- package/build/p2p/utils.js.map +1 -1
- package/coverage/clover.xml +9121 -8765
- package/coverage/coverage-final.json +33 -31
- package/coverage/lcov-report/index.html +41 -41
- package/coverage/lcov.info +18234 -16336
- package/package.json +11 -8
- package/.idea/eufy-security-client.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -7
- package/bin/act +0 -0
- package/coverage/lcov-report/cache.ts.html +0 -184
- package/coverage/lcov-report/error.ts.html +0 -871
- package/coverage/lcov-report/logging.ts.html +0 -598
- package/dont-care.js +0 -101
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Keyless decoder for eufy `v2_eufysecurity:` event / thumbnail images.
|
|
4
|
+
*
|
|
5
|
+
* The v2 wire format is NOT end-to-end encrypted and needs NO key, cipher, or
|
|
6
|
+
* E2E private key. It is *head-only obfuscation*: only a fixed ~286-byte JPEG
|
|
7
|
+
* prefix is AES-GCM encrypted (SOI + APP0/JFIF + the two DQT quantization
|
|
8
|
+
* tables + SOF dimensions + the first DHT table). Everything from the standard
|
|
9
|
+
* baseline DC-chrominance Huffman table marker (`FF C4 00 1F 01`) onward — the
|
|
10
|
+
* rest of the DHT, the SOS, the entire entropy-coded scan and the EOI — is left
|
|
11
|
+
* as plaintext, standard baseline JPEG.
|
|
12
|
+
*
|
|
13
|
+
* So we reconstruct a viewable JPEG by splicing a freshly built *standard*
|
|
14
|
+
* libjpeg header (correct width/height + chroma subsampling) onto the blob's
|
|
15
|
+
* plaintext tail. The encrypted prefix only ever held the quantization tables
|
|
16
|
+
* (=> a small quality/colour shift if we substitute standard q85 tables) and
|
|
17
|
+
* the image dimensions (=> the only thing that must be pinned exactly).
|
|
18
|
+
*
|
|
19
|
+
* Wire format: v2_eufysecurity:<SERIAL>:<10-digit-pkt>:<binary-ciphertext>
|
|
20
|
+
*
|
|
21
|
+
* Reverse-engineered 2026-06-04. Verified on 136 live blobs across every camera
|
|
22
|
+
* model / resolution under HomeBase 3 (dominant 256x144 4:2:0 = event thumbnail).
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.V2_PREFIX = void 0;
|
|
26
|
+
exports.buildJpegPrefix = buildJpegPrefix;
|
|
27
|
+
exports.spliceV2Image = spliceV2Image;
|
|
28
|
+
exports.decodeV2ImageAuto = decodeV2ImageAuto;
|
|
29
|
+
/** Standard baseline-JPEG DC-chrominance DHT marker — the first plaintext byte
|
|
30
|
+
* run in a v2 blob, and the splice point. */
|
|
31
|
+
const DC_CHROMA = Buffer.from([0xff, 0xc4, 0x00, 0x1f, 0x01]);
|
|
32
|
+
exports.V2_PREFIX = "v2_eufysecurity:";
|
|
33
|
+
/**
|
|
34
|
+
* Canonical standard libjpeg header (quality 85, 4:2:0), covering
|
|
35
|
+
* SOI + APP0 + DQT(luma) + DQT(chroma) + SOF0 + DHT(DC-luma) + DHT(AC-luma).
|
|
36
|
+
* It stops right before its own DC-chroma DHT, because the blob tail supplies
|
|
37
|
+
* the DC-chroma + AC-chroma DHT, the SOS and the scan. Dimensions are a
|
|
38
|
+
* placeholder (0x0101 x 0x0101) and the chroma sampling factor is patched at
|
|
39
|
+
* runtime (see splice offsets below).
|
|
40
|
+
*/
|
|
41
|
+
const PREFIX_TEMPLATE = Buffer.from("ffd8ffe000104a46494600010100000100010000ffdb0043000503040404030504040405050506070c08070707070f0b0b090c110f1212110f111113161c1713141a1511111821181a1d1d1f1f1f13172224221e241c1e1f1effdb0043010505050706070e08080e1e1411141e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1effc00011080101010103012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa", "hex");
|
|
42
|
+
// Byte offsets into PREFIX_TEMPLATE that we patch per image.
|
|
43
|
+
const OFF_HEIGHT = 163; // SOF0 height, big-endian uint16
|
|
44
|
+
const OFF_WIDTH = 165; // SOF0 width, big-endian uint16
|
|
45
|
+
const OFF_Y_SAMPLING = 169; // luma component sampling factor (0x22=4:2:0, 0x21=4:2:2, 0x11=4:4:4)
|
|
46
|
+
const Y_SAMPLING = { "4:2:0": 0x22, "4:2:2": 0x21, "4:4:4": 0x11 };
|
|
47
|
+
/** Build the standard JPEG header for a given geometry by patching the template. */
|
|
48
|
+
function buildJpegPrefix(width, height, subsampling = "4:2:0") {
|
|
49
|
+
const p = Buffer.from(PREFIX_TEMPLATE); // copy
|
|
50
|
+
p.writeUInt16BE(height & 0xffff, OFF_HEIGHT);
|
|
51
|
+
p.writeUInt16BE(width & 0xffff, OFF_WIDTH);
|
|
52
|
+
p[OFF_Y_SAMPLING] = Y_SAMPLING[subsampling];
|
|
53
|
+
return p;
|
|
54
|
+
}
|
|
55
|
+
/** Extract the binary ciphertext from a `v2_eufysecurity:SN:PKT:<binary>` blob. */
|
|
56
|
+
function v2Ciphertext(data) {
|
|
57
|
+
if (data.subarray(0, exports.V2_PREFIX.length).toString("latin1") !== exports.V2_PREFIX)
|
|
58
|
+
return null;
|
|
59
|
+
// Split on the first three colons only — the 4th field is raw binary that may contain 0x3a.
|
|
60
|
+
let colon = 0;
|
|
61
|
+
let idx = 0;
|
|
62
|
+
for (let i = 0; i < data.length && colon < 3; i++) {
|
|
63
|
+
if (data[i] === 0x3a) {
|
|
64
|
+
colon++;
|
|
65
|
+
idx = i + 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return colon === 3 ? data.subarray(idx) : null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Reconstruct a viewable JPEG from a v2 blob at a *known* geometry.
|
|
72
|
+
* Returns null if the input is not a v2 blob or has no plaintext tail.
|
|
73
|
+
*/
|
|
74
|
+
function spliceV2Image(data, width, height, subsampling = "4:2:0") {
|
|
75
|
+
const ct = v2Ciphertext(data) ?? (data.indexOf(DC_CHROMA) >= 0 ? data : null);
|
|
76
|
+
if (!ct)
|
|
77
|
+
return null;
|
|
78
|
+
const cut = ct.indexOf(DC_CHROMA);
|
|
79
|
+
if (cut < 0)
|
|
80
|
+
return null;
|
|
81
|
+
return Buffer.concat([buildJpegPrefix(width, height, subsampling), ct.subarray(cut)]);
|
|
82
|
+
}
|
|
83
|
+
/** 16:9 then 4:3 size ladder, small→large, used for geometry auto-detection. */
|
|
84
|
+
const SIZE_LADDER = [
|
|
85
|
+
[160, 90],
|
|
86
|
+
[240, 135],
|
|
87
|
+
[256, 144],
|
|
88
|
+
[320, 180],
|
|
89
|
+
[384, 216],
|
|
90
|
+
[400, 225],
|
|
91
|
+
[480, 270],
|
|
92
|
+
[512, 288],
|
|
93
|
+
[576, 324],
|
|
94
|
+
[640, 360],
|
|
95
|
+
[704, 396],
|
|
96
|
+
[768, 432],
|
|
97
|
+
[848, 480],
|
|
98
|
+
[960, 540],
|
|
99
|
+
[1024, 576],
|
|
100
|
+
[1280, 720],
|
|
101
|
+
[1600, 900],
|
|
102
|
+
[1920, 1080],
|
|
103
|
+
[2560, 1440],
|
|
104
|
+
[176, 144],
|
|
105
|
+
[320, 240],
|
|
106
|
+
[352, 288],
|
|
107
|
+
[480, 360],
|
|
108
|
+
[640, 480],
|
|
109
|
+
[800, 600],
|
|
110
|
+
[1024, 768],
|
|
111
|
+
[1280, 960],
|
|
112
|
+
];
|
|
113
|
+
const SUBSAMPLINGS = ["4:2:0", "4:4:4", "4:2:2"];
|
|
114
|
+
/**
|
|
115
|
+
* Decode a v2 blob WITHOUT knowing its dimensions, by brute-forcing the size
|
|
116
|
+
* ladder and using `jpeg-js` (an optional, pure-JS, dynamically-imported
|
|
117
|
+
* dependency) to find the geometry where the entropy-coded scan exactly fills
|
|
118
|
+
* the frame (no premature-EOI fill) with the correct chroma subsampling.
|
|
119
|
+
*
|
|
120
|
+
* The fastest production path is to pass the dimensions from event metadata to
|
|
121
|
+
* {@link spliceV2Image} directly and skip this brute-force entirely.
|
|
122
|
+
*
|
|
123
|
+
* @returns the reconstructed JPEG + detected geometry, or null if undetectable
|
|
124
|
+
* / `jpeg-js` is not installed.
|
|
125
|
+
*/
|
|
126
|
+
async function decodeV2ImageAuto(data) {
|
|
127
|
+
let jpegDecode;
|
|
128
|
+
try {
|
|
129
|
+
// Indirect the specifier so TS/bundlers treat jpeg-js as a truly optional
|
|
130
|
+
// runtime dependency (no static module-resolution / type requirement).
|
|
131
|
+
const specifier = "jpeg-js";
|
|
132
|
+
const mod = await import(specifier);
|
|
133
|
+
jpegDecode = (mod.decode ?? mod.default?.decode).bind(mod);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return null; // jpeg-js not available — caller should pass explicit dimensions
|
|
137
|
+
}
|
|
138
|
+
const ct = v2Ciphertext(data) ?? (data.indexOf(DC_CHROMA) >= 0 ? data : null);
|
|
139
|
+
if (!ct)
|
|
140
|
+
return null;
|
|
141
|
+
const cut = ct.indexOf(DC_CHROMA);
|
|
142
|
+
if (cut < 0)
|
|
143
|
+
return null;
|
|
144
|
+
const tail = ct.subarray(cut);
|
|
145
|
+
let best = null;
|
|
146
|
+
for (const subsampling of SUBSAMPLINGS) {
|
|
147
|
+
let filled = null;
|
|
148
|
+
for (const [w, h] of SIZE_LADDER) {
|
|
149
|
+
const jpeg = Buffer.concat([buildJpegPrefix(w, h, subsampling), tail]);
|
|
150
|
+
let img;
|
|
151
|
+
try {
|
|
152
|
+
img = jpegDecode(jpeg, { maxResolutionInMP: 100, maxMemoryUsageInMB: 512, tolerantDecoding: true });
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
// "Filled" = the bottom 3% of rows carry real variation (not the grey
|
|
158
|
+
// 0x80 premature-EOI fill). The LARGEST fully-filled frame is the
|
|
159
|
+
// correct geometry for this subsampling (a smaller frame also fills,
|
|
160
|
+
// just ignoring trailing scan data — so keep the max-area candidate,
|
|
161
|
+
// not merely the last one seen).
|
|
162
|
+
if (rowsAreFilled(img) && (!filled || w * h > filled.width * filled.height)) {
|
|
163
|
+
filled = { jpeg, width: w, height: h, img };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (!filled)
|
|
167
|
+
continue;
|
|
168
|
+
// A wrong chroma-subsampling guess misreads the chroma planes and produces
|
|
169
|
+
// saturated colour speckle, so the natural decode is the one with the
|
|
170
|
+
// lowest mean colour-spread |R-G|+|G-B|+|B-R|. (Outdoor scenes are nearly
|
|
171
|
+
// grey/brown ⇒ low spread; garbage ⇒ high.)
|
|
172
|
+
const spread = colorSpread(filled.img);
|
|
173
|
+
if (!best || spread < best.spread) {
|
|
174
|
+
best = { jpeg: filled.jpeg, width: filled.width, height: filled.height, subsampling, spread };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!best)
|
|
178
|
+
return null;
|
|
179
|
+
// The SIZE_LADDER only holds standard resolutions, but eufy images often use
|
|
180
|
+
// NON-standard dimensions — so the ladder lands on the nearest standard size and
|
|
181
|
+
// is wrong in two ways that need different fixes:
|
|
182
|
+
//
|
|
183
|
+
// • WIDTH (large snapshots, e.g. 1272 vs 1280): an off-by-a-few-pixels width
|
|
184
|
+
// shears every row. We find the true width by minimising row-to-row difference
|
|
185
|
+
// (shear raises it). This metric is reliable for large/smooth images but too
|
|
186
|
+
// noisy for small detailed thumbnails, so width-refinement is gated to >384px.
|
|
187
|
+
//
|
|
188
|
+
// • HEIGHT (any size, e.g. 256×192 snapped to 256×144): the ladder height can be
|
|
189
|
+
// SHORTER than the real image, cutting off the bottom (the ladder frame still
|
|
190
|
+
// "fills" because its last row is mid-image). We always re-pin the height to
|
|
191
|
+
// where the scan actually ends — this is safe for everything (a true 256×144
|
|
192
|
+
// thumbnail's scan ends at 144, so it stays 144).
|
|
193
|
+
{
|
|
194
|
+
const ss = best.subsampling;
|
|
195
|
+
const [mcw, mch] = MCU_SIZE[ss];
|
|
196
|
+
const decodeAt = (w, h) => {
|
|
197
|
+
try {
|
|
198
|
+
return jpegDecode(Buffer.concat([buildJpegPrefix(w, h, ss), tail]), {
|
|
199
|
+
maxResolutionInMP: 400,
|
|
200
|
+
maxMemoryUsageInMB: 1024,
|
|
201
|
+
tolerantDecoding: true,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
// --- width refinement (all images) ---
|
|
209
|
+
// eufy uses NON-standard widths (288, 552, 1272…) that aren't on the ladder,
|
|
210
|
+
// so the ladder lands on the nearest standard width (256, 576, 1280) and the
|
|
211
|
+
// error shears the image ("the content runs diagonally down"). The true width
|
|
212
|
+
// minimises row-to-row difference. The ladder can be off by ~12% (256 vs the
|
|
213
|
+
// true 288), so search a generous ±25% band around it. The per-image vdiff
|
|
214
|
+
// MINIMUM is reliable even for small detailed thumbnails (absolute vdiff is
|
|
215
|
+
// not comparable across images, but the minimum within one image's sweep is).
|
|
216
|
+
const area = best.width * best.height;
|
|
217
|
+
let width = best.width;
|
|
218
|
+
let bestV = Infinity;
|
|
219
|
+
const lo = Math.max(mcw * 4, Math.round((best.width * 0.75) / mcw) * mcw);
|
|
220
|
+
const hi = Math.round((best.width * 1.25) / mcw) * mcw;
|
|
221
|
+
for (let w = lo; w <= hi; w += mcw) {
|
|
222
|
+
const h = Math.min(2000, Math.max(mch * 2, Math.round(area / w / mch) * mch));
|
|
223
|
+
const img = decodeAt(w, h);
|
|
224
|
+
if (!img)
|
|
225
|
+
continue;
|
|
226
|
+
const fh = contentBottomRow(img);
|
|
227
|
+
if (fh < mch * 2)
|
|
228
|
+
continue;
|
|
229
|
+
const v = verticalRowDiff(img, fh);
|
|
230
|
+
if (v < bestV) {
|
|
231
|
+
bestV = v;
|
|
232
|
+
width = w;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// --- height refinement (always) ---
|
|
236
|
+
// At the correct width, a frame TALLER than the real image hits the embedded
|
|
237
|
+
// EOI and the decode throws ("unexpected ffd9"); a frame ≤ the real height
|
|
238
|
+
// decodes fine. So the true height is the largest non-throwing height —
|
|
239
|
+
// binary-search it. (Some images instead pad the extra rows without throwing;
|
|
240
|
+
// for those the search hits the cap and we trim to the content bottom below.)
|
|
241
|
+
const HCAP = Math.ceil(2000 / mch);
|
|
242
|
+
let loH = 1;
|
|
243
|
+
let hiH = HCAP;
|
|
244
|
+
let maxHm = 1;
|
|
245
|
+
while (loH <= hiH) {
|
|
246
|
+
const mid = (loH + hiH) >> 1;
|
|
247
|
+
if (decodeAt(width, mid * mch)) {
|
|
248
|
+
maxHm = mid;
|
|
249
|
+
loH = mid + 1;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
hiH = mid - 1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
let height = maxHm * mch;
|
|
256
|
+
if (maxHm >= HCAP) {
|
|
257
|
+
// Decoder padded instead of throwing — trim to the real content bottom.
|
|
258
|
+
const fin = decodeAt(width, height);
|
|
259
|
+
if (fin) {
|
|
260
|
+
const fh = contentBottomRow(fin);
|
|
261
|
+
if (fh > mch)
|
|
262
|
+
height = Math.ceil((fh + 1) / mch) * mch;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (width !== best.width || height !== best.height) {
|
|
266
|
+
best = {
|
|
267
|
+
jpeg: Buffer.concat([buildJpegPrefix(width, height, ss), tail]),
|
|
268
|
+
width,
|
|
269
|
+
height,
|
|
270
|
+
subsampling: ss,
|
|
271
|
+
spread: best.spread,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// A high colour-spread even on the best candidate means none of the geometries
|
|
276
|
+
// produced a clean image (atypical/low-light/corrupt blob) — surface that so
|
|
277
|
+
// callers can choose to skip rather than show garbage.
|
|
278
|
+
const lowConfidence = best.spread > 70;
|
|
279
|
+
return {
|
|
280
|
+
jpeg: best.jpeg,
|
|
281
|
+
width: best.width,
|
|
282
|
+
height: best.height,
|
|
283
|
+
subsampling: best.subsampling,
|
|
284
|
+
lowConfidence,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** Luma MCU block dimensions per chroma-subsampling mode (used for width/height refinement). */
|
|
288
|
+
const MCU_SIZE = {
|
|
289
|
+
"4:2:0": [16, 16],
|
|
290
|
+
"4:2:2": [16, 8],
|
|
291
|
+
"4:4:4": [8, 8],
|
|
292
|
+
};
|
|
293
|
+
/** Index of the lowest row that still carries real content (not the grey ~0x80
|
|
294
|
+
* premature-EOI fill). Used to pin the true image height. */
|
|
295
|
+
function contentBottomRow(img) {
|
|
296
|
+
const { width, height, data } = img;
|
|
297
|
+
for (let y = height - 1; y >= 0; y--) {
|
|
298
|
+
let cnt = 0;
|
|
299
|
+
for (let x = 0; x < width; x++)
|
|
300
|
+
if (Math.abs(data[(y * width + x) * 4] - 128) > 6)
|
|
301
|
+
cnt++;
|
|
302
|
+
if (cnt > width * 0.04)
|
|
303
|
+
return y;
|
|
304
|
+
}
|
|
305
|
+
return -1;
|
|
306
|
+
}
|
|
307
|
+
/** Mean vertical (row-to-row) luma difference over the filled region. A correct
|
|
308
|
+
* width keeps rows aligned (low); a wrong width shears each row (high). */
|
|
309
|
+
function verticalRowDiff(img, fh) {
|
|
310
|
+
const { width, data } = img;
|
|
311
|
+
let sum = 0;
|
|
312
|
+
let n = 0;
|
|
313
|
+
for (let y = 0; y < fh - 1; y++) {
|
|
314
|
+
for (let x = 0; x < width; x += 2) {
|
|
315
|
+
sum += Math.abs(data[(y * width + x) * 4] - data[((y + 1) * width + x) * 4]);
|
|
316
|
+
n++;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return n ? sum / n : 1e9;
|
|
320
|
+
}
|
|
321
|
+
function rowsAreFilled(img) {
|
|
322
|
+
const { width, height, data } = img; // RGBA
|
|
323
|
+
if (height < 4)
|
|
324
|
+
return false;
|
|
325
|
+
const startRow = Math.floor(height * 0.97);
|
|
326
|
+
let nonFill = 0;
|
|
327
|
+
let samples = 0;
|
|
328
|
+
for (let y = startRow; y < height; y++) {
|
|
329
|
+
let min = 255;
|
|
330
|
+
let max = 0;
|
|
331
|
+
for (let x = 0; x < width; x++) {
|
|
332
|
+
const v = data[(y * width + x) * 4]; // R channel
|
|
333
|
+
if (v < min)
|
|
334
|
+
min = v;
|
|
335
|
+
if (v > max)
|
|
336
|
+
max = v;
|
|
337
|
+
samples++;
|
|
338
|
+
}
|
|
339
|
+
if (max - min > 8)
|
|
340
|
+
nonFill++;
|
|
341
|
+
}
|
|
342
|
+
return samples > 0 && nonFill > 0;
|
|
343
|
+
}
|
|
344
|
+
/** Mean per-pixel colour spread |R-G|+|G-B|+|B-R|. Natural (near-grey) scenes are
|
|
345
|
+
* low; a wrong chroma-subsampling guess yields saturated speckle and a high value. */
|
|
346
|
+
function colorSpread(img) {
|
|
347
|
+
const { width, height, data } = img;
|
|
348
|
+
const total = width * height || 1;
|
|
349
|
+
let sum = 0;
|
|
350
|
+
for (let p = 0; p < total; p += 2) {
|
|
351
|
+
const i = p * 4;
|
|
352
|
+
const r = data[i];
|
|
353
|
+
const g = data[i + 1];
|
|
354
|
+
const b = data[i + 2];
|
|
355
|
+
sum += Math.abs(r - g) + Math.abs(g - b) + Math.abs(b - r);
|
|
356
|
+
}
|
|
357
|
+
return sum / Math.ceil(total / 2);
|
|
358
|
+
}
|
|
359
|
+
//# sourceMappingURL=decodeImageV2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeImageV2.js","sourceRoot":"","sources":["../../src/http/decodeImageV2.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AA6BH,0CAMC;AAqBD,sCAWC;AA8CD,8CAoKC;AAnRD;8CAC8C;AAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEjD,QAAA,SAAS,GAAG,kBAAkB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,C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GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
package/build/http/device.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
45
45
|
static isStation(type: number): boolean;
|
|
46
46
|
static isCamera1(type: number): boolean;
|
|
47
47
|
static isCameraE(type: number): boolean;
|
|
48
|
+
static isIndoorCameraBase(type: number): boolean;
|
|
48
49
|
static isSensor(type: number): boolean;
|
|
49
50
|
static isEntryE20(type: number): boolean;
|
|
50
51
|
static isKeyPad(type: number): boolean;
|
|
@@ -59,6 +60,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
59
60
|
static isFloodLight(type: number): boolean;
|
|
60
61
|
static isFloodLightT8420X(type: number, serialnumber: string): boolean;
|
|
61
62
|
static isFloodLightT8423(type: number): boolean;
|
|
63
|
+
static isFloodLightT8424(type: number): boolean;
|
|
62
64
|
static isFloodLightT8425(type: number): boolean;
|
|
63
65
|
static isFloodLightT8426(type: number): boolean;
|
|
64
66
|
static isWallLightCam(type: number): boolean;
|
|
@@ -70,6 +72,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
70
72
|
static isLockWifiNoFinger(type: number): boolean;
|
|
71
73
|
static isLockWifiT8531(type: number): boolean;
|
|
72
74
|
static isLockWifiT85D0(type: number): boolean;
|
|
75
|
+
static isLockWifiT85P0(type: number): boolean;
|
|
73
76
|
static isLockWifiR10(type: number): boolean;
|
|
74
77
|
static isLockWifiR20(type: number): boolean;
|
|
75
78
|
static isLockWifiVideo(type: number): boolean;
|
|
@@ -79,7 +82,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
79
82
|
static isLockWifiT8502(type: number): boolean;
|
|
80
83
|
static isLockWifiT8510P(type: number, serialnumber: string): boolean;
|
|
81
84
|
static isLockWifiT8520P(type: number, serialnumber: string): boolean;
|
|
82
|
-
static isLockWifiT85V0(type: number
|
|
85
|
+
static isLockWifiT85V0(type: number): boolean;
|
|
83
86
|
static isLockWifiT85L0(type: number): boolean;
|
|
84
87
|
static isBatteryDoorbell1(type: number): boolean;
|
|
85
88
|
static isBatteryDoorbell2(type: number): boolean;
|
|
@@ -97,6 +100,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
97
100
|
static isSoloCameraSolar(type: number): boolean;
|
|
98
101
|
static isSoloCameraC210(type: number): boolean;
|
|
99
102
|
static isCameraC35(type: number): boolean;
|
|
103
|
+
static isIndoorPTCameraE30(type: number): boolean;
|
|
100
104
|
static isSoloCameraE30(type: number): boolean;
|
|
101
105
|
static isSoloCamE42(type: number): boolean;
|
|
102
106
|
static isSoloCameras(type: number): boolean;
|
|
@@ -137,10 +141,14 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
137
141
|
static isSmartTrackCard(type: number): boolean;
|
|
138
142
|
static isSmartTrackLink(type: number): boolean;
|
|
139
143
|
static isSmartTrack(type: number): boolean;
|
|
144
|
+
static isCameraPoE(type: number): boolean;
|
|
145
|
+
static isNVR(type: number): boolean;
|
|
140
146
|
isCamera(): boolean;
|
|
147
|
+
isIndoorCameraBase(): boolean;
|
|
141
148
|
isFloodLight(): boolean;
|
|
142
149
|
isFloodLightT8420X(): boolean;
|
|
143
150
|
isFloodLightT8423(): boolean;
|
|
151
|
+
isFloodLightT8424(): boolean;
|
|
144
152
|
isFloodLightT8425(): boolean;
|
|
145
153
|
isWallLightCam(): boolean;
|
|
146
154
|
isDoorbell(): boolean;
|
|
@@ -165,6 +173,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
165
173
|
isLockWifiT8531(): boolean;
|
|
166
174
|
isLockWifiT85V0(): boolean;
|
|
167
175
|
isLockWifiT85L0(): boolean;
|
|
176
|
+
isLockWifiT85P0(): boolean;
|
|
168
177
|
isBatteryDoorbell1(): boolean;
|
|
169
178
|
isBatteryDoorbell2(): boolean;
|
|
170
179
|
isBatteryDoorbellDual(): boolean;
|
|
@@ -181,6 +190,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
181
190
|
isSoloCameraSolar(): boolean;
|
|
182
191
|
isSoloCameraC210(): boolean;
|
|
183
192
|
isCameraC35(): boolean;
|
|
193
|
+
isIndoorPTCameraE30(): boolean;
|
|
184
194
|
isSoloCameraE30(): boolean;
|
|
185
195
|
isSoloCamE42(): boolean;
|
|
186
196
|
isStarlight4GLTE(): boolean;
|
|
@@ -217,6 +227,8 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
217
227
|
isSmartTrack(): boolean;
|
|
218
228
|
isSmartTrackCard(): boolean;
|
|
219
229
|
isSmartTrackLink(): boolean;
|
|
230
|
+
isCameraPoE(): boolean;
|
|
231
|
+
isNVR(): boolean;
|
|
220
232
|
hasBattery(): boolean;
|
|
221
233
|
getDeviceKey(): string;
|
|
222
234
|
getDeviceType(): number;
|