Skip to content

Commit

Permalink
Fixed issue #195
Browse files Browse the repository at this point in the history
Fixed issue #202
  • Loading branch information
bropat committed Dec 5, 2021
1 parent 4ca594e commit c9d4ca5
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 87 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ Best is to set the adapter to Debug log mode (Instances -> Expert mode -> Column

## Changelog

### 0.7.5 (2021-12-05)

* (bropat) Fixed issue #195
* (bropat) Fixed issue #202

### 0.7.4 (2021-11-22)

* (bropat) Implemented captcha authentication mechanism (API v2)
Expand Down
14 changes: 7 additions & 7 deletions build/lib/tools.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/lib/tools.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 35 additions & 13 deletions build/lib/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/lib/utils.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "eufy-security",
"version": "0.7.4",
"version": "0.7.5",
"news": {
"0.7.5": {
"en": "Fixed issue #195 and #202",
"de": "Problem Nr. 195 und Nr. 202 behoben",
"ru": "Исправлена проблема № 195 и № 202.",
"pt": "Correção do problema nº 195 e nº 202",
"nl": "Probleem #195 en #202 opgelost",
"fr": "Problèmes résolus #195 et #202",
"it": "Risolto il problema #195 e #202",
"es": "Problema solucionado #195 y #202",
"pl": "Naprawiono problem #195 i #202",
"zh-cn": "修复了#195和#202问题"
},
"0.7.4": {
"en": "Updated version of the package eufy-security-client (1.4.0)",
"de": "Version des Pakets eufy-security-client (1.4.0) aktualisiert",
Expand Down Expand Up @@ -218,18 +230,6 @@
"es": "Se agregaron nuevas funciones p2p y se aplicaron algunas correcciones de errores",
"pl": "Dodano nowe funkcje p2p i poprawiono kilka błędów",
"zh-cn": "添加了新的p2p功能并应用了一些错误修复"
},
"0.3.1": {
"en": "Fixed regression on livestream with h265 codec",
"de": "Regression im Livestream mit h265-Codec behoben",
"ru": "Исправлена регрессия в прямом эфире с кодеком h265",
"pt": "Regressão corrigida na transmissão ao vivo com codec h265",
"nl": "Vaste regressie op livestream met h265-codec",
"fr": "Correction de la régression sur la diffusion en direct avec le codec h265",
"it": "Risolto il problema con la regressione in live streaming con il codec h265",
"es": "Se corrigió la regresión en la transmisión en vivo con el códec h265",
"pl": "Naprawiono regresję podczas transmisji na żywo z kodekiem h265",
"zh-cn": "使用H265编解码器修复了实时流的回归"
}
},
"title": "Eufy Security",
Expand Down
33 changes: 10 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.eufy-security",
"version": "0.7.4",
"version": "0.7.5",
"description": "ioBroker adapter that integrates Eufy-Security cameras with stations",
"author": {
"name": "bropat",
Expand All @@ -26,11 +26,11 @@
"@bropat/fluent-ffmpeg": "^2.1.3",
"@cospired/i18n-iso-languages": "^3.1.1",
"@iobroker/adapter-core": "^2.5.1",
"axios": "^0.24.0",
"got": "^11.8.3",
"eufy-security-client": "^1.4.0",
"ffmpeg-static": "^4.4.0",
"fs-extra": "^10.0.0",
"i18n-iso-countries": "^7.0.0",
"i18n-iso-countries": "^7.1.0",
"mime": "^3.0.0",
"ts-log": "^2.2.4"
},
Expand All @@ -44,10 +44,10 @@
"@types/gulp": "^4.0.9",
"@types/mime": "^2.0.3",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.9",
"@types/node": "^16.11.11",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.6",
"@types/sinon-chai": "^3.2.5",
"@types/sinon-chai": "^3.2.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"chai": "^4.3.4",
Expand Down
14 changes: 7 additions & 7 deletions src/lib/tools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios";
import got from "got";

/**
* Tests whether the given variable is a real object and not an Array
Expand Down Expand Up @@ -52,9 +52,9 @@ async function translateYandex(text: string, targetLang: string, apiKey: string)
}
try {
const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${apiKey}&text=${encodeURIComponent(text)}&lang=en-${targetLang}`;
const response = await axios({url, timeout: 15000});
if (isArray((response.data as any)?.text)) {
return (response.data as any).text[0];
const response = await got({url, timeout: 15000});
if (isArray((response.body as any)?.text)) {
return (response.body as any).text[0];
}
throw new Error("Invalid response for translate request");
} catch (e) {
Expand All @@ -70,10 +70,10 @@ async function translateYandex(text: string, targetLang: string, apiKey: string)
async function translateGoogle(text: string, targetLang: string): Promise<string> {
try {
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
const response = await axios({url, timeout: 15000});
if (isArray(response.data)) {
const response = await got({url, timeout: 15000});
if (isArray(response.body)) {
// we got a valid response
return response.data[0][0][0];
return response.body[0][0][0];
}
throw new Error("Invalid response for translate request");
} catch (e: any) {
Expand Down
Loading

0 comments on commit c9d4ca5

Please sign in to comment.