From 5e0a7e90ca8fc6336e379742c99d2c6bd9d29426 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 25 Jul 2019 22:39:09 +0100 Subject: [PATCH] New post screen --- daemon.py | 7 +++++++ epicyon-profile.css | 42 ++++++++++++++++++++++++++++++++++-------- webinterface.py | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/daemon.py b/daemon.py index 584374c8..24f94156 100644 --- a/daemon.py +++ b/daemon.py @@ -54,6 +54,7 @@ from webinterface import htmlOutbox from webinterface import htmlPostReplies from webinterface import htmlLogin from webinterface import htmlGetLoginCredentials +from webinterface import htmlNewPost from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload @@ -519,6 +520,12 @@ class PubServer(BaseHTTPRequestHandler): self._login_headers('text/html') self.wfile.write(htmlLogin(self.server.baseDir).encode('utf-8')) self.server.GETbusy=False + return + + if '/users/' in self.path and self.path.endswith('/newpost'): + self._login_headers('text/html') + self.wfile.write(htmlNewPost(self.server.baseDir,self.path).encode('utf-8')) + self.server.GETbusy=False return # get an individual post from the path /@nickname/statusnumber diff --git a/epicyon-profile.css b/epicyon-profile.css index c5d1a339..168e2e66 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -155,14 +155,6 @@ body, html { margin: 10px 0; } -.container { - border: 2px solid #dedede; - background-color: #f1f1f1; - border-radius: 5px; - padding: 10px; - margin: 10px 0; -} - .darker { border-color: #ccc; background-color: #ddd; @@ -235,3 +227,37 @@ body, html { height: 30px; background-color: #999; } + +input[type=text], select, textarea { + width: 100%; + padding: 12px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; + margin-top: 6px; + margin-bottom: 16px; + resize: vertical; + font-size: 18px; +} + +input[type=submit] { + background-color: #4CAF50; + color: white; + padding: 12px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} + +input[type=submit]:hover { + background-color: #45a049; +} + +.vertical-center { + top: 50%; + -ms-transform: translateY(50%); + transform: translateY(50%); + max-width: 90%; + min-width: 600px; + margin: 0 auto; +} diff --git a/webinterface.py b/webinterface.py index 8bd95e68..51e95f04 100644 --- a/webinterface.py +++ b/webinterface.py @@ -55,7 +55,7 @@ def htmlLogin(baseDir: str) -> str: loginForm=htmlHeader(loginCSS) loginForm+= \ - '
' \ + '' \ '
' \ ' login image'+ \ loginText+ \ @@ -74,6 +74,31 @@ def htmlLogin(baseDir: str) -> str: loginForm+=htmlFooter() return loginForm +def htmlNewPost(baseDir: str,path: str) -> str: + newPostText='

Enter your post text below.

' + if os.path.isfile(baseDir+'/accounts/newpost.txt'): + with open(baseDir+'/accounts/newpost.txt', 'r') as file: + newPostText = '

'+file.read()+'

' + + with open(baseDir+'/epicyon-profile.css', 'r') as cssFile: + newPostCSS = cssFile.read() + + newPostForm=htmlHeader(newPostCSS) + newPostForm+= \ + '' \ + '
' \ + ' ' \ + ' ' \ + '' \ + ' ' \ + '' \ + ' ' \ + ' ' \ + '
' \ + '' + newPostForm+=htmlFooter() + return newPostForm + def htmlHeader(css=None,lang='en') -> str: if not css: htmlStr= \ @@ -357,6 +382,7 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \ localButton='button' personalButton='button' federatedButton='button' + newPostButton='button' if boxName=='inbox': localButton='buttonselected' elif boxName=='outbox': @@ -366,11 +392,15 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \ actor='/users/'+nickname tlStr=htmlHeader(profileStyle) + newPostStr='' + if boxName=='inbox': + newPostStr=' ' tlStr+= \ '
' \ '
' \ '
\n' \ - '
' \ + '
'+ \ + newPostStr+ \ ' ' \ ' ' \ ' ' \