Better merge/update of new application values

This commit is contained in:
dgtlmoon
2025-07-14 18:36:42 +02:00
parent 5980bd9bcd
commit 288272a26c
2 changed files with 9 additions and 8 deletions
+8 -8
View File
@@ -44,6 +44,8 @@ class ChangeDetectionStore:
def __init__(self, datastore_path="/datastore", include_default_watches=True, version_tag="0.0.0"):
# Should only be active for docker
# logging.basicConfig(filename='/dev/stdout', level=logging.INFO)
from deepmerge import always_merger
self.__data = App.model()
self.datastore_path = datastore_path
self.json_store_path = os.path.join(self.datastore_path, "url-watches.json")
@@ -75,14 +77,12 @@ class ChangeDetectionStore:
self.__data['app_guid'] = from_disk['app_guid']
if 'settings' in from_disk:
if 'headers' in from_disk['settings']:
self.__data['settings']['headers'].update(from_disk['settings']['headers'])
if 'requests' in from_disk['settings']:
self.__data['settings']['requests'].update(from_disk['settings']['requests'])
if 'application' in from_disk['settings']:
self.__data['settings']['application'].update(from_disk['settings']['application'])
# update the modal with whats on disk
on_disk={'yes': '1'}
existing = {'yes': '0', 'more': 'ok'}
p=always_merger.merge(on_disk, existing)
# yes should be 0
self.__data['settings'] = always_merger.merge(from_disk['settings'], self.__data['settings'])
# Convert each existing watch back to the Watch.model object
for uuid, watch in self.__data['watching'].items():
+1
View File
@@ -78,6 +78,7 @@ jq~=1.3; python_version >= "3.8" and sys_platform == "linux"
# playwright is installed at Dockerfile build time because it's not available on all platforms
pyppeteer-ng==2.0.0rc10
deepmerge
pyppeteerstealth>=0.0.4