Skip to content

Commit

Permalink
chore: release v3.0.9
Browse files Browse the repository at this point in the history
* (arteck) corr error message
  • Loading branch information
arteck committed Dec 7, 2023
1 parent 715589d commit 1d2fff0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 47 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ Many thanks to @Acgua (https://github.com/Acgua) for [ioBroker.fully-mqtt](https


## Changelog
### 3.0.9 (2023-12-07)
* (arteck) corr error message

### 3.0.8 (2023-12-05)
* (arteck) toForeground corr
*

### 3.0.7 (2023-11-20)
* (arteck) check credentials
Expand Down
28 changes: 14 additions & 14 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "fullybrowser",
"version": "3.0.8",
"version": "3.0.9",
"news": {
"3.0.9": {
"en": "corr error message",
"de": "korr fehlermeldung",
"ru": "сообщение об ошибке",
"pt": "mensagem de erro corr",
"nl": "vertaling:",
"fr": "corr error message",
"it": "messaggio di errore corr",
"es": "mensaje de error de corr",
"pl": "kor error message",
"uk": "корр повідомлення про помилку",
"zh-cn": "错误信息"
},
"3.0.8": {
"en": "toForeground corr\n",
"de": "toForeground corr\n",
Expand Down Expand Up @@ -80,19 +93,6 @@
"pl": "stworzenie korekty",
"uk": "setStringSettings корр",
"zh-cn": "导 言"
},
"3.0.2": {
"en": "add motionDetection\nfor Rooted Devices add rebootDevice",
"de": "bewegung hinzufügenDetektion\nfür Rooted Devices Neustart hinzufügen",
"ru": "добавить motionDetection\nдля Rooted Devices добавить rebootDevice",
"pt": "adicionar definição de movimento\npara dispositivos enraizados adicionar rebootDevice",
"nl": "vertaling:\nvoor Rooted Devices voegt reboot Device toe",
"fr": "add motionDetection\npour Rooted Devices ajouter rebootDevice",
"it": "aggiungere il movimento\nper Dispositivi Radicati aggiungere rebootDevice",
"es": "añadir movimientoDetección\npara dispositivos rotos añadir reinicioDispositivo",
"pl": "dodać wniosek\nrooted Device dodaje rebootDevice",
"uk": "додати рухуВиявлення\nдля кореневих пристроїв додайте перезавантаження",
"zh-cn": "增 编\n扶轮社"
}
},
"title": "fullyBrowser",
Expand Down
38 changes: 9 additions & 29 deletions lib/restApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class RestApiFully {
}

async axiosSendCmd(device, cmd, urlParam) {
// Base URL
const url = `${device.restProtocol}://${device.ip}:${device.restPort}/?password=${this.encodePassword(device.restPassword)}&${urlParam}`; //&type=json
const url = `${device.restProtocol}://${device.ip}:${device.restPort}/?password=${this.encodePassword(device.restPassword)}&${urlParam}&type=json`;

// Axios config
const config = {
Expand All @@ -73,36 +72,17 @@ class RestApiFully {
this.adapter.log.error(`[REST] ${device.name}: Sending command ${cmd} failed: ${response.status} - ${response.statusText}`);
return false;
}
if (!('status' in response)) {
this.adapter.log.error(`[REST] ${device.name}: Sending command ${cmd} failed: Response received but it does not have key 'status'`);
return false;
}
if (!('data' in response)) {
this.adapter.log.error(`[REST] ${device.name}: Sending command ${cmd} failed: Response received but it does not have key 'data'`);
return false;
}
this.adapter.log.debug(`[REST] ${device.name}: Sending command ${cmd} response.data: ${JSON.stringify(response.data)}`);

if (!('status' in response.data)) {
this.adapter.log.error(`[REST] ${device.name}: Sending command ${cmd} failed: Response received but response.data does not have key 'status'`);
if (response.data.status.includes('Error')) {
if (response.data.statustext == 'Please login') {
this.adapter.log.error(`[REST] ${device.name}: Error: Remote Admin Password seems to be incorrect. Sending command ${cmd} failed.`);
} else {
this.adapter.log.error(`[REST] ${device.name}: Error: Sending command ${cmd} failed, received status text: ${response.data.statustext}`);
}
return false;
}
switch (response.data.status) {
case 'OK':
this.adapter.log.debug(`[REST] ${device.name}: Sending command ${cmd} successful: - Status = "${response.data.status}", Message = "${response.data.statustext}"`);
return true;
case 'Error':
if (response.data.statustext === 'Please login') {
this.adapter.log.error(`[REST] ${device.name}: Error: Remote Admin Password seems to be incorrect. Sending command ${cmd} failed.`);
} else {
this.adapter.log.error(`[REST] ${device.name}: Error: Sending command ${cmd} failed, received status text: ${response.data.statustext}`);
}
return false;
default:
// Unexpected
this.adapter.log.error(`[REST] ${device.name}: Undefined response.data.status = "${response.data.status}" when sending command ${cmd}: ${response.status} - ${response.statusText}`);
return false;
}

return true;
} catch (err) {
this.errorFunction(err,device, cmd);
return false;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.fullybrowser",
"version": "3.0.8",
"version": "3.0.9",
"description": "Manage yours Fully Browser",
"main": "main.js",
"repository": {
Expand Down

0 comments on commit 1d2fff0

Please sign in to comment.