mirror of https://gitlab.com/bashrc2/epicyon
Extra condition
parent
b4843e1408
commit
d9c20676a0
65
daemon.py
65
daemon.py
|
@ -1911,39 +1911,40 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
self._benchmarkGETtimings(GETstartTime, GETtimings, 17)
|
||||
|
||||
for ext in ('webp', 'gif', 'jpg', 'png'):
|
||||
for bg in ('follow', 'options', 'login'):
|
||||
# follow screen background image
|
||||
if self.path == '/' + bg + '-background.' + ext:
|
||||
mediaFilename = \
|
||||
self.server.baseDir + '/accounts/' + \
|
||||
bg + '-background.' + ext
|
||||
if os.path.isfile(mediaFilename):
|
||||
if self._etag_exists(mediaFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
if '-background.' in self.path:
|
||||
for ext in ('webp', 'gif', 'jpg', 'png'):
|
||||
for bg in ('follow', 'options', 'login'):
|
||||
# follow screen background image
|
||||
if self.path == '/' + bg + '-background.' + ext:
|
||||
mediaFilename = \
|
||||
self.server.baseDir + '/accounts/' + \
|
||||
bg + '-background.' + ext
|
||||
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/' + ext,
|
||||
mediaBinary, cookie,
|
||||
callingDomain)
|
||||
self._write(mediaBinary)
|
||||
return
|
||||
self._404()
|
||||
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/' + ext,
|
||||
mediaBinary, cookie,
|
||||
callingDomain)
|
||||
self._write(mediaBinary)
|
||||
return
|
||||
self._404()
|
||||
return
|
||||
|
||||
self._benchmarkGETtimings(GETstartTime, GETtimings, 18)
|
||||
|
||||
|
|
Loading…
Reference in New Issue