From 9223da428400f66bfe92b1c48a49fe64ff12f68b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 10 Jun 2020 13:59:01 +0100 Subject: [PATCH] Show search banner --- daemon.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/daemon.py b/daemon.py index 05c48e55..b5258aaf 100644 --- a/daemon.py +++ b/daemon.py @@ -1726,6 +1726,36 @@ class PubServer(BaseHTTPRequestHandler): self._404() return + # search screen banner image + if self.path == '/search_banner.png': + mediaFilename = \ + self.server.baseDir + '/accounts/search_banner.png' + if os.path.isfile(mediaFilename): + if self._etag_exists(mediaFilename): + # The file has not changed + self._304() + return + + tries = 0 + mediaBinary = None + while tries < 5: + try: + with open(mediaFilename, 'rb') as avFile: + mediaBinary = avFile.read() + break + except Exception as e: + print(e) + time.sleep(1) + tries += 1 + if mediaBinary: + self._set_headers_etag(mediaFilename, 'image/png', + mediaBinary, cookie, + callingDomain) + self._write(mediaBinary) + return + self._404() + return + self._benchmarkGETtimings(GETstartTime, GETtimings, 17) # follow screen background image