diff --git a/pbrr/settings.py b/pbrr/settings.py index 27bed48..7ebbd4e 100644 --- a/pbrr/settings.py +++ b/pbrr/settings.py @@ -5,6 +5,9 @@ from pbrr.log import Log +# For development, debugging, etc. +SET_LAST_FETCH_MARK = False + SETTINGS_FILENAME = "settings.json" KEY_LAST_FETCH = "last_fetch" # domains to skip (e.g. can't fetch right now via pbrr). to be manually added editing the settings json @@ -30,7 +33,7 @@ def load(self) -> None: data = json.load(file_handle) last_fetch = data.get(KEY_LAST_FETCH, None) - if last_fetch: + if last_fetch and SET_LAST_FETCH_MARK: self.last_fetch_mark = datetime.utcfromtimestamp(last_fetch) Log.info("> Previous fetch mark was: {}".format(self.last_fetch_mark)) @@ -49,7 +52,7 @@ def save(self) -> None: Log.error_and_exit("Output path '{}' not found".format(self.base_output_path)) data = { - KEY_LAST_FETCH: fetch_mark.timestamp(), + KEY_LAST_FETCH: fetch_mark.timestamp() if SET_LAST_FETCH_MARK else None, KEY_SKIP_URLS: self.skip_urls, KEY_EMOJI_ICONS: self.category_icons, KEY_SKIP_FILTERS: self.skip_filters, @@ -58,4 +61,7 @@ def save(self) -> None: with open(file_path, "w") as file_handle: json.dump(data, file_handle, indent=None) - Log.info("> Fetch mark set to: {}".format(fetch_mark)) + if SET_LAST_FETCH_MARK: + Log.info("> Fetch mark set to: {}".format(fetch_mark)) + else: + Log.info("> Fetch mark skipped") diff --git a/pbrr/templates/js/pbrr.js b/pbrr/templates/js/pbrr.js index b8ded1b..9e4e8b1 100644 --- a/pbrr/templates/js/pbrr.js +++ b/pbrr/templates/js/pbrr.js @@ -48,7 +48,9 @@ feedNode[0].dataset.currentEntries.length > 0 ? feedNode[0].dataset.currentEntries.split(",") : []; const currentReadEntries = readFeedData(feedNode[0].id); - if (currentEntries.length === 0 || currentReadEntries.size >= currentEntries.length) { + // No data returned from server, or no new entries + if (currentEntries.length === 0 + || currentEntries.filter(entry => !currentReadEntries.has(entry)).length === 0) { spanNode.hide(); } else { parentDivNode.collapse("show"); @@ -77,7 +79,7 @@ } } - if (currentReadEntries.size >= entries.length) { + if (entries.filter(entry => !currentReadEntries.has(entry)).length === 0) { document.getElementById(feedId) .getElementsByClassName("last-update-date")[0] .classList