forked from indymedia/epicyon
Show timeline banner
parent
6bea6ceb4b
commit
62d596bade
12
daemon.py
12
daemon.py
|
@ -704,6 +704,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
True,self.server.ocapAlways)
|
||||
if inboxFeed:
|
||||
if 'text/html' in self.headers['Accept']:
|
||||
nickname=self.path.replace('/users/','').replace('/inbox','')
|
||||
if '?page=' in nickname:
|
||||
nickname=nickname.split('?page=')[0]
|
||||
if 'page=' not in self.path:
|
||||
# if no page was specified then show the first
|
||||
inboxFeed=personBoxJson(self.server.baseDir, \
|
||||
|
@ -712,11 +715,13 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.path+'?page=1', \
|
||||
self.server.httpPrefix, \
|
||||
maxPostsInFeed, 'inbox', \
|
||||
True,self.server.ocapAlways)
|
||||
True,self.server.ocapAlways)
|
||||
self._set_headers('text/html')
|
||||
self.wfile.write(htmlInbox(self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
nickname, \
|
||||
self.server.domain, \
|
||||
inboxFeed).encode('utf-8'))
|
||||
else:
|
||||
|
@ -744,6 +749,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.ocapAlways)
|
||||
if outboxFeed:
|
||||
if 'text/html' in self.headers['Accept']:
|
||||
nickname=self.path.replace('/users/','').replace('/outbox','')
|
||||
if '?page=' in nickname:
|
||||
nickname=nickname.split('?page=')[0]
|
||||
if 'page=' not in self.path:
|
||||
# if a page wasn't specified then show the first one
|
||||
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
|
||||
|
@ -755,8 +763,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
self._set_headers('text/html')
|
||||
self.wfile.write(htmlOutbox(self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
nickname, \
|
||||
self.server.domain, \
|
||||
outboxFeed).encode('utf-8'))
|
||||
else:
|
||||
|
|
|
@ -6,6 +6,15 @@ body, html {
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.timeline-banner {
|
||||
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("banner.png");
|
||||
height: 10%;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("image.png");
|
||||
height: 50%;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
|
@ -241,6 +241,8 @@ def createPerson(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
copyfile(baseDir+'/img/default-avatar.png',baseDir+'/accounts/'+nickname+'@'+domain+'/avatar.png')
|
||||
if os.path.isfile(baseDir+'/img/image.png'):
|
||||
copyfile(baseDir+'/img/image.png',baseDir+'/accounts/'+nickname+'@'+domain+'/image.png')
|
||||
if os.path.isfile(baseDir+'/img/banner.png'):
|
||||
copyfile(baseDir+'/img/banner.png',baseDir+'/accounts/'+nickname+'@'+domain+'/banner.png')
|
||||
return privateKeyPem,publicKeyPem,newPerson,webfingerEndpoint
|
||||
|
||||
def createSharedInbox(baseDir: str,nickname: str,domain: str,port: int, \
|
||||
|
|
|
@ -284,13 +284,40 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \
|
|||
'<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \
|
||||
'</div>\n'
|
||||
|
||||
def htmlTimeline(session,wfRequest: {},personCache: {}, \
|
||||
domain: str,timelineJson: {}) -> str:
|
||||
def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,timelineJson: {},boxName: str) -> str:
|
||||
"""Show the timeline as html
|
||||
"""
|
||||
if not timelineJson.get('orderedItems'):
|
||||
return ""
|
||||
tlStr=htmlHeader()
|
||||
|
||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||
profileStyle = \
|
||||
cssFile.read().replace('banner.png', \
|
||||
'/users/'+nickname+'/banner.png')
|
||||
|
||||
localButton='button'
|
||||
personalButton='button'
|
||||
federatedButton='button'
|
||||
if boxName=='inbox':
|
||||
localButton='buttonselected'
|
||||
elif boxName=='outbox':
|
||||
personalButton='buttonselected'
|
||||
elif boxName=='federated':
|
||||
federatedButton='buttonselected'
|
||||
|
||||
actor='/users/'+nickname
|
||||
tlStr=htmlHeader(profileStyle)
|
||||
tlStr+= \
|
||||
'<div class="timeline-banner">' \
|
||||
'</div>' \
|
||||
'<div class="container">\n' \
|
||||
' <center>' \
|
||||
' <a href="'+actor+'/inbox"><button class="'+localButton+'"><span>Local </span></button></a>' \
|
||||
' <a href="'+actor+'/outbox"><button class="'+personalButton+'"><span>Personal </span></button></a>' \
|
||||
' <a href="'+actor+'/federated"><button class="'+federatedButton+'"><span>Federated </span></button></a>' \
|
||||
' </center>' \
|
||||
'</div>'
|
||||
for item in timelineJson['orderedItems']:
|
||||
if item['type']=='Create':
|
||||
tlStr+=individualPostAsHtml(session,wfRequest,personCache, \
|
||||
|
@ -298,19 +325,19 @@ def htmlTimeline(session,wfRequest: {},personCache: {}, \
|
|||
tlStr+=htmlFooter()
|
||||
return tlStr
|
||||
|
||||
def htmlInbox(session,wfRequest: {},personCache: {}, \
|
||||
domain: str,inboxJson: {}) -> str:
|
||||
def htmlInbox(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,inboxJson: {}) -> str:
|
||||
"""Show the inbox as html
|
||||
"""
|
||||
return htmlTimeline(session,wfRequest,personCache, \
|
||||
domain,inboxJson)
|
||||
return htmlTimeline(session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,inboxJson,'inbox')
|
||||
|
||||
def htmlOutbox(session,wfRequest: {},personCache: {}, \
|
||||
domain: str,outboxJson: {}) -> str:
|
||||
def htmlOutbox(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,outboxJson: {}) -> str:
|
||||
"""Show the Outbox as html
|
||||
"""
|
||||
return htmlTimeline(session,wfRequest,personCache, \
|
||||
domain,outboxJson)
|
||||
return htmlTimeline(session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,outboxJson,'outbox')
|
||||
|
||||
def htmlIndividualPost(session,wfRequest: {},personCache: {}, \
|
||||
domain: str,postJsonObject: {}) -> str:
|
||||
|
|
Loading…
Reference in New Issue