forked from indymedia/epicyon
Follow screen
parent
8a24d7437d
commit
54ed777710
|
@ -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
|
||||
|
|
26
daemon.py
26
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 \
|
||||
|
|
|
@ -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%;
|
||||
}
|
|
@ -428,8 +428,8 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \
|
|||
avatarDropdown= \
|
||||
' <a href="'+postJsonObject['actor']+'">' \
|
||||
' <img src="'+avatarUrl+'" title="Show profile" alt="Avatar"'+avatarPosition+'/></a>'
|
||||
if fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
||||
avatarDropdown= \
|
||||
#if fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
||||
avatarDropdown= \
|
||||
' <div class="dropdown-timeline">' \
|
||||
' <img src="'+avatarUrl+'" alt="Avatar"'+avatarPosition+'/>' \
|
||||
' <div class="dropdown-timeline-content">' \
|
||||
|
@ -517,3 +517,33 @@ def htmlPostReplies(postJsonObject: {}) -> str:
|
|||
"""Show the replies to an individual post as html
|
||||
"""
|
||||
return htmlHeader()+"<h1>Replies</h1>"+htmlFooter()
|
||||
|
||||
def htmlFollowConfirm(baseDir: str,originPathStr: str,followActor: str,followProfileUrl: str) -> str:
|
||||
"""Asks to confirm a follow
|
||||
"""
|
||||
followDomain,port=getDomainFromActor(followActor)
|
||||
|
||||
if os.path.isfile(baseDir+'/img/follow-background.png'):
|
||||
if not os.path.isfile(baseDir+'/accounts/follow-background.png'):
|
||||
copyfile(baseDir+'/img/follow-background.png',baseDir+'/accounts/follow-background.png')
|
||||
|
||||
with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
|
||||
profileStyle = cssFile.read()
|
||||
followStr=htmlHeader(profileStyle)
|
||||
followStr+='<div class="follow">'
|
||||
followStr+=' <div class="followAvatar">'
|
||||
followStr+=' <center>'
|
||||
followStr+=' <a href="'+followActor+'">'
|
||||
followStr+=' <img src="'+followProfileUrl+'"/></a>'
|
||||
followStr+=' <p class="followText">Follow '+getNicknameFromActor(followActor)+'@'+followDomain+' ?</p>'
|
||||
followStr+= \
|
||||
' <form method="POST" action="'+originPathStr+'?followconfirm">' \
|
||||
' <input type="hidden" name="actor" value="'+followActor+'">' \
|
||||
' <button type="submit" class="button" name="submitYes">Yes</button>' \
|
||||
' <a href="'+originPathStr+'"><button class="button">No</button></a>' \
|
||||
' </form>'
|
||||
followStr+='</center>'
|
||||
followStr+='</div>'
|
||||
followStr+='</div>'
|
||||
followStr+=htmlFooter()
|
||||
return followStr
|
||||
|
|
Loading…
Reference in New Issue