mirror of https://gitlab.com/bashrc2/epicyon
New post screen
parent
abb010589a
commit
5e0a7e90ca
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ def htmlLogin(baseDir: str) -> str:
|
|||
|
||||
loginForm=htmlHeader(loginCSS)
|
||||
loginForm+= \
|
||||
' <form method="POST" action="/login">' \
|
||||
'<form method="POST" action="/login">' \
|
||||
' <div class="imgcontainer">' \
|
||||
' <img src="login.png" alt="login image" class="loginimage">'+ \
|
||||
loginText+ \
|
||||
|
@ -74,6 +74,31 @@ def htmlLogin(baseDir: str) -> str:
|
|||
loginForm+=htmlFooter()
|
||||
return loginForm
|
||||
|
||||
def htmlNewPost(baseDir: str,path: str) -> str:
|
||||
newPostText='<p class="new-post-text">Enter your post text below.</p>'
|
||||
if os.path.isfile(baseDir+'/accounts/newpost.txt'):
|
||||
with open(baseDir+'/accounts/newpost.txt', 'r') as file:
|
||||
newPostText = '<p class="new-post-text">'+file.read()+'</p>'
|
||||
|
||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||
newPostCSS = cssFile.read()
|
||||
|
||||
newPostForm=htmlHeader(newPostCSS)
|
||||
newPostForm+= \
|
||||
'<form method="POST" action="'+path+'?newpost">' \
|
||||
' <div class="vertical-center">' \
|
||||
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
||||
' <input type="text" placeholder="Subject or Content Warning (optional)..." name="subject">' \
|
||||
'' \
|
||||
' <textarea id="message" name="message" placeholder="Write something..." style="height:200px"></textarea>' \
|
||||
'' \
|
||||
' <input type="submit" value="Cencel">' \
|
||||
' <input type="submit" value="Submit">' \
|
||||
' </div>' \
|
||||
'</form>'
|
||||
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=' <a href="'+actor+'/newpost"><button class="'+newPostButton+'"><span>New Post </span></button></a>'
|
||||
tlStr+= \
|
||||
'<div class="timeline-banner">' \
|
||||
'</div>' \
|
||||
'<div class="container">\n' \
|
||||
' <center>' \
|
||||
' <center>'+ \
|
||||
newPostStr+ \
|
||||
' <a href="'+actor+'/inbox"><button class="'+localButton+'"><span>Local </span></button></a>' \
|
||||
' <a href="'+actor+'/outbox"><button class="'+personalButton+'"><span>Personal </span></button></a>' \
|
||||
' <a href="'+actor+'/federated"><button class="'+federatedButton+'"><span>Federated </span></button></a>' \
|
||||
|
|
Loading…
Reference in New Issue