diff --git a/bin/background_indexer.py b/bin/background_indexer.py index 6343a3a3..3f1ce91b 100755 --- a/bin/background_indexer.py +++ b/bin/background_indexer.py @@ -54,8 +54,6 @@ class BackgroundIndexer(AbstractManager): self.logger.debug(f'{uuid_path.parent} is locked, pickle generated by another process.') continue - got_new_captures = True - max_captures -= 1 with uuid_path.open() as f: uuid = f.read() @@ -80,6 +78,8 @@ class BackgroundIndexer(AbstractManager): self.lookyloo.get_crawled_tree(uuid) self.lookyloo.trigger_modules(uuid, auto_trigger=True) self.logger.info(f'Pickle for {uuid} build.') + got_new_captures = True + max_captures -= 1 except MissingUUID: self.logger.warning(f'Unable to find {uuid}. That should not happen.') except NoValidHarFile as e: diff --git a/lookyloo/capturecache.py b/lookyloo/capturecache.py index 85d6282b..caf8e0a1 100644 --- a/lookyloo/capturecache.py +++ b/lookyloo/capturecache.py @@ -74,20 +74,13 @@ class CaptureCache(): if cache_entry.get('title') is not None: self.title: str = cache_entry['title'] - else: - # This shouldn't happen, but if it does, we need the key to exist. - self.logger.warning(f'Title missing in cache for {self.uuid}.') - self.title = '' + if cache_entry.get('timestamp'): try: self.timestamp: datetime = datetime.strptime(cache_entry['timestamp'], '%Y-%m-%dT%H:%M:%S.%f%z') except ValueError: # If the microsecond is missing (0), it fails self.timestamp = datetime.strptime(cache_entry['timestamp'], '%Y-%m-%dT%H:%M:%S%z') - else: - # This shouldn't happen, but if it does, we need the key to exist. - self.logger.warning(f'Timestamp missing in cache for {self.uuid}.') - self.timestamp = datetime.fromtimestamp(0) self.redirects: List[str] = json.loads(cache_entry['redirects']) if cache_entry.get('redirects') else [] diff --git a/website/web/__init__.py b/website/web/__init__.py index 29091a85..20b90a05 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -774,7 +774,7 @@ def tree(tree_uuid: str, node_uuid: Optional[str]=None): return render_template('tree.html', tree_json=ct.to_json(), info=cache, tree_uuid=tree_uuid, public_domain=lookyloo.public_domain, - screenshot_thumbnail=b64_thumbnail, page_title=cache.title, + screenshot_thumbnail=b64_thumbnail, page_title=cache.title if hasattr(cache, 'title') else '', screenshot_size=screenshot_size, meta=meta, enable_mail_notification=enable_mail_notification, enable_monitoring=lookyloo.monitoring_enabled,