@apocaliss92/scrypted-reolink-native 0.4.1 → 0.4.3

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.
@@ -1,9 +1,118 @@
1
+ /*!
2
+ * Copyright (c) 2014, GMO GlobalSign
3
+ * Copyright (c) 2015-2022, Peculiar Ventures
4
+ * All rights reserved.
5
+ *
6
+ * Author 2014-2019, Yury Strozhevsky
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without modification,
9
+ * are permitted provided that the following conditions are met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright notice, this
12
+ * list of conditions and the following disclaimer.
13
+ *
14
+ * * Redistributions in binary form must reproduce the above copyright notice, this
15
+ * list of conditions and the following disclaimer in the documentation and/or
16
+ * other materials provided with the distribution.
17
+ *
18
+ * * Neither the name of the copyright holder nor the names of its
19
+ * contributors may be used to endorse or promote products derived from
20
+ * this software without specific prior written permission.
21
+ *
22
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ *
33
+ */
34
+
35
+ /*!
36
+ * MIT License
37
+ *
38
+ * Copyright (c) Peculiar Ventures. All rights reserved.
39
+ *
40
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ * of this software and associated documentation files (the "Software"), to deal
42
+ * in the Software without restriction, including without limitation the rights
43
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ * copies of the Software, and to permit persons to whom the Software is
45
+ * furnished to do so, subject to the following conditions:
46
+ *
47
+ * The above copyright notice and this permission notice shall be included in all
48
+ * copies or substantial portions of the Software.
49
+ *
50
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ * SOFTWARE.
57
+ *
58
+ */
59
+
60
+ /*!
61
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
62
+ *
63
+ * Copyright (c) 2014-2017, Jon Schlinkert.
64
+ * Released under the MIT License.
65
+ */
66
+
67
+ /*!
68
+ * isobject <https://github.com/jonschlinkert/isobject>
69
+ *
70
+ * Copyright (c) 2014-2017, Jon Schlinkert.
71
+ * Released under the MIT License.
72
+ */
73
+
74
+ /*! *****************************************************************************
75
+ Copyright (C) Microsoft. All rights reserved.
76
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
77
+ this file except in compliance with the License. You may obtain a copy of the
78
+ License at http://www.apache.org/licenses/LICENSE-2.0
79
+
80
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
81
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
82
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
83
+ MERCHANTABLITY OR NON-INFRINGEMENT.
84
+
85
+ See the Apache Version 2.0 License for specific language governing permissions
86
+ and limitations under the License.
87
+ ***************************************************************************** */
88
+
89
+ /*! *****************************************************************************
90
+ Copyright (c) Microsoft Corporation.
91
+
92
+ Permission to use, copy, modify, and/or distribute this software for any
93
+ purpose with or without fee is hereby granted.
94
+
95
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
96
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
97
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
98
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
99
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
100
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
101
+ PERFORMANCE OF THIS SOFTWARE.
102
+ ***************************************************************************** */
103
+
104
+ /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
105
+
1
106
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
2
107
 
3
108
  /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
4
109
 
5
110
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
6
111
 
112
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
113
+
114
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
115
+
7
116
  /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
8
117
 
9
118
  /**
package/dist/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apocaliss92/scrypted-reolink-native",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Use any reolink camera with Scrypted, even older/unsupported models without HTTP protocol support",
5
5
  "author": "@apocaliss92",
6
6
  "license": "Apache",
package/src/camera.ts CHANGED
@@ -2446,6 +2446,14 @@ export class ReolinkCamera
2446
2446
  const pirNativeId = `${this.nativeId}${pirSuffix}`;
2447
2447
  const autotrackingNativeId = `${this.nativeId}${autotrackingSuffix}`;
2448
2448
 
2449
+ // Helper to safely remove a device only if it exists
2450
+ const safeRemoveDevice = (nativeId: string) => {
2451
+ const existingIds = sdk.deviceManager.getNativeIds();
2452
+ if (existingIds.includes(nativeId)) {
2453
+ sdk.deviceManager.onDeviceRemoved(nativeId);
2454
+ }
2455
+ };
2456
+
2449
2457
  // Create motion-siren device (motion detection alarm)
2450
2458
  if (hasSiren) {
2451
2459
  const device: Device = {
@@ -2461,7 +2469,7 @@ export class ReolinkCamera
2461
2469
  sdk.deviceManager.onDeviceDiscovered(device);
2462
2470
  } else {
2463
2471
  // Remove motion-siren device if capability is no longer available
2464
- sdk.deviceManager.onDeviceRemoved(motionSirenNativeId);
2472
+ safeRemoveDevice(motionSirenNativeId);
2465
2473
  this.motionSiren = undefined;
2466
2474
  }
2467
2475
 
@@ -2480,7 +2488,7 @@ export class ReolinkCamera
2480
2488
  sdk.deviceManager.onDeviceDiscovered(device);
2481
2489
  } else {
2482
2490
  // Remove siren device if capability is no longer available
2483
- sdk.deviceManager.onDeviceRemoved(sirenNativeId);
2491
+ safeRemoveDevice(sirenNativeId);
2484
2492
  this.siren = undefined;
2485
2493
  }
2486
2494
 
@@ -2503,7 +2511,7 @@ export class ReolinkCamera
2503
2511
  sdk.deviceManager.onDeviceDiscovered(device);
2504
2512
  } else {
2505
2513
  // Remove motion-floodlight device if capability is no longer available
2506
- sdk.deviceManager.onDeviceRemoved(motionFloodlightNativeId);
2514
+ safeRemoveDevice(motionFloodlightNativeId);
2507
2515
  this.motionFloodlight = undefined;
2508
2516
  }
2509
2517
 
@@ -2526,7 +2534,7 @@ export class ReolinkCamera
2526
2534
  sdk.deviceManager.onDeviceDiscovered(device);
2527
2535
  } else {
2528
2536
  // Remove floodlight device if capability is no longer available
2529
- sdk.deviceManager.onDeviceRemoved(floodlightNativeId);
2537
+ safeRemoveDevice(floodlightNativeId);
2530
2538
  this.floodlight = undefined;
2531
2539
  }
2532
2540
 
@@ -2544,7 +2552,7 @@ export class ReolinkCamera
2544
2552
  sdk.deviceManager.onDeviceDiscovered(device);
2545
2553
  } else {
2546
2554
  // Remove PIR device if capability is no longer available
2547
- sdk.deviceManager.onDeviceRemoved(pirNativeId);
2555
+ safeRemoveDevice(pirNativeId);
2548
2556
  this.pirSensor = undefined;
2549
2557
  }
2550
2558
 
@@ -2563,7 +2571,7 @@ export class ReolinkCamera
2563
2571
  sdk.deviceManager.onDeviceDiscovered(device);
2564
2572
  } else {
2565
2573
  // Remove autotracking device if capability is no longer available
2566
- sdk.deviceManager.onDeviceRemoved(autotrackingNativeId);
2574
+ safeRemoveDevice(autotrackingNativeId);
2567
2575
  this.autotracking = undefined;
2568
2576
  }
2569
2577
  }