forked from indymedia/epicyon
Fill screen image
parent
583c4a239d
commit
77633238a6
25
daemon.py
25
daemon.py
|
@ -81,6 +81,7 @@ from roles import setRole
|
||||||
from roles import clearModeratorStatus
|
from roles import clearModeratorStatus
|
||||||
from skills import outboxSkills
|
from skills import outboxSkills
|
||||||
from availability import outboxAvailability
|
from availability import outboxAvailability
|
||||||
|
from webinterface import htmlFullScreenImage
|
||||||
from webinterface import htmlDeletePost
|
from webinterface import htmlDeletePost
|
||||||
from webinterface import htmlAbout
|
from webinterface import htmlAbout
|
||||||
from webinterface import htmlRemoveSharedItem
|
from webinterface import htmlRemoveSharedItem
|
||||||
|
@ -753,6 +754,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'/emoji/' not in self.path and \
|
'/emoji/' not in self.path and \
|
||||||
'/tags/' not in self.path and \
|
'/tags/' not in self.path and \
|
||||||
'/avatars/' not in self.path and \
|
'/avatars/' not in self.path and \
|
||||||
|
'/fullscreen?' not in self.path and \
|
||||||
'/icons/' not in self.path:
|
'/icons/' not in self.path:
|
||||||
divertToLoginScreen=True
|
divertToLoginScreen=True
|
||||||
if self.path.startswith('/users/'):
|
if self.path.startswith('/users/'):
|
||||||
|
@ -797,6 +799,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._set_headers('text/css',len(msg),cookie)
|
self._set_headers('text/css',len(msg),cookie)
|
||||||
self._write(msg)
|
self._write(msg)
|
||||||
return
|
return
|
||||||
|
|
||||||
# image on login screen
|
# image on login screen
|
||||||
if self.path=='/login.png':
|
if self.path=='/login.png':
|
||||||
mediaFilename= \
|
mediaFilename= \
|
||||||
|
@ -818,7 +821,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._write(mediaBinary)
|
self._write(mediaBinary)
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# login screen background image
|
# login screen background image
|
||||||
if self.path=='/login-background.png':
|
if self.path=='/login-background.png':
|
||||||
mediaFilename= \
|
mediaFilename= \
|
||||||
|
@ -841,6 +845,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# follow screen background image
|
# follow screen background image
|
||||||
if self.path=='/follow-background.png':
|
if self.path=='/follow-background.png':
|
||||||
mediaFilename= \
|
mediaFilename= \
|
||||||
|
@ -863,6 +868,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# emoji images
|
# emoji images
|
||||||
if '/emoji/' in self.path:
|
if '/emoji/' in self.path:
|
||||||
if self.path.endswith('.png') or \
|
if self.path.endswith('.png') or \
|
||||||
|
@ -886,6 +892,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# show media
|
# show media
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
if '/media/' in self.path:
|
if '/media/' in self.path:
|
||||||
|
@ -922,6 +929,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# show shared item images
|
# show shared item images
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
if '/sharefiles/' in self.path:
|
if '/sharefiles/' in self.path:
|
||||||
|
@ -946,6 +954,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
# icon images
|
# icon images
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
if self.path.startswith('/icons/'):
|
if self.path.startswith('/icons/'):
|
||||||
|
@ -962,6 +971,20 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# full screen images shown from the media timeline
|
||||||
|
if authorized and self.path.startswith('/fullscreen?'):
|
||||||
|
fullscreenImageStr=self.path.split('?')
|
||||||
|
imageFilename=fullscreenImageStr[1]
|
||||||
|
imageDescription=None
|
||||||
|
if len(fullscreenImageStr)>2:
|
||||||
|
imageDescription=fullscreenImageStr[2]
|
||||||
|
msg=htmlFullScreenImage(imageFilename,imageDescription)
|
||||||
|
self._login_headers('text/html',len(msg))
|
||||||
|
self._write(msg)
|
||||||
|
self.server.GETbusy=False
|
||||||
|
return
|
||||||
|
|
||||||
# cached avatar images
|
# cached avatar images
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
if self.path.startswith('/avatars/'):
|
if self.path.startswith('/avatars/'):
|
||||||
|
|
|
@ -51,6 +51,44 @@ from skills import getSkills
|
||||||
from cache import getPersonFromCache
|
from cache import getPersonFromCache
|
||||||
from cache import storePersonInCache
|
from cache import storePersonInCache
|
||||||
|
|
||||||
|
def htmlFullScreenImage(imageFilename: str,description: str) -> str:
|
||||||
|
"""On the media timeline show a full screen image when selecting it
|
||||||
|
"""
|
||||||
|
htmlStr='<!DOCTYPE html>\n'
|
||||||
|
htmlStr+='<html>\n'
|
||||||
|
htmlStr+='<head>\n'
|
||||||
|
htmlStr+='<meta name="viewport" content="width=device-width, initial-scale=1">\n'
|
||||||
|
htmlStr+='<style>\n'
|
||||||
|
htmlStr+='body, html {\n'
|
||||||
|
htmlStr+=' height: 100%;\n'
|
||||||
|
htmlStr+=' margin: 0;\n'
|
||||||
|
htmlStr+='}\n'
|
||||||
|
htmlStr+='\n'
|
||||||
|
htmlStr+='.bg {\n'
|
||||||
|
htmlStr+=' background-image: url("'+imageFilename+'");\n'
|
||||||
|
htmlStr+='\n'
|
||||||
|
if description:
|
||||||
|
htmlStr+=' height: 90%;\n'
|
||||||
|
else:
|
||||||
|
htmlStr+=' height: 100%;\n'
|
||||||
|
htmlStr+=''
|
||||||
|
htmlStr+=' background-position: center;\n'
|
||||||
|
htmlStr+=' background-repeat: no-repeat;\n'
|
||||||
|
htmlStr+=' background-size: cover;\n'
|
||||||
|
htmlStr+='}\n'
|
||||||
|
htmlStr+='</style>\n'
|
||||||
|
htmlStr+='</head>\n'
|
||||||
|
htmlStr+='<body>\n'
|
||||||
|
htmlStr+='\n'
|
||||||
|
htmlStr+='<div class="bg"></div>\n'
|
||||||
|
htmlStr+='\n'
|
||||||
|
if description:
|
||||||
|
htmlStr+='<p>'+description+'</p>\n'
|
||||||
|
htmlStr+='\n'
|
||||||
|
htmlStr+='</body>\n'
|
||||||
|
htmlStr+='</html>'
|
||||||
|
return htmlStr
|
||||||
|
|
||||||
def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avatarUrl: str,personCache: {},force=False) -> str:
|
def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avatarUrl: str,personCache: {},force=False) -> str:
|
||||||
"""Updates the cached avatar for the given actor
|
"""Updates the cached avatar for the given actor
|
||||||
"""
|
"""
|
||||||
|
@ -1885,7 +1923,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
galleryStr+= \
|
galleryStr+= \
|
||||||
'<div class="gallery">\n' \
|
'<div class="gallery">\n' \
|
||||||
' <a href="'+messageId+'">\n' \
|
' <a href="'+messageId+'">\n' \
|
||||||
' <img loading="lazy" src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" width="600" height="400">\n' \
|
' <img loading="lazy" src="/fullscreen?'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" width="600" height="400">\n' \
|
||||||
' </a>\n</div>\n'
|
' </a>\n</div>\n'
|
||||||
attachmentStr+= \
|
attachmentStr+= \
|
||||||
'<a href="'+attach['url']+'">' \
|
'<a href="'+attach['url']+'">' \
|
||||||
|
|
Loading…
Reference in New Issue