Show search banner

main
Bob Mottram 2020-06-10 13:59:01 +01:00
parent aab9307c3c
commit 9223da4284
1 changed files with 30 additions and 0 deletions

View File

@ -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