From 288272a26c9dcb428eb4be7557ee5dc97b161730 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 14 Jul 2025 18:36:42 +0200 Subject: [PATCH] Better merge/update of new application values --- changedetectionio/store.py | 16 ++++++++-------- requirements.txt | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 020b2999..09d9f7d1 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -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(): diff --git a/requirements.txt b/requirements.txt index 01e5fecd..890e19ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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