@lumiastream/tapo-cove 3.1.0 → 3.2.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
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.2.0](https://github.com/lumiastream/rgb/compare/v3.1.0...v3.2.0) (2023-03-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - tapo bypass cookie ([39f5dec](https://github.com/lumiastream/rgb/commit/39f5dec51c403d7b99f662b75f4c32a76546e56a))
11
+
12
+ ### Features
13
+
14
+ - tapo timoeut in 3 seconds ([6d7bf1b](https://github.com/lumiastream/rgb/commit/6d7bf1b81a89ddb867677bff0b6f816547239981))
15
+
6
16
  # [3.1.0](https://github.com/lumiastream/rgb/compare/v3.0.15...v3.1.0) (2023-03-21)
7
17
 
8
18
  ### Bug Fixes
package/dist/index.js CHANGED
@@ -163,7 +163,7 @@ var throwErrorIfFound = (responseData) => {
163
163
  }
164
164
  };
165
165
  var handshake = (deviceIp) => __async(void 0, null, function* () {
166
- var _a, _b;
166
+ var _a, _b, _c, _d;
167
167
  const keyPair = yield generateKeyPair();
168
168
  const handshakeRequest = {
169
169
  method: "handshake",
@@ -174,12 +174,15 @@ var handshake = (deviceIp) => __async(void 0, null, function* () {
174
174
  const response = yield (globalThis.nodeAxios ? globalThis.nodeAxios : import_axios.default)({
175
175
  method: "post",
176
176
  url: `http://${deviceIp}/app`,
177
- data: handshakeRequest
177
+ data: handshakeRequest,
178
+ timeout: 3e3
178
179
  });
179
180
  throwErrorIfFound(response.data);
180
181
  let setCookieHeader;
181
182
  if (response.headers["set-cookie"]) {
182
183
  setCookieHeader = (_b = (_a = response.headers["set-cookie"]) == null ? void 0 : _a[0]) != null ? _b : response.headers["set-cookie"];
184
+ } else if (response.headers["bypass-cookie"]) {
185
+ setCookieHeader = (_d = (_c = response.headers["bypass-cookie"]) == null ? void 0 : _c[0]) != null ? _d : response.headers["bypass-cookie"];
183
186
  } else {
184
187
  setCookieHeader = response.headers.get("set-cookie");
185
188
  }
@@ -204,6 +207,7 @@ var securePassthrough = (deviceRequest, deviceKey) => __async(void 0, null, func
204
207
  method: "post",
205
208
  url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
206
209
  data: securePassthroughRequest,
210
+ timeout: 3e3,
207
211
  headers: {
208
212
  Cookie: deviceKey.sessionCookie
209
213
  }
@@ -413,7 +417,8 @@ var TapoApi = class {
413
417
  method: "POST",
414
418
  body: securePassthroughRequest,
415
419
  headers: {
416
- Cookie: deviceKey.sessionCookie
420
+ Cookie: deviceKey.sessionCookie,
421
+ BypassCookie: deviceKey.sessionCookie
417
422
  }
418
423
  },
419
424
  shouldWait
package/dist/index.mjs CHANGED
@@ -131,7 +131,7 @@ var throwErrorIfFound = (responseData) => {
131
131
  }
132
132
  };
133
133
  var handshake = (deviceIp) => __async(void 0, null, function* () {
134
- var _a, _b;
134
+ var _a, _b, _c, _d;
135
135
  const keyPair = yield generateKeyPair();
136
136
  const handshakeRequest = {
137
137
  method: "handshake",
@@ -142,12 +142,15 @@ var handshake = (deviceIp) => __async(void 0, null, function* () {
142
142
  const response = yield (globalThis.nodeAxios ? globalThis.nodeAxios : axios)({
143
143
  method: "post",
144
144
  url: `http://${deviceIp}/app`,
145
- data: handshakeRequest
145
+ data: handshakeRequest,
146
+ timeout: 3e3
146
147
  });
147
148
  throwErrorIfFound(response.data);
148
149
  let setCookieHeader;
149
150
  if (response.headers["set-cookie"]) {
150
151
  setCookieHeader = (_b = (_a = response.headers["set-cookie"]) == null ? void 0 : _a[0]) != null ? _b : response.headers["set-cookie"];
152
+ } else if (response.headers["bypass-cookie"]) {
153
+ setCookieHeader = (_d = (_c = response.headers["bypass-cookie"]) == null ? void 0 : _c[0]) != null ? _d : response.headers["bypass-cookie"];
151
154
  } else {
152
155
  setCookieHeader = response.headers.get("set-cookie");
153
156
  }
@@ -172,6 +175,7 @@ var securePassthrough = (deviceRequest, deviceKey) => __async(void 0, null, func
172
175
  method: "post",
173
176
  url: `http://${deviceKey.deviceIp}/app?token=${deviceKey.token}`,
174
177
  data: securePassthroughRequest,
178
+ timeout: 3e3,
175
179
  headers: {
176
180
  Cookie: deviceKey.sessionCookie
177
181
  }
@@ -381,7 +385,8 @@ var TapoApi = class {
381
385
  method: "POST",
382
386
  body: securePassthroughRequest,
383
387
  headers: {
384
- Cookie: deviceKey.sessionCookie
388
+ Cookie: deviceKey.sessionCookie,
389
+ BypassCookie: deviceKey.sessionCookie
385
390
  }
386
391
  },
387
392
  shouldWait
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/tapo-cove",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "private": false,
5
5
  "license": "GPL",
6
6
  "main": "dist/index.js",
@@ -23,5 +23,5 @@
23
23
  "tsup": "*",
24
24
  "typescript": "*"
25
25
  },
26
- "gitHead": "a92d37d1e70b976c06f10ad8f18d0c7aaa325e02"
26
+ "gitHead": "3e77873d8c27d7844a456486f304c451dd814b22"
27
27
  }