From 54ed7777103c998c7adaece30f79a873e4d1ed2e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 29 Jul 2019 10:49:46 +0100 Subject: [PATCH] Follow screen --- README.md | 2 ++ daemon.py | 26 ++++++++++++++++++++ epicyon-follow.css | 60 ++++++++++++++++++++++++++++++++++++++++++++++ webinterface.py | 34 ++++++++++++++++++++++++-- 4 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 epicyon-follow.css diff --git a/README.md b/README.md index 147d6ef6..ee6c4859 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ https://blog.dereferenced.org/what-is-ocap-and-why-should-i-care https://alexcastano.com/what-is-activity-pub +https://gitlab.com/spritely/ocappub/blob/master/README.org + This project is currently *pre alpha* and not recommended for any real world uses. ## Goals diff --git a/daemon.py b/daemon.py index 6da6f45c..98dd40e8 100644 --- a/daemon.py +++ b/daemon.py @@ -64,6 +64,7 @@ from webinterface import htmlPostReplies from webinterface import htmlLogin from webinterface import htmlGetLoginCredentials from webinterface import htmlNewPost +from webinterface import htmlFollowConfirm from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload @@ -452,6 +453,16 @@ class PubServer(BaseHTTPRequestHandler): mediaBinary = avFile.read() self.wfile.write(mediaBinary) return + # follow screen background image + if self.path=='/follow-background.png': + mediaFilename= \ + self.server.baseDir+'/accounts/follow-background.png' + if os.path.isfile(mediaFilename): + self._set_headers('image/png') + with open(mediaFilename, 'rb') as avFile: + mediaBinary = avFile.read() + self.wfile.write(mediaBinary) + return # show media # Note that this comes before the busy flag to avoid conflicts if '/media/' in self.path: @@ -570,6 +581,21 @@ class PubServer(BaseHTTPRequestHandler): self.server.GETbusy=False return + if '/users/' in self.path: + if '?follow=' in self.path: + followStr=self.path.split('?follow=')[1] + originPathStr=self.path.split('?follow=')[0] + if ';' in followStr: + followActor=followStr.split(';')[0] + followProfileUrl=followStr.split(';')[1] + self._login_headers('text/html') + self.wfile.write(htmlFollowConfirm(self.server.baseDir,originPathStr,followActor,followProfileUrl).encode()) + self.server.GETbusy=False + return + self._redirect_headers(originPathStr) + self.server.GETbusy=False + return + if '/users/' in self.path and \ (self.path.endswith('/newpost') or \ self.path.endswith('/newunlisted') or \ diff --git a/epicyon-follow.css b/epicyon-follow.css new file mode 100644 index 00000000..9210c299 --- /dev/null +++ b/epicyon-follow.css @@ -0,0 +1,60 @@ +body, html { + height: 100%; + font-family: Arial, Helvetica, sans-serif; + max-width: 80%; + min-width: 600px; + margin: 0 auto; +} + +.follow { + background-image: url("follow-background.png"); + height: 100%; + background-position: center; + background-repeat: no-repeat; + background-size: cover; + position: relative; + background-color: white; +} + +.followAvatar { + margin: 15% 0; +} + +.followText { + font-size: 24px; +} + +.button { + border-radius: 4px; + background-color: #999; + border: none; + color: white; + text-align: center; + font-size: 24px; + padding: 10px; + width: 20%; + max-width: 200px; + min-width: 100px; + cursor: pointer; + margin: 5px; +} + +.button:hover { + background-color: #555; + color: white; +} + +.container { + border: 2px solid #dedede; + background-color: #f1f1f1; + border-radius: 5px; + padding: 10px; + margin: 10px 0; +} + +.container img { + max-width: 60px; + width: 100%; + margin-right: 20px; + border-radius: 10%; +} diff --git a/webinterface.py b/webinterface.py index b161802e..5ad97b16 100644 --- a/webinterface.py +++ b/webinterface.py @@ -428,8 +428,8 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \ avatarDropdown= \ ' ' \ ' Avatar' - if fullDomain+'/users/'+nickname not in postJsonObject['actor']: - avatarDropdown= \ + #if fullDomain+'/users/'+nickname not in postJsonObject['actor']: + avatarDropdown= \ '