diff --git a/daemon.py b/daemon.py index 945a8ed6..da53f0b8 100644 --- a/daemon.py +++ b/daemon.py @@ -66,7 +66,9 @@ from webinterface import htmlLogin from webinterface import htmlGetLoginCredentials from webinterface import htmlNewPost from webinterface import htmlFollowConfirm +from webinterface import htmlSearch from webinterface import htmlUnfollowConfirm +from webinterface import htmlProfileAfterSearch from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload @@ -611,7 +613,16 @@ class PubServer(BaseHTTPRequestHandler): self._redirect_headers(originPathStr,cookie) self.server.GETbusy=False return - + + # search for a fediverse address from the web interface by selecting search icon + if '/users/' in self.path: + if self.path.endswith('/search'): + # show the search screen + self._set_headers('text/html',cookie) + self.wfile.write(htmlSearch(self.server.baseDir,self.path).encode()) + self.server.GETbusy=False + return + # Unfollow a person from the web interface by selecting Unfollow on the dropdown if '/users/' in self.path: if '?unfollow=' in self.path: @@ -1459,6 +1470,42 @@ class PubServer(BaseHTTPRequestHandler): self._redirect_headers(originPathStr,cookie) self.server.POSTbusy=False + # decision to follow in the web interface is confirmed + if authorized and self.path.endswith('/searchhandle'): + actorStr=self.path.replace('/searchhandle','') + length = int(self.headers['Content-length']) + searchParams=self.rfile.read(length).decode('utf-8') + if 'searchtext=' in searchParams: + searchStr=searchParams.split('searchtext=')[1] + if '&' in searchStr: + searchStr=searchStr.split('&')[0] + searchStr=searchStr.replace('+',' ').replace('%40','@') + if '@' in searchStr: + print('Search: '+searchStr) + nickname=getNicknameFromActor(self.path) + if not self.server.session: + self.server.session= \ + createSession(self.server.domain,self.server.port,self.server.useTor) + profileStr= \ + htmlProfileAfterSearch(self.server.baseDir, \ + self.path.replace('/searchhandle',''), \ + self.server.httpPrefix, \ + nickname, \ + self.server.domain,self.server.port, \ + searchStr, \ + self.server.session, \ + self.server.cachedWebfingers, \ + self.server.personCache, \ + self.server.debug) + if profileStr: + self._login_headers('text/html') + self.wfile.write(profileStr.encode('utf-8')) + self.server.POSTbusy=False + return + self._redirect_headers(actorStr,cookie) + self.server.POSTbusy=False + return + # decision to follow in the web interface is confirmed if authorized and self.path.endswith('/followconfirm'): originPathStr=self.path.split('/followconfirm')[0] diff --git a/epicyon-follow.css b/epicyon-follow.css index 6ba8a03f..8ae28dcd 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -49,3 +49,12 @@ body, html { background-color: #555; color: white; } + +input[type=text] { + width: 70%; + clear: both; + font-size: 24px; + text-align: center; + color: var(--text-entry-foreground); + background-color: var(--text-entry-background); +} diff --git a/epicyon-profile.css b/epicyon-profile.css index 5392a916..1eee4cee 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -209,6 +209,7 @@ body, html { float: left; max-width: 60px; width: 10%; + padding: 0px 7px; margin-right: 20px; border-radius: 10%; } @@ -216,22 +217,23 @@ body, html { .containericons { border: 0px solid #dedede; background-color: #f1f1f1; - border-radius: 5px; - padding: 10px; - margin: 10px 0; -} - -.darker { - border-color: #ccc; - background-color: #ddd; + border-radius: 0px; + padding: 0px; + margin: 0px 0; } .containericons img { float: right; max-width: 35px; width: 5%; - margin-right: 50px; - border-radius: 10%; + margin-right: 10px; + padding-left: 0px 0px; + border-radius: 0%; +} + +.darker { + border-color: #ccc; + background-color: #ddd; } .container img.attachment { diff --git a/webinterface.py b/webinterface.py index 60ee3f12..7be37d29 100644 --- a/webinterface.py +++ b/webinterface.py @@ -16,6 +16,10 @@ from utils import getNicknameFromActor from utils import getDomainFromActor from posts import getPersonBox from follow import isFollowingActor +from webfinger import webfingerHandle +from posts import getUserUrl +from posts import parseUserFeed +from session import getJson def htmlGetLoginCredentials(loginParams: str,lastLoginTime: int) -> (str,str): """Receives login credentials via HTTPServer POST @@ -198,7 +202,7 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \ if item['type']=='Create': profileStr+= \ individualPostAsHtml(baseDir,session,wfRequest,personCache, \ - nickname,domain,port,item,False) + nickname,domain,port,item,None,True,False) return profileStr def htmlProfileFollowing(baseDir: str,httpPrefix: str, \ @@ -413,6 +417,7 @@ def individualPostAsHtml(baseDir: str, \ session,wfRequest: {},personCache: {}, \ nickname: str,domain: str,port: int, \ postJsonObject: {}, \ + avatarUrl: str, showAvatarDropdown: bool, showIcons=False) -> str: avatarPosition='' containerClass='container' @@ -457,7 +462,8 @@ def individualPostAsHtml(baseDir: str, \ ''+imageDescription+'\n' attachmentCtr+=1 - avatarUrl=postJsonObject['actor']+'/avatar.png' + if not avatarUrl: + avatarUrl=postJsonObject['actor']+'/avatar.png' fullDomain=domain if port!=80 and port!=443: @@ -484,7 +490,7 @@ def individualPostAsHtml(baseDir: str, \ avatarDropdown= \ '