homebridge-ring 11.7.6 → 11.8.0-beta.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # homebridge-ring
2
2
 
3
+ ## 11.8.0-beta.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`906225c`](https://github.com/dgreif/ring/commit/906225c4b6e4aecab76fb0d4782b502fee7aca29) Thanks [@dgreif](https://github.com/dgreif)! - Embed hardware id in the refresh token string. This should prevent a second device from being created in Ring Control Center. For this to take effect, please follow the instructions in https://github.com/dgreif/ring/wiki/Notification-Troubleshooting
8
+
9
+ - [`36cdb0b`](https://github.com/dgreif/ring/commit/36cdb0bc21fab6bf24a2772ff9fcbe3d1315bfe2) Thanks [@dgreif](https://github.com/dgreif)! - Embed push notification credentials in the refresh token. This should allow push notifications to work across restarts and continue working past 24 hours in regions with data residency restrictions.
10
+
11
+ - [`96bbf54`](https://github.com/dgreif/ring/commit/96bbf54a7c03a8a14c794a7756af4d270efa30f5) Thanks [@dgreif](https://github.com/dgreif)! - Allow Node.js 20
12
+
13
+ ### Patch Changes
14
+
15
+ - [`da963fd`](https://github.com/dgreif/ring/commit/da963fd69dd294d69da9764869ae4e9886dcccd0) Thanks [@dgreif](https://github.com/dgreif)! - Remove forced session creation on startup. This should fix issues where notifications stop working immediately after a restart.
16
+
17
+ - Updated dependencies [[`da963fd`](https://github.com/dgreif/ring/commit/da963fd69dd294d69da9764869ae4e9886dcccd0), [`906225c`](https://github.com/dgreif/ring/commit/906225c4b6e4aecab76fb0d4782b502fee7aca29), [`36cdb0b`](https://github.com/dgreif/ring/commit/36cdb0bc21fab6bf24a2772ff9fcbe3d1315bfe2), [`96bbf54`](https://github.com/dgreif/ring/commit/96bbf54a7c03a8a14c794a7756af4d270efa30f5)]:
18
+ - ring-client-api@11.8.0-beta.0
19
+
20
+ ## 11.7.7
21
+
22
+ ### Patch Changes
23
+
24
+ - [`f3e66fd`](https://github.com/dgreif/ring/commit/f3e66fdbeb960a9ba35ff26289a054c537bac890) Thanks [@dgreif](https://github.com/dgreif)! - Subscribe to ding/motion events every time the user session is refreshed. This currently happens every 12 hours. This is an attempt to fix motion/ding notifications after restarting, but I am unable to reproduce the issue and verify this change fixes it.
25
+
26
+ - [`b9881a7`](https://github.com/dgreif/ring/commit/b9881a7b5ed6684bf6dc0464354af7acf1cc77ea) Thanks [@dgreif](https://github.com/dgreif)! - Prevent a duplicate device named "Device name not found" from being created when logging into homebridge with the homebridge ui.
27
+
28
+ - Updated dependencies [[`f3e66fd`](https://github.com/dgreif/ring/commit/f3e66fdbeb960a9ba35ff26289a054c537bac890), [`af7f44e`](https://github.com/dgreif/ring/commit/af7f44e5f1f97274a8902063b621bde1e94bd08f)]:
29
+ - ring-client-api@11.7.7
30
+
3
31
  ## 11.7.6
4
32
 
5
33
  ### Patch Changes
package/lib/config.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debug = exports.getSystemId = exports.updateHomebridgeConfig = void 0;
3
+ exports.debug = exports.getSystemId = exports.updateHomebridgeConfig = exports.controlCenterDisplayName = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const crypto_1 = require("crypto");
6
6
  const path_1 = require("path");
7
7
  const systemIdFileName = '.ring.json';
8
+ exports.controlCenterDisplayName = 'homebridge-ring';
8
9
  function updateHomebridgeConfig(homebridge, update) {
9
10
  const configPath = homebridge.user.configPath(), config = (0, fs_1.readFileSync)(configPath).toString(), updatedConfig = update(config);
10
11
  if (config !== updatedConfig) {
@@ -17,8 +18,8 @@ exports.updateHomebridgeConfig = updateHomebridgeConfig;
17
18
  function createSystemId() {
18
19
  return (0, crypto_1.createHash)('sha256').update((0, crypto_1.randomBytes)(32)).digest('hex');
19
20
  }
20
- function getSystemId(homebridge) {
21
- const storagePath = homebridge.user.storagePath(), filePath = (0, path_1.join)(storagePath, systemIdFileName);
21
+ function getSystemId(homebridgeStoragePath) {
22
+ const filePath = (0, path_1.join)(homebridgeStoragePath, systemIdFileName);
22
23
  try {
23
24
  const ringContext = JSON.parse((0, fs_1.readFileSync)(filePath).toString());
24
25
  if (ringContext.systemId) {
@@ -3,12 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /* eslint-disable no-console */
4
4
  const plugin_ui_utils_1 = require("@homebridge/plugin-ui-utils");
5
5
  const rest_client_1 = require("ring-client-api/rest-client");
6
+ const config_1 = require("../config");
6
7
  class PluginUiServer extends plugin_ui_utils_1.HomebridgePluginUiServer {
7
8
  constructor() {
8
9
  super();
9
10
  this.generateCode = async ({ email, password }) => {
10
11
  console.log(`Logging in with email '${email}'`);
11
- this.restClient = new rest_client_1.RingRestClient({ email, password });
12
+ const storagePath = this.homebridgeStoragePath;
13
+ this.restClient = new rest_client_1.RingRestClient({
14
+ email,
15
+ password,
16
+ controlCenterDisplayName: config_1.controlCenterDisplayName,
17
+ systemId: storagePath ? (0, config_1.getSystemId)(storagePath) : undefined,
18
+ });
12
19
  try {
13
20
  const { refresh_token } = await this.restClient.getCurrentAuth();
14
21
  // If we get here, 2fa was not required. I'm not sure this is possible anymore, but it's here just in case
@@ -152,8 +152,8 @@ class RingPlatform {
152
152
  this.homebridgeAccessories[accessory.UUID] = accessory;
153
153
  }
154
154
  async connectToApi() {
155
- const { api, config } = this, systemId = (0, config_1.getSystemId)(api), ringApi = new ring_client_api_1.RingApi({
156
- controlCenterDisplayName: 'homebridge-ring',
155
+ const { api, config } = this, systemId = (0, config_1.getSystemId)(api.user.storagePath()), ringApi = new ring_client_api_1.RingApi({
156
+ controlCenterDisplayName: config_1.controlCenterDisplayName,
157
157
  ...config,
158
158
  systemId,
159
159
  }), locations = await ringApi.getLocations(), cachedAccessoryIds = Object.keys(this.homebridgeAccessories), platformAccessories = [], externalAccessories = [], activeAccessoryIds = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-ring",
3
- "version": "11.7.6",
3
+ "version": "11.8.0-beta.0",
4
4
  "description": "Homebridge plugin for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@homebridge/camera-utils": "^2.2.0",
15
15
  "@homebridge/plugin-ui-utils": "^0.0.19",
16
- "ring-client-api": "11.7.6"
16
+ "ring-client-api": "11.8.0-beta.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "concurrently": "^7.6.0",
@@ -25,7 +25,7 @@
25
25
  "typescript": "5.0.2"
26
26
  },
27
27
  "engines": {
28
- "node": "^16 || ^18",
28
+ "node": "^16 || ^18 || ^20",
29
29
  "homebridge": ">=1.4.0"
30
30
  },
31
31
  "repository": {