From 7a1ec187a7e3d83fdd2817034e0b47ab6856ee67 Mon Sep 17 00:00:00 2001 From: DewGew Date: Fri, 26 Jan 2024 12:38:12 +0100 Subject: [PATCH 01/14] Update routes.py For security reason smart-home-key.json upload destination has change to config folder --- modules/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/routes.py b/modules/routes.py index 874e10c..2ed809a 100644 --- a/modules/routes.py +++ b/modules/routes.py @@ -313,7 +313,10 @@ def uploader(): logger.warning("Uploadfile is not allowed") flash("Uploadfile is not allowed, '.jpg','.png' files or 'smart-home-key.json' is allowed!") else: - f.save(os.path.join(config.UPLOAD_DIRECTORY, secure_filename(f.filename))) + if f.filename == 'smart-home-key.json': + f.save(os.path.join(config.KEYFILE_DIRECTORY, secure_filename(f.filename))) + else: + f.save(os.path.join(config.UPLOAD_DIRECTORY, secure_filename(f.filename))) logger.info("Upload success") return redirect(url_for('settings')) From 5c6126c12ae33c3a48ac08600db454f6453c0eee Mon Sep 17 00:00:00 2001 From: DewGew Date: Fri, 26 Jan 2024 12:39:28 +0100 Subject: [PATCH 02/14] Update config.py --- modules/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index 2f3960b..cd5431b 100644 --- a/modules/config.py +++ b/modules/config.py @@ -1,5 +1,5 @@ DEVICES_DIRECTORY = "config" -KEYFILE_DIRECTORY = "uploads" +KEYFILE_DIRECTORY = "config" CONFIG_DIRECTORY = "config" UPLOAD_DIRECTORY = "uploads" DATABASE_DIRECTORY = "instance" From f35d2abad2eaec309522318e14ea3fe38dceb71a Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 08:18:37 +0100 Subject: [PATCH 03/14] Update VERSION.md --- VERSION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.md b/VERSION.md index 0dad123..9dc0ade 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -24.1 +24.2 From 3186e34479eef30291b117f7ee38380668b3d3a0 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 09:36:43 +0100 Subject: [PATCH 04/14] Update VERSION.md --- VERSION.md | 1 + 1 file changed, 1 insertion(+) diff --git a/VERSION.md b/VERSION.md index 9dc0ade..4630016 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1,2 @@ 24.2 +Security changes. Move .json file from uploads to to config folder. Move .json file to config or upload a new json file. From 8504252910104dc7b0a21f9f1033b12a00fa469a Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 09:44:18 +0100 Subject: [PATCH 05/14] Update VERSION.md --- VERSION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.md b/VERSION.md index 4630016..e9fe8ea 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,2 +1,2 @@ 24.2 -Security changes. Move .json file from uploads to to config folder. Move .json file to config or upload a new json file. +Security changes. - Move '.json' file from uploads to to config folder. Move '.json' file to config or upload a new json file. From 9dde1e986c9e4a992c08072a15f4370d9de469ed Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 12:11:42 +0100 Subject: [PATCH 06/14] Add DoorLockInverted --- modules/domoticz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/domoticz.py b/modules/domoticz.py index 2f3cdaa..172992b 100644 --- a/modules/domoticz.py +++ b/modules/domoticz.py @@ -168,7 +168,7 @@ def getAog(device, user_id=None): aog.customData['idx'] = device.get('idx') aog.customData['domain'] = domain aog.customData['protected'] = device.get('Protected') - aog.notificationSupportedByAgent = (True if domain in ['SmokeDetector', 'Doorbell', 'DoorLock'] else False) + aog.notificationSupportedByAgent = (True if domain in ['SmokeDetector', 'Doorbell', 'DoorLock', 'DoorLockInverted'] else False) if domain == 'Scene': aog.type = 'action.devices.types.SCENE' @@ -220,7 +220,7 @@ def getAog(device, user_id=None): aog.traits.append('action.devices.traits.OnOff') if domain == 'Dimmer': aog.traits.append('action.devices.traits.Brightness') - if domain == 'DoorLock': + if domain in ['DoorLock', 'DoorLockInverted']: aog.type = 'action.devices.types.LOCK' aog.traits.append('action.devices.traits.LockUnlock') From 974a331054bf14b1feb9516b78660490d49e2062 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 12:18:29 +0100 Subject: [PATCH 07/14] Add DoorLockInverted --- templates/dashboard.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/dashboard.html b/templates/dashboard.html index 227663e..f865fb3 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -159,7 +159,7 @@
Device log | {{ v['name']['name'] }}
- {% elif v['customData']['domain'] == 'DoorLock' %} + {% elif v['customData']['domain'] in ('DoorLock', 'DoorLockInverted') %}
lock @@ -673,7 +673,7 @@
Other devices unknown_2 @@ -760,7 +760,7 @@
Hidden devices Date: Mon, 29 Jan 2024 12:19:09 +0100 Subject: [PATCH 08/14] Add DoorLockInverted --- static/js/smarthome.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/js/smarthome.js b/static/js/smarthome.js index e996916..4973388 100644 --- a/static/js/smarthome.js +++ b/static/js/smarthome.js @@ -109,6 +109,7 @@ function refreshSwitches(updateSwitches) { } if (data == 'Unlocked'){ $('#icon_DoorLock_' + idx).html("lock_open").css('color','#008000') + $('#icon_DoorLockInverted_' + idx).html("lock_open").css('color','#008000') } if (data == 'Off'){ $('#icon_OnOff_' + idx).removeAttr('style') @@ -122,6 +123,7 @@ function refreshSwitches(updateSwitches) { } if (data == 'Locked'){ $('#icon_DoorLock_' + idx).html("lock").css('color','#ED2939') + $('#icon_DoorLockInverted_' + idx).html("lock").css('color','#ED2939') } if (data == 'Normal'){ $('#icon_security_' + idx).removeAttr('style') From c69878f1974777586a8195ef438ad5f9236e8a11 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 13:26:22 +0100 Subject: [PATCH 09/14] Update version handler --- templates/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/footer.html b/templates/footer.html index 52f1e6a..7f4d2fe 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -38,7 +38,7 @@ From 328440b54159cb9dfe3b588c4e556cc4d16b1e16 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 13:27:52 +0100 Subject: [PATCH 10/14] Update info.html --- templates/info.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/templates/info.html b/templates/info.html index 5396320..dbd43d7 100644 --- a/templates/info.html +++ b/templates/info.html @@ -15,6 +15,16 @@

+

Latest Updates

+

+ {% for x in version %} + {% if x != version[0] %} + {{ x }}
+ {% endif %} + {% endfor %} +

+

{% if user.googleassistant %}

Home Graph Viewer

@@ -28,8 +38,12 @@

Sync your devices

When you click 'Sync Devices' button to syncronize your domoticz devices {% if user.googleassistant %}with Google Assistant or just tell Google Assistant to "Sync my devices"{% endif %}.

-
-
+
+ + {% if user.admin %} + + {% endif %} +
From 8a91fed6256d259154cee029faee3b1cd3f46723 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 13:28:39 +0100 Subject: [PATCH 11/14] Update version handler --- modules/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/helpers.py b/modules/helpers.py index 80b546d..be8f3af 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -43,9 +43,9 @@ def getVersion(): if os.path.isfile(filename) and os.access(filename, os.R_OK): with open(filename, mode='r') as f: text = f.read() - text = text.split() + text = text.split("\n") - return text[0] + return text else: return None From 5dcfe01d25f4ff3c5c6b1502e3317a56191fbbef Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 14:33:03 +0100 Subject: [PATCH 12/14] Update version handler --- static/js/smarthome.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/smarthome.js b/static/js/smarthome.js index 4973388..91be8b5 100644 --- a/static/js/smarthome.js +++ b/static/js/smarthome.js @@ -373,11 +373,11 @@ function checkVersion() { url: "https://raw.githubusercontent.com/DewGew/DZGA-Flask/development/VERSION.md", cache: false, success: function( data ) { - dataFloat = data.split(",")[0]; + dataFloat = data.split("\n")[0]; var compare = versionCompare(dataFloat, dzga_version); if (compare == 1) { $('#newver').html(" (New version " + dataFloat + " is avalible.)"); - $('#newver_note').html('A new version ' + dataFloat + ' is avalible here'); + $('#newver_note').html('A new version ' + dataFloat + ' is avalible here'); $('#badge').show(); $("#notes").html('You have 1 new notifications'); $("#shownotes" ).show(); From 45860d5ad2e63d532f44e5b996fb603f25c44652 Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 14:34:23 +0100 Subject: [PATCH 13/14] Update VERSION.md --- VERSION.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VERSION.md b/VERSION.md index e9fe8ea..4e0bba2 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,2 +1,4 @@ 24.2 -Security changes. - Move '.json' file from uploads to to config folder. Move '.json' file to config or upload a new json file. +- Security Update. DZGA now reads smart-home-key.json file from config folder. Move .json file or upload a new. +- Added new device, Door Lock Inverted. +- Changed check version, get latest updates. From 5e84a2b05707728fb61fcf396855453874f6763d Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 29 Jan 2024 14:34:46 +0100 Subject: [PATCH 14/14] Update VERSION.md