Skip to content

Commit

Permalink
Fix error with token
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Apr 24, 2020
1 parent 9b80142 commit 25580ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Sentry.io is a way for developers to get an overview about errors from their app
When the adapter crashes or an other Code error happens, this error message that also appears in the ioBroker log is submitted to our own Sentry server hosted in germany. When you allowed iobroker GmbH to collect diagnostic data then also your installation ID (this is just a unique ID **without** any additional infos about you, email, name or such) is included. This allows Sentry to group errors and show how many unique users are affected by such an error. All of this helps me to provide error free adapters that basically never crashs.

## Changelog
### 2.0.0 (2020-04-24)
### 2.0.1 (2020-04-24)
* (bluefox) Fixed error in the blockly if language was not "ru/en/de"
* (bluefox) Breaking change: the encryption of the password was changed, so the token must be entered anew. Store your token before update.

Expand Down
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"common": {
"name": "pushover",
"version": "2.0.0",
"version": "2.0.1",
"news": {
"2.0.0": {
"2.0.1": {
"en": "Fixed error in the blockly if language was not \"ru/en/de\"\nBreaking change: the encryption of the password was changed, so the token must be entered anew. Store your token before update.\n",
"de": "Fehler im Block behoben, wenn die Sprache nicht \"ru / en / de\" war\nBreaking Change: Die Verschlüsselung des Passworts wurde geändert, daher muss das Token erneut eingegeben werden. Speichern Sie Ihr Token vor dem Update.\n",
"ru": "Исправлена ошибка в блоке, если язык не был \"ru / en / de\"\nСрочная смена: шифрование пароля было изменено, поэтому токен необходимо вводить заново. Сохраните свой токен перед обновлением.\n",
Expand Down
13 changes: 6 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function startAdapter(options) {

adapter.on('ready', () => {
if (!adapter.supportsFeature || !adapter.supportsFeature('ADAPTER_AUTO_DECRYPT_NATIVE')) {
adapter.getEncryptedConfig('enc_token')
adapter.getEncryptedConfig('token')
.then(value => {
adapter.config.enc_token = value;
adapter.config.token = value;
main(adapter);
});
} else {
Expand Down Expand Up @@ -174,9 +174,8 @@ function decrypt(key, value) {
}

function main(adapter) {
adapter.config.enc_token = adapter.config.enc_token || adapter.config.token;
// do nothing. Only answer on messages.
if (!adapter.config.user || !adapter.config.enc_token) {
if (!adapter.config.user || !adapter.config.token) {
adapter.log.error('Cannot send notification while not configured');
}
}
Expand All @@ -189,10 +188,10 @@ function sendNotification(adapter, message, callback) {
message = message || {};

if (!pushover) {
if (adapter.config.user && adapter.config.enc_token) {
if (adapter.config.user && adapter.config.token) {
pushover = new Pushover({
user: adapter.config.user,
token: adapter.config.enc_token,
token: adapter.config.token,
onerror: onError
});
} else {
Expand All @@ -210,7 +209,7 @@ function sendNotification(adapter, message, callback) {
if (message.hasOwnProperty('token')) {
pushover.token = message.token;
} else {
pushover.token = adapter.config.enc_token;
pushover.token = adapter.config.token;
}
message.title = message.title || adapter.config.title;
message.sound = message.sound || (adapter.config.sound ? adapter.config.sound : undefined);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iobroker.pushover",
"description": "This adapter allows to send pushover notifications from ioBroker",
"version": "2.0.0",
"version": "2.0.1",
"author": "bluefox <[email protected]>",
"contributors": [
"bluefox <[email protected]>"
Expand Down

0 comments on commit 25580ac

Please sign in to comment.