homebridge-ring 12.0.0-beta.2 → 12.0.0-beta.4
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 +22 -0
- package/lib/camera-source.js +16 -2
- package/lib/camera.js +2 -2
- package/lib/homebridge-ui/public/homebridge-ring-ui.js +138 -0
- package/lib/homebridge-ui/public/index.html +22 -1
- package/package.json +4 -5
- package/lib/homebridge-ui/public/asset-manifest.json +0 -10
- package/lib/homebridge-ui/public/static/js/main.e1f36307.js +0 -3
- package/lib/homebridge-ui/public/static/js/main.e1f36307.js.LICENSE.txt +0 -41
- package/lib/homebridge-ui/public/static/js/main.e1f36307.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# homebridge-ring
|
|
2
2
|
|
|
3
|
+
## 12.0.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1299](https://github.com/dgreif/ring/pull/1299) [`d6a5414`](https://github.com/dgreif/ring/commit/d6a54146370450240d4efcb3f0343227f899c719) Thanks [@tsightler](https://github.com/tsightler)! - Improve 2-way audio quality in homebridge
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- ring-client-api@12.0.0-beta.4
|
|
11
|
+
|
|
12
|
+
## 12.0.0-beta.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`bac6b96`](https://github.com/dgreif/ring/commit/bac6b96e1d6b5f115d6c1f67735fd122e32e7311) Thanks [@dgreif](https://github.com/dgreif)! - Wait 30 seconds (instead of 5 seconds) before fetching remote camera status after light is toggled in HomeKit. This may help with issues where camera lights appear to toggle back to old state shortly after turning them on/off.
|
|
17
|
+
|
|
18
|
+
- [`7d198b8`](https://github.com/dgreif/ring/commit/7d198b87ce03531fb75276eac2d89e2af2be4c23) Thanks [@dgreif](https://github.com/dgreif)! - Temporary fix for 2-way audio. This pins werift to an older version while we look into bug fixes. Thanks to @tsightler for debugging and pursuing a real fix!
|
|
19
|
+
|
|
20
|
+
- [`7b9fbec`](https://github.com/dgreif/ring/commit/7b9fbec0950b72f310cecd93a052800e6b7efe36) Thanks [@dgreif](https://github.com/dgreif)! - Switched from a React-based UI to a simple JS UI for the homebridge-ring plugin UI. This should reduce the package size and simplify development. No visual changes should be noticiable in the UI.
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`d54168d`](https://github.com/dgreif/ring/commit/d54168dac5f0aa06b50ef805eca98785cb513f83)]:
|
|
23
|
+
- ring-client-api@12.0.0-beta.3
|
|
24
|
+
|
|
3
25
|
## 12.0.0-beta.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/lib/camera-source.js
CHANGED
|
@@ -177,7 +177,9 @@ class StreamingSessionWrapper {
|
|
|
177
177
|
'-frame_duration',
|
|
178
178
|
request.audio.packet_time,
|
|
179
179
|
'-application',
|
|
180
|
-
'
|
|
180
|
+
'voip',
|
|
181
|
+
'-vbr',
|
|
182
|
+
'off',
|
|
181
183
|
]
|
|
182
184
|
: [
|
|
183
185
|
// AAC-eld specific
|
|
@@ -240,7 +242,19 @@ class StreamingSessionWrapper {
|
|
|
240
242
|
outputArgs: [
|
|
241
243
|
'-acodec',
|
|
242
244
|
...(isRingUsingOpus
|
|
243
|
-
? [
|
|
245
|
+
? [
|
|
246
|
+
'libopus',
|
|
247
|
+
'-ac',
|
|
248
|
+
1,
|
|
249
|
+
'-ar',
|
|
250
|
+
'24k',
|
|
251
|
+
'-vbr',
|
|
252
|
+
'off',
|
|
253
|
+
'-b:a',
|
|
254
|
+
'24k',
|
|
255
|
+
'-application',
|
|
256
|
+
'voip',
|
|
257
|
+
]
|
|
244
258
|
: ['pcm_mulaw', '-ac', 1, '-ar', '8k']),
|
|
245
259
|
'-flags',
|
|
246
260
|
'+global_header',
|
package/lib/camera.js
CHANGED
|
@@ -78,8 +78,8 @@ class Camera extends base_data_accessory_1.BaseDataAccessory {
|
|
|
78
78
|
return value;
|
|
79
79
|
},
|
|
80
80
|
setValue: (value) => {
|
|
81
|
-
// Allow
|
|
82
|
-
lightTargetTimer.setTarget(value,
|
|
81
|
+
// Allow 30 seconds for the light value to update in our status updates from Ring
|
|
82
|
+
lightTargetTimer.setTarget(value, 30000);
|
|
83
83
|
return device.setLight(value);
|
|
84
84
|
},
|
|
85
85
|
requestUpdate: () => device.requestUpdate(),
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { homebridge } = window;
|
|
3
|
+
const newTokenButton = document.getElementById('ring-new-token');
|
|
4
|
+
const linkAccountHeader = document.getElementById('ring-link-account-header');
|
|
5
|
+
if (!newTokenButton) {
|
|
6
|
+
homebridge.toast.error('no ring-new-token element found!');
|
|
7
|
+
throw new Error('no ring-new-token element found!');
|
|
8
|
+
}
|
|
9
|
+
if (!linkAccountHeader) {
|
|
10
|
+
homebridge.toast.error('no ring-link-account-header element found!');
|
|
11
|
+
throw new Error('no ring-link-account-header element found!');
|
|
12
|
+
}
|
|
13
|
+
newTokenButton.addEventListener('click', () => {
|
|
14
|
+
showLoginForm();
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Render the correct form, based on whether we have an existing refresh token
|
|
18
|
+
*/
|
|
19
|
+
async function renderForm() {
|
|
20
|
+
const [config] = await homebridge.getPluginConfig();
|
|
21
|
+
const needToken = !config?.refreshToken;
|
|
22
|
+
homebridge.hideSpinner();
|
|
23
|
+
if (needToken) {
|
|
24
|
+
showLoginForm();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
showStandardForm();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
renderForm();
|
|
31
|
+
async function setRefreshToken(refreshToken) {
|
|
32
|
+
const [config, ...otherConfigs] = await homebridge.getPluginConfig();
|
|
33
|
+
await homebridge.updatePluginConfig([
|
|
34
|
+
{ ...config, refreshToken },
|
|
35
|
+
...otherConfigs,
|
|
36
|
+
]);
|
|
37
|
+
homebridge.toast.success('Refresh Token Updated', 'Ring Login Successful');
|
|
38
|
+
showStandardForm();
|
|
39
|
+
}
|
|
40
|
+
function showStandardForm() {
|
|
41
|
+
newTokenButton?.style.setProperty('display', 'block');
|
|
42
|
+
linkAccountHeader?.style.setProperty('display', 'none');
|
|
43
|
+
homebridge.showSchemaForm();
|
|
44
|
+
}
|
|
45
|
+
function showLoginForm() {
|
|
46
|
+
// Hide the standard form
|
|
47
|
+
newTokenButton?.style.setProperty('display', 'none');
|
|
48
|
+
linkAccountHeader?.style.setProperty('display', 'block');
|
|
49
|
+
homebridge.hideSchemaForm();
|
|
50
|
+
// Create a new login form
|
|
51
|
+
const form = homebridge.createForm({
|
|
52
|
+
schema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
email: {
|
|
56
|
+
title: 'Email',
|
|
57
|
+
type: 'string',
|
|
58
|
+
'x-schema-form': {
|
|
59
|
+
type: 'email',
|
|
60
|
+
},
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
password: {
|
|
64
|
+
title: 'Password',
|
|
65
|
+
type: 'string',
|
|
66
|
+
'x-schema-form': {
|
|
67
|
+
type: 'password',
|
|
68
|
+
},
|
|
69
|
+
required: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}, {}, 'Log In');
|
|
74
|
+
form.onSubmit(async ({ email, password }) => {
|
|
75
|
+
homebridge.showSpinner();
|
|
76
|
+
try {
|
|
77
|
+
const response = (await homebridge.request('/send-code', {
|
|
78
|
+
email,
|
|
79
|
+
password,
|
|
80
|
+
}));
|
|
81
|
+
if ('refreshToken' in response) {
|
|
82
|
+
// didn't need 2fa, return token without asking for code
|
|
83
|
+
setRefreshToken(response.refreshToken);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// Need a token, so show the token form
|
|
87
|
+
showTokenForm({
|
|
88
|
+
email,
|
|
89
|
+
password,
|
|
90
|
+
codePrompt: response.codePrompt,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
// eslint-disable-next-line no-console
|
|
96
|
+
console.error(e);
|
|
97
|
+
homebridge.toast.error(e.message, 'Ring Login Failed');
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
homebridge.hideSpinner();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function showTokenForm(loginInfo) {
|
|
105
|
+
const form = homebridge.createForm({
|
|
106
|
+
schema: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
code: {
|
|
110
|
+
title: 'Code',
|
|
111
|
+
type: 'string',
|
|
112
|
+
required: true,
|
|
113
|
+
description: loginInfo.codePrompt,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}, {}, 'Link Account', 'Change Email');
|
|
118
|
+
form.onSubmit(async ({ code }) => {
|
|
119
|
+
homebridge.showSpinner();
|
|
120
|
+
try {
|
|
121
|
+
const { refreshToken } = await homebridge.request('/token', {
|
|
122
|
+
email: loginInfo.email,
|
|
123
|
+
password: loginInfo.password,
|
|
124
|
+
code,
|
|
125
|
+
});
|
|
126
|
+
setRefreshToken(refreshToken);
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
// eslint-disable-next-line no-console
|
|
130
|
+
console.error(e);
|
|
131
|
+
homebridge.toast.error(e.message, 'Failed to Link Account');
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
homebridge.hideSpinner();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
form.onCancel(() => showLoginForm());
|
|
138
|
+
}
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
<
|
|
1
|
+
<button id="ring-new-token" class="btn btn-link m-0 p-0" style="display: none;">
|
|
2
|
+
<i class="fa fa-redo mr-2"></i>
|
|
3
|
+
Generate New Refresh Token
|
|
4
|
+
</button>
|
|
5
|
+
|
|
6
|
+
<h4 id="ring-link-account-header" class="text-center primary-text mb-3" style="display: none;">
|
|
7
|
+
Link Ring Account
|
|
8
|
+
</h4>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
// Show the spinner while the JS is loading
|
|
12
|
+
homebridge.showSpinner()
|
|
13
|
+
|
|
14
|
+
// Create a script tag to load the JS onto the page
|
|
15
|
+
const script = document.createElement('script')
|
|
16
|
+
|
|
17
|
+
// Use the installed version of homebridge to bust the cache for the script
|
|
18
|
+
script.src = `homebridge-ring-ui.js?v=${homebridge.plugin.installedVersion}`
|
|
19
|
+
|
|
20
|
+
// Append the script to the head of the page to load it
|
|
21
|
+
document.head.appendChild(script)
|
|
22
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-ring",
|
|
3
|
-
"version": "12.0.0-beta.
|
|
3
|
+
"version": "12.0.0-beta.4",
|
|
4
4
|
"description": "Homebridge plugin for Ring doorbells, cameras, security alarm system and smart lighting",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "rm -rf lib && tsc && cp
|
|
7
|
+
"build": "rm -rf lib && tsc && cp ./homebridge-ui/public/index.html ./lib/homebridge-ui/public/",
|
|
8
8
|
"lint": "eslint . --ext .ts && tsc --noEmit",
|
|
9
9
|
"dev": "concurrently -c yellow,blue --kill-others \"npm:dev:build\" \"npm:dev:run\" ",
|
|
10
10
|
"dev:build": "tsc --watch --preserveWatchOutput",
|
|
@@ -12,15 +12,14 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@homebridge/camera-utils": "^2.2.0",
|
|
15
|
-
"@homebridge/plugin-ui-utils": "^0.0
|
|
16
|
-
"ring-client-api": "12.0.0-beta.
|
|
15
|
+
"@homebridge/plugin-ui-utils": "^0.1.0",
|
|
16
|
+
"ring-client-api": "12.0.0-beta.4",
|
|
17
17
|
"werift": "0.18.5"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"concurrently": "^8.2.0",
|
|
21
21
|
"eslint-config-shared": "*",
|
|
22
22
|
"homebridge": "1.6.1",
|
|
23
|
-
"homebridge-ui": "*",
|
|
24
23
|
"nodemon": "^3.0.1",
|
|
25
24
|
"tsconfig": "*",
|
|
26
25
|
"typescript": "5.1.6"
|