From 52117ff9e2873983e786a97bccf697f8ec78c803 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 28 Jul 2019 20:54:05 +0100 Subject: [PATCH] Dropdown for follow and block --- daemon.py | 14 ++++++++++++-- epicyon-profile.css | 20 ++++++++++++++++++++ webinterface.py | 46 ++++++++++++++++++++++++++++----------------- 3 files changed, 61 insertions(+), 19 deletions(-) diff --git a/daemon.py b/daemon.py index 9127c7887..e264a6687 100644 --- a/daemon.py +++ b/daemon.py @@ -606,7 +606,11 @@ class PubServer(BaseHTTPRequestHandler): postJsonObject['likes']={} if 'text/html' in self.headers['Accept']: self._set_headers('text/html') - self.wfile.write(htmlIndividualPost(postJsonObject).encode('utf-8')) + self.wfile.write(htmlIndividualPost( \ + self.server.session, \ + self.server.cachedWebfingers,self.server.personCache, \ + nickname,self.server.domain,self.server.port, \ + postJsonObject).encode('utf-8')) else: self._set_headers('application/json') self.wfile.write(json.dumps(postJsonObject).encode('utf-8')) @@ -807,7 +811,11 @@ class PubServer(BaseHTTPRequestHandler): postJsonObject['likes']={} if 'text/html' in self.headers['Accept']: self._set_headers('text/html') - self.wfile.write(htmlIndividualPost(postJsonObject).encode('utf-8')) + self.wfile.write(htmlIndividualPost( \ + self.server.session, \ + self.server.cachedWebfingers,self.server.personCache, \ + nickname,self.server.domain,self.server.port, \ + postJsonObject).encode('utf-8')) else: self._set_headers('application/json') self.wfile.write(json.dumps(postJsonObject).encode('utf-8')) @@ -849,6 +857,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.personCache, \ nickname, \ self.server.domain, \ + self.server.port, \ inboxFeed).encode('utf-8')) else: self._set_headers('application/json') @@ -894,6 +903,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.personCache, \ nickname, \ self.server.domain, \ + self.server.port, \ outboxFeed).encode('utf-8')) else: self._set_headers('application/json') diff --git a/epicyon-profile.css b/epicyon-profile.css index 39f5e3550..6abff7df4 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -335,6 +335,20 @@ input[type=submit]:hover { transform: translateY(-10%); } +.dropdown-timeline { + margin: 10px auto; + padding: 0px 0px; +} + +.dropdown-timeline img { + opacity: 1.0; + width: 90%; + height: 90%; + padding: 0px 0px; + -ms-transform: translateY(-10%); + transform: translateY(-10%); +} + .scope-desc { font-size: 18px; } @@ -371,3 +385,9 @@ input[type=submit]:hover { /* Change the background color of the dropdown button when the dropdown content is shown */ .dropdown:hover .dropbtn {background-color: #3e8e41;} + +/* Show the dropdown menu on hover */ +.dropdown-timeline:hover .dropdown-content {display: block;} + +/* Change the background color of the dropdown button when the dropdown content is shown */ +.dropdown-timeline:hover .dropbtn {background-color: #3e8e41;} diff --git a/webinterface.py b/webinterface.py index cd59994bd..90cb49ad2 100644 --- a/webinterface.py +++ b/webinterface.py @@ -197,7 +197,7 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \ if item['type']=='Create': profileStr+= \ individualPostAsHtml(session,wfRequest,personCache, \ - domain,item) + nickname,domain,port,item) return profileStr def htmlProfileFollowing(baseDir: str,httpPrefix: str, \ @@ -368,13 +368,14 @@ def individualFollowAsHtml(session,wfRequest: {}, \ '\n' def individualPostAsHtml(session,wfRequest: {},personCache: {}, \ - domain: str,postJsonObject: {}) -> str: + nickname: str,domain: str,port: int, \ + postJsonObject: {}) -> str: avatarPosition='' containerClass='container' timeClass='time-right' - nickname=getNicknameFromActor(postJsonObject['actor']) - domain,port=getDomainFromActor(postJsonObject['actor']) - titleStr='@'+nickname+'@'+domain + actorNickname=getNicknameFromActor(postJsonObject['actor']) + actorDomain,actorPort=getDomainFromActor(postJsonObject['actor']) + titleStr='@'+actorNickname+'@'+actorDomain if postJsonObject['object']['inReplyTo']: containerClass='container darker' avatarPosition=' class="right"' @@ -411,18 +412,29 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \ attachmentCtr+=1 avatarUrl=postJsonObject['actor']+'/avatar.png' - if domain not in postJsonObject['actor']: + + fullDomain=domain + if port!=80 and port!=443: + fullDomain=domain+':'+str(port) + + if fullDomain not in postJsonObject['actor']: inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \ getPersonBox(session,wfRequest,personCache,'outbox') if avatarUrl2: avatarUrl=avatarUrl2 if preferredName: titleStr=preferredName+' '+titleStr - + return \ '
\n' \ - '' \ - 'Avatar\n'+ \ + ' ' \ '

'+titleStr+'

'+ \ postJsonObject['object']['content']+'\n'+ \ attachmentStr+ \ @@ -430,7 +442,7 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \ '
\n' def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \ - nickname: str,domain: str,timelineJson: {}, \ + nickname: str,domain: str,port: int,timelineJson: {}, \ boxName: str) -> str: """Show the timeline as html """ @@ -466,31 +478,31 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \ for item in timelineJson['orderedItems']: if item['type']=='Create': tlStr+=individualPostAsHtml(session,wfRequest,personCache, \ - domain,item) + nickname,domain,port,item) tlStr+=htmlFooter() return tlStr def htmlInbox(session,baseDir: str,wfRequest: {},personCache: {}, \ - nickname: str,domain: str,inboxJson: {}) -> str: + nickname: str,domain: str,port: int,inboxJson: {}) -> str: """Show the inbox as html """ return htmlTimeline(session,baseDir,wfRequest,personCache, \ - nickname,domain,inboxJson,'inbox') + nickname,domain,port,inboxJson,'inbox') def htmlOutbox(session,baseDir: str,wfRequest: {},personCache: {}, \ - nickname: str,domain: str,outboxJson: {}) -> str: + nickname: str,domain: str,port: int,outboxJson: {}) -> str: """Show the Outbox as html """ return htmlTimeline(session,baseDir,wfRequest,personCache, \ - nickname,domain,outboxJson,'outbox') + nickname,domain,port,outboxJson,'outbox') def htmlIndividualPost(session,wfRequest: {},personCache: {}, \ - domain: str,postJsonObject: {}) -> str: + nickname: str,domain: str,port: int,postJsonObject: {}) -> str: """Show an individual post as html """ return htmlHeader()+ \ individualPostAsHtml(session,wfRequest,personCache, \ - domain,postJsonObject)+ \ + nickname,domain,port,postJsonObject)+ \ htmlFooter() def htmlPostReplies(postJsonObject: {}) -> str: