mirror of https://gitlab.com/bashrc2/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)
|
True,self.server.ocapAlways)
|
||||||
if inboxFeed:
|
if inboxFeed:
|
||||||
if 'text/html' in self.headers['Accept']:
|
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 'page=' not in self.path:
|
||||||
# if no page was specified then show the first
|
# if no page was specified then show the first
|
||||||
inboxFeed=personBoxJson(self.server.baseDir, \
|
inboxFeed=personBoxJson(self.server.baseDir, \
|
||||||
|
@ -712,11 +715,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.path+'?page=1', \
|
self.path+'?page=1', \
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
maxPostsInFeed, 'inbox', \
|
maxPostsInFeed, 'inbox', \
|
||||||
True,self.server.ocapAlways)
|
True,self.server.ocapAlways)
|
||||||
self._set_headers('text/html')
|
self._set_headers('text/html')
|
||||||
self.wfile.write(htmlInbox(self.server.session, \
|
self.wfile.write(htmlInbox(self.server.session, \
|
||||||
|
self.server.baseDir, \
|
||||||
self.server.cachedWebfingers, \
|
self.server.cachedWebfingers, \
|
||||||
self.server.personCache, \
|
self.server.personCache, \
|
||||||
|
nickname, \
|
||||||
self.server.domain, \
|
self.server.domain, \
|
||||||
inboxFeed).encode('utf-8'))
|
inboxFeed).encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
|
@ -744,6 +749,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.ocapAlways)
|
self.server.ocapAlways)
|
||||||
if outboxFeed:
|
if outboxFeed:
|
||||||
if 'text/html' in self.headers['Accept']:
|
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 'page=' not in self.path:
|
||||||
# if a page wasn't specified then show the first one
|
# if a page wasn't specified then show the first one
|
||||||
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
|
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
|
||||||
|
@ -755,8 +763,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
self._set_headers('text/html')
|
self._set_headers('text/html')
|
||||||
self.wfile.write(htmlOutbox(self.server.session, \
|
self.wfile.write(htmlOutbox(self.server.session, \
|
||||||
|
self.server.baseDir, \
|
||||||
self.server.cachedWebfingers, \
|
self.server.cachedWebfingers, \
|
||||||
self.server.personCache, \
|
self.server.personCache, \
|
||||||
|
nickname, \
|
||||||
self.server.domain, \
|
self.server.domain, \
|
||||||
outboxFeed).encode('utf-8'))
|
outboxFeed).encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -6,6 +6,15 @@ body, html {
|
||||||
margin: 0 auto;
|
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 {
|
.hero-image {
|
||||||
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("image.png");
|
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("image.png");
|
||||||
height: 50%;
|
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')
|
copyfile(baseDir+'/img/default-avatar.png',baseDir+'/accounts/'+nickname+'@'+domain+'/avatar.png')
|
||||||
if os.path.isfile(baseDir+'/img/image.png'):
|
if os.path.isfile(baseDir+'/img/image.png'):
|
||||||
copyfile(baseDir+'/img/image.png',baseDir+'/accounts/'+nickname+'@'+domain+'/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
|
return privateKeyPem,publicKeyPem,newPerson,webfingerEndpoint
|
||||||
|
|
||||||
def createSharedInbox(baseDir: str,nickname: str,domain: str,port: int, \
|
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'+ \
|
'<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \
|
||||||
'</div>\n'
|
'</div>\n'
|
||||||
|
|
||||||
def htmlTimeline(session,wfRequest: {},personCache: {}, \
|
def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
domain: str,timelineJson: {}) -> str:
|
nickname: str,domain: str,timelineJson: {},boxName: str) -> str:
|
||||||
"""Show the timeline as html
|
"""Show the timeline as html
|
||||||
"""
|
"""
|
||||||
if not timelineJson.get('orderedItems'):
|
if not timelineJson.get('orderedItems'):
|
||||||
return ""
|
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']:
|
for item in timelineJson['orderedItems']:
|
||||||
if item['type']=='Create':
|
if item['type']=='Create':
|
||||||
tlStr+=individualPostAsHtml(session,wfRequest,personCache, \
|
tlStr+=individualPostAsHtml(session,wfRequest,personCache, \
|
||||||
|
@ -298,19 +325,19 @@ def htmlTimeline(session,wfRequest: {},personCache: {}, \
|
||||||
tlStr+=htmlFooter()
|
tlStr+=htmlFooter()
|
||||||
return tlStr
|
return tlStr
|
||||||
|
|
||||||
def htmlInbox(session,wfRequest: {},personCache: {}, \
|
def htmlInbox(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
domain: str,inboxJson: {}) -> str:
|
nickname: str,domain: str,inboxJson: {}) -> str:
|
||||||
"""Show the inbox as html
|
"""Show the inbox as html
|
||||||
"""
|
"""
|
||||||
return htmlTimeline(session,wfRequest,personCache, \
|
return htmlTimeline(session,baseDir,wfRequest,personCache, \
|
||||||
domain,inboxJson)
|
nickname,domain,inboxJson,'inbox')
|
||||||
|
|
||||||
def htmlOutbox(session,wfRequest: {},personCache: {}, \
|
def htmlOutbox(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
domain: str,outboxJson: {}) -> str:
|
nickname: str,domain: str,outboxJson: {}) -> str:
|
||||||
"""Show the Outbox as html
|
"""Show the Outbox as html
|
||||||
"""
|
"""
|
||||||
return htmlTimeline(session,wfRequest,personCache, \
|
return htmlTimeline(session,baseDir,wfRequest,personCache, \
|
||||||
domain,outboxJson)
|
nickname,domain,outboxJson,'outbox')
|
||||||
|
|
||||||
def htmlIndividualPost(session,wfRequest: {},personCache: {}, \
|
def htmlIndividualPost(session,wfRequest: {},personCache: {}, \
|
||||||
domain: str,postJsonObject: {}) -> str:
|
domain: str,postJsonObject: {}) -> str:
|
||||||
|
|
Loading…
Reference in New Issue