diff --git a/daemon.py b/daemon.py index a1521175..96f586d5 100644 --- a/daemon.py +++ b/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: diff --git a/epicyon-profile.css b/epicyon-profile.css index 6ef53a1e..c5d1a339 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -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%; diff --git a/img/banner.png b/img/banner.png new file mode 100644 index 00000000..9e90513d Binary files /dev/null and b/img/banner.png differ diff --git a/person.py b/person.py index a191e5a4..755cd67d 100644 --- a/person.py +++ b/person.py @@ -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, \ diff --git a/webinterface.py b/webinterface.py index 74094c48..4691e38e 100644 --- a/webinterface.py +++ b/webinterface.py @@ -284,13 +284,40 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \ ''+postJsonObject['object']['published']+'\n'+ \ '\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+= \ + '
' \ + '
' \ + '
\n' \ + '
' \ + ' ' \ + ' ' \ + ' ' \ + '
' \ + '
' 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: