mirror of https://gitlab.com/bashrc2/epicyon
Caching of icons
parent
155761a3c5
commit
5a63454d1b
19
daemon.py
19
daemon.py
|
@ -1315,12 +1315,19 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
mediaStr=self.path.split('/icons/')[1]
|
mediaStr=self.path.split('/icons/')[1]
|
||||||
mediaFilename= \
|
mediaFilename= \
|
||||||
self.server.baseDir+'/img/icons/'+mediaStr
|
self.server.baseDir+'/img/icons/'+mediaStr
|
||||||
if os.path.isfile(mediaFilename):
|
if self.server.iconsCache.get(mediaStr):
|
||||||
with open(mediaFilename, 'rb') as avFile:
|
self._set_headers('image/png',len(mediaBinary),cookie)
|
||||||
mediaBinary = avFile.read()
|
self._write(mediaBinary)
|
||||||
self._set_headers('image/png',len(mediaBinary),cookie)
|
self.server.iconsCache[mediaStr]=mediaBinary
|
||||||
self._write(mediaBinary)
|
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
if os.path.isfile(mediaFilename):
|
||||||
|
with open(mediaFilename, 'rb') as avFile:
|
||||||
|
mediaBinary = avFile.read()
|
||||||
|
self._set_headers('image/png',len(mediaBinary),cookie)
|
||||||
|
self._write(mediaBinary)
|
||||||
|
self.server.iconsCache[mediaStr]=mediaBinary
|
||||||
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -3868,6 +3875,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
actorChanged=True
|
actorChanged=True
|
||||||
if fields.get('themeDropdown'):
|
if fields.get('themeDropdown'):
|
||||||
setTheme(self.server.baseDir,fields['themeDropdown'])
|
setTheme(self.server.baseDir,fields['themeDropdown'])
|
||||||
|
#self.server.iconsCache={}
|
||||||
if fields.get('donateUrl'):
|
if fields.get('donateUrl'):
|
||||||
currentDonateUrl=getDonationUrl(actorJson)
|
currentDonateUrl=getDonationUrl(actorJson)
|
||||||
if fields['donateUrl']!=currentDonateUrl:
|
if fields['donateUrl']!=currentDonateUrl:
|
||||||
|
@ -5324,6 +5332,7 @@ def runDaemon(maxRecentPosts: int, \
|
||||||
|
|
||||||
httpd.recentPostsCache={}
|
httpd.recentPostsCache={}
|
||||||
httpd.maxRecentPosts=maxRecentPosts
|
httpd.maxRecentPosts=maxRecentPosts
|
||||||
|
httpd.iconsCache={}
|
||||||
|
|
||||||
print('Creating inbox queue')
|
print('Creating inbox queue')
|
||||||
httpd.thrInboxQueue= \
|
httpd.thrInboxQueue= \
|
||||||
|
|
Loading…
Reference in New Issue