From a0cad72aadb07e6d89e8a60826eb0344f7280cec Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 23 Aug 2022 20:35:03 +0100 Subject: [PATCH] Set search banner filename --- daemon.py | 10 ++++++++++ webapp_search.py | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/daemon.py b/daemon.py index 83fe2678e..b5057a7bf 100644 --- a/daemon.py +++ b/daemon.py @@ -17163,6 +17163,16 @@ class PubServer(BaseHTTPRequestHandler): if self.server.key_shortcuts.get(nickname): access_keys = self.server.key_shortcuts[nickname] + banner_filename = \ + acct_dir(base_dir, nickname, self.server.domain) + \ + '/search_banner.png' + if not os.path.isfile(banner_filename): + if os.path.isfile(base_dir + + '/theme/default/search_banner.png'): + copyfile(base_dir + + '/theme/default/search_banner.png', + banner_filename) + # show the search screen msg = html_search(self.server.translate, self.server.base_dir, self.path, diff --git a/webapp_search.py b/webapp_search.py index 1b9adde4c..80c381552 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -404,6 +404,20 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str, search_banner_file, search_banner_filename = \ get_search_banner_file(base_dir, search_nickname, domain, theme) + # if there is no search banner then use the default + if not search_banner_filename: + if os.path.isfile(base_dir + + '/theme/default/search_banner.png'): + banner_filename = \ + acct_dir(base_dir, search_nickname, domain) + \ + '/search_banner.png' + copyfile(base_dir + + '/theme/default/search_banner.png', + banner_filename) + search_banner_file, search_banner_filename = \ + get_search_banner_file(base_dir, + search_nickname, domain, theme) + text_mode_banner_str = html_keyboard_navigation(text_mode_banner, {}, {}) if text_mode_banner_str is None: text_mode_banner_str = ''