From da7291caedfecc7646acdfb824127de9e6031577 Mon Sep 17 00:00:00 2001 From: Peoples0815 Date: Wed, 11 Jul 2018 22:07:10 +0200 Subject: [PATCH] Version 0.1.8 --- README.md | 8 ++++++++ admin/index_m.html | 36 +++++++++++++++++++++++++++--------- io-package.json | 15 +++++++++++++-- main.js | 38 ++++++++++++++++++++++++++++---------- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 78 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index e604fef6..a7cb81ca 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,14 @@ Einige Benutzer berichteten dass das IoBroker komplett-Backup nicht richtig durc ## Changelog +### 0.1.8 (11.07.2018) + * (darkiop) MySQL-Sicherung um Host- und Portabfrage erweitert + * (peoples) Versendende Telegram-Instanz wählbar + * (peoples) Telegram-Nachrichten angepasst an Verbindungstyp + * (peoples) History-Log angepasst an Verbindungstyp + * (simatec) Komprimierung der MySQL-Datenbank-Sicherung eingebaut + * (simatec) Anpassung der Konfigoberfläche an Telegram-Instanz Auswahl + ### 0.1.7 (05.07.2018) * (peoples) Datenpunkte in io-package definiert diff --git a/admin/index_m.html b/admin/index_m.html index 83d9ef04..af57ef93 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -50,8 +50,27 @@ showHideSettings(); onChange(false); M.updateTextFields(); // function Materialize.updateTextFields(); to reinitialize all the Materialize labels on the page if you are dynamically adding inputs. - } - + + + getAdapterInstances('telegram', function (arr) { + instances = arr; + fillInstances('Telegram_instanz', arr, settings['Telegram_instanz']); + }); + + + } + function fillInstances(id, arr, val) { + var $sel = $('#' + id); + $sel.html(''); + var _id; + for (var i = 0; i < arr.length; i++) { + var _id = arr[i]._id.replace('system.adapter.', ''); + // Take first value +// if (!val) val = _id; + $sel.append(''); + } + $sel.select(); + } // ... and the function save has to exist. // you have to make sure the callback is called with the settings object as first param! function save(callback) { @@ -150,13 +169,12 @@ - -
-
- - - Telegram Instanz -
+
+
+ + +
+
diff --git a/io-package.json b/io-package.json index 623f24cb..f486c888 100644 --- a/io-package.json +++ b/io-package.json @@ -1,9 +1,20 @@ { "common": { "name": "backitup", - "version": "0.1.7", + "version": "0.1.8", "news": { - "0.1.7": { + "0.1.8": { + "en": "Changes to history log, MySQL, telegram", + "de": "Änderungen an History-Log, MySQL, Telegram", + "ru": "Изменения в журнал истории, MySQL, телеграмма", + "pt": "Mudanças no histórico, MySQL, telegrama", + "nl": "Wijzigingen in historielogboek, MySQL, telegram", + "fr": "Changements au journal d'historique, MySQL, télégramme", + "it": "Modifiche al registro cronologia, MySQL, telegramma", + "es": "Cambios en el registro de historial, MySQL, telegrama", + "pl": "Zmiany w logach historii, MySQL, telegram" + }, + "0.1.7": { "en": "Data points defined in io-package", "de": "Datenpunkte in io-package definiert", "ru": "Точки данных, определенные в io-пакете", diff --git a/main.js b/main.js index 5ea8f3b4..a160cd00 100644 --- a/main.js +++ b/main.js @@ -229,20 +229,30 @@ function BackupStellen() { // # Funktion zum Ausführen des Backups mit obigen Einstellungen # // # # // ############################################################################# - - function backup_erstellen(typ, name, zeit, host, pfad, user, passwd, ccuip, ccuusr, ccupw, cifsmnt, bkpiors, redisst, mysqldb, mysqlusr, mysqlpw, mysqlln, mysqlhost, mysqlport) { if(debugging) adapter.log.info(bash_script+'"'+typ+'|'+name+'|'+zeit+'|'+host+'|'+pfad+'|'+user+'|'+passwd+'|'+ccuip+'|'+ccuusr+'|'+ccupw+'|'+cifsmnt+'|'+bkpiors+'|'+redisst+'|'+mysqldb+'|'+mysqlusr+'|'+mysqlpw+'|'+mysqlln+'|'+mysqlhost+'|'+mysqlport+'"'); -// Telegram - if(adapter.config.telegram_message === true){ + // Telegram Message versenden + if(debugging){ + if(adapter.config.Telegram_instanz !== ''){ + adapter.log.info('Gewaehlte Telegram-Instanz: ' + adapter.config.Telegram_instanz); + } + else{ + adapter.log.info('Keine Telegram-Instanz gewaehlt!'); + } + } + + if(adapter.config.telegram_message === true && adapter.config.Telegram_instanz !== ''){ adapter.log.info('Telegram Message ist aktiv'); let messagetext = 'Es wurde am '+HistoryEintrag(new Date())+' ein neues '+typ+' Backup erstellt'; - if(host !== '') messagetext += ', und nach '+host+pfad+' kopiert/verschoben'; + if(host !== ''){ + if(cifsmnt == 'FTP') messagetext += ', und via FTP nach '+host+pfad+' kopiert/verschoben'; + if(cifsmnt == 'CIFS') messagetext += ', und unter '+host+pfad+' gespeichert'; + } messagetext += '!'; - adapter.sendTo("telegram", "send", {text: 'BackItUp:\n' + messagetext}); + adapter.sendTo(adapter.config.Telegram_instanz, "send", {text: 'BackItUp:\n' + messagetext}); // adapter.sendTo("telegram", "send", {text: (String('BackItUp:\n' + messagetext))}); } @@ -250,8 +260,8 @@ function backup_erstellen(typ, name, zeit, host, pfad, user, passwd, ccuip, ccuu adapter.setState('History.letztes_'+typ+'_Backup', HistoryEintrag(new Date())); let ftp_bkp_u; - if(cifsmnt === 'FTP') ftp_bkp_u = 'FTP'; else ftp_bkp_u = 'CIFS'; - new Backup_history_anlegen(typ, ftp_bkp_u); + + new Backup_history_anlegen(typ, host, cifsmnt); exec((bash_script+' "'+typ+'|'+name+'|'+zeit+'|'+host+'|'+pfad+'|'+user+'|'+passwd+'|'+ccuip+'|'+ccuusr+'|'+ccupw+'|'+cifsmnt+'|'+bkpiors+'|'+redisst+'|'+mysqldb+'|'+mysqlusr+'|'+mysqlpw+'|'+mysqlln+'|'+mysqlhost+'|'+mysqlport+'"'), function(err, stdout, stderr) { if(logging){ @@ -292,7 +302,7 @@ function HistoryEintrag(date) { // # # // ############################################################################# -function Backup_history_anlegen(typ, ftp_bkp_u) { +function Backup_history_anlegen(typ, host, cifsmnt) { adapter.getState('History.Backup_history', function (err, state) { let history_liste = state.val; if(history_liste == 'Noch keine Backups erstellt') history_liste = ''; @@ -301,7 +311,15 @@ function Backup_history_anlegen(typ, ftp_bkp_u) { history_array.splice((anzahl_eintraege_history - 1),1); } let zeitstempel = HistoryEintrag(new Date()); - history_array.unshift('' + zeitstempel + ' - Typ:' +typ+ ' - NAS-Sicherung: ' +ftp_bkp_u+ ''); + let historytext; + if(host !== ''){ + if(cifsmnt == 'FTP') historytext = '' + zeitstempel + ' - Typ:' +typ+ ' - FTP-Sicherung: JA'; + if(cifsmnt == 'CIFS') historytext = '' + zeitstempel + ' - Typ:' +typ+ ' - CIFS-Mount: JA'; + } + else{ + historytext = '' + zeitstempel + ' - Typ:' +typ+ ' - Nur lokal gesichert'; + } + history_array.unshift(historytext); adapter.setState('History.Backup_history', history_array.join(' ')); }); diff --git a/package-lock.json b/package-lock.json index 39a38eb0..1042f8a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.backitup", - "version": "0.1.7", + "version": "0.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a7e032b5..7e964052 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.backitup", - "version": "0.1.7", + "version": "0.1.8", "engines": { "node": ">=6.0.0" },