homebridge-roborock-vacuum 2.2.1 → 2.2.2
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,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.2.2
|
|
4
|
+
|
|
5
|
+
- **Fix (config UI)**: 2FA verification and login no longer fail with the generic "The Homebridge UI did not respond in time" message on slow connections (#58). Cloud-backed actions (login, 2FA, device list) now get a 60-second budget in the UI instead of 15 seconds — 2FA verify and password login each make two sequential Roborock cloud requests, which could legitimately exceed the old limit. Each underlying cloud request is also capped at 20 seconds, so a genuinely unreachable Roborock server now surfaces the real network error instead of the generic timeout
|
|
6
|
+
|
|
3
7
|
## 2.2.1
|
|
4
8
|
|
|
5
9
|
Maintenance release — no functional changes to device control. Reworks the four code patterns flagged by the Homebridge verification security scan so the automated checks come back clean:
|
|
@@ -106,6 +106,20 @@ function showToast(type, message) {
|
|
|
106
106
|
// leave the page hanging forever.
|
|
107
107
|
const REQUEST_TIMEOUT_MS = 15000;
|
|
108
108
|
|
|
109
|
+
// Endpoints that round-trip to the Roborock cloud need a bigger budget:
|
|
110
|
+
// 2FA verify and password login each make two sequential cloud requests,
|
|
111
|
+
// which can legitimately exceed 15s on a slow route. Each underlying
|
|
112
|
+
// request is capped at 20s (axios timeout in roborockAuth/roborockHome),
|
|
113
|
+
// so the server always answers — with a real error if the cloud hangs —
|
|
114
|
+
// before this deadline fires.
|
|
115
|
+
const CLOUD_REQUEST_TIMEOUT_MS = 60000;
|
|
116
|
+
const CLOUD_PATHS = [
|
|
117
|
+
"/auth/login",
|
|
118
|
+
"/auth/send-2fa-email",
|
|
119
|
+
"/auth/verify-2fa-code",
|
|
120
|
+
"/devices/list",
|
|
121
|
+
];
|
|
122
|
+
|
|
109
123
|
function withTimeout(promise, ms, fallback) {
|
|
110
124
|
return Promise.race([
|
|
111
125
|
promise,
|
|
@@ -116,10 +130,13 @@ function withTimeout(promise, ms, fallback) {
|
|
|
116
130
|
}
|
|
117
131
|
|
|
118
132
|
async function request(path, body) {
|
|
133
|
+
const timeoutMs = CLOUD_PATHS.includes(path)
|
|
134
|
+
? CLOUD_REQUEST_TIMEOUT_MS
|
|
135
|
+
: REQUEST_TIMEOUT_MS;
|
|
119
136
|
try {
|
|
120
137
|
return await withTimeout(
|
|
121
138
|
window.homebridge.request(path, body),
|
|
122
|
-
|
|
139
|
+
timeoutMs,
|
|
123
140
|
{
|
|
124
141
|
ok: false,
|
|
125
142
|
message:
|
package/package.json
CHANGED
|
@@ -51,6 +51,9 @@ function encryptPassword(password, k) {
|
|
|
51
51
|
function createLoginApi({ baseURL, username, clientID, language }) {
|
|
52
52
|
return axios.create({
|
|
53
53
|
baseURL: `https://${normalizeBaseURL(baseURL)}`,
|
|
54
|
+
// Fail with a real error instead of hanging: the config UI budgets 60s
|
|
55
|
+
// per action, and login/2FA-verify chain two requests through this client.
|
|
56
|
+
timeout: 20000,
|
|
54
57
|
headers: {
|
|
55
58
|
header_clientid: crypto.createHash("md5").update(username).update(clientID).digest().toString("base64"),
|
|
56
59
|
header_clientlang: language || DEFAULT_HEADERS.header_clientlang,
|
|
@@ -12,7 +12,7 @@ function md5hex(str) {
|
|
|
12
12
|
// credentials, mirroring the signing the main plugin uses for the Roborock
|
|
13
13
|
// "real" API (see roborockAPI.js initUser).
|
|
14
14
|
function createSignedApi(rriot) {
|
|
15
|
-
const api = axios.create({ baseURL: rriot.r.a });
|
|
15
|
+
const api = axios.create({ baseURL: rriot.r.a, timeout: 20000 });
|
|
16
16
|
api.interceptors.request.use((config) => {
|
|
17
17
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
18
18
|
const nonce = crypto
|