forked from indymedia/epicyon
New post scope
parent
96ef34eb77
commit
1c8ab532bc
13
daemon.py
13
daemon.py
|
@ -383,7 +383,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# if not authorized then show the login screen
|
# if not authorized then show the login screen
|
||||||
if self.headers.get('Accept'):
|
if self.headers.get('Accept'):
|
||||||
if 'text/html' in self.headers['Accept'] and self.path!='/login':
|
if 'text/html' in self.headers['Accept'] and self.path!='/login':
|
||||||
if '/media/' not in self.path and 'sharefiles' not in self.path:
|
if '/media/' not in self.path and \
|
||||||
|
'/sharefiles/' not in self.path and \
|
||||||
|
'/icons/' not in self.path:
|
||||||
if not authorized:
|
if not authorized:
|
||||||
self.send_response(303)
|
self.send_response(303)
|
||||||
self.send_header('Location', '/login')
|
self.send_header('Location', '/login')
|
||||||
|
@ -466,7 +468,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
# icon images
|
# icon images
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
if '/icons/' in self.path:
|
if self.path.startswith('/icons/'):
|
||||||
if self.path.endswith('.png'):
|
if self.path.endswith('.png'):
|
||||||
mediaStr=self.path.split('/icons/')[1]
|
mediaStr=self.path.split('/icons/')[1]
|
||||||
mediaFilename= \
|
mediaFilename= \
|
||||||
|
@ -538,7 +540,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
if '/users/' in self.path and self.path.endswith('/newpost'):
|
if '/users/' in self.path and \
|
||||||
|
(self.path.endswith('/newpost') or \
|
||||||
|
self.path.endswith('/newunlisted') or \
|
||||||
|
self.path.endswith('/newfollowers') or \
|
||||||
|
self.path.endswith('/newdm') or \
|
||||||
|
self.path.endswith('/newshare')):
|
||||||
self._login_headers('text/html')
|
self._login_headers('text/html')
|
||||||
self.wfile.write(htmlNewPost(self.server.baseDir,self.path).encode('utf-8'))
|
self.wfile.write(htmlNewPost(self.server.baseDir,self.path).encode('utf-8'))
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
|
|
|
@ -264,37 +264,51 @@ input[type=submit]:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropbtn {
|
.dropbtn {
|
||||||
background-color: #555;
|
opacity: 1.0;
|
||||||
color: white;
|
|
||||||
padding: 12px 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The container <div> - needed to position the dropdown content */
|
/* The container <div> - needed to position the dropdown content */
|
||||||
.dropdown {
|
.dropdown {
|
||||||
position: relative;
|
padding: 0px 14px;
|
||||||
display: inline-block;
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown img {
|
||||||
|
opacity: 1.0;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0px 16px;
|
||||||
|
-ms-transform: translateY(-10%);
|
||||||
|
transform: translateY(-10%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scope-desc {
|
||||||
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dropdown Content (Hidden by Default) */
|
/* Dropdown Content (Hidden by Default) */
|
||||||
.dropdown-content {
|
.dropdown-content {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #f1f1f1;
|
background-color: #f1f1f1;
|
||||||
min-width: 260px;
|
min-width: 300px;
|
||||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Links inside the dropdown */
|
/* Links inside the dropdown */
|
||||||
.dropdown-content a {
|
.dropdown-content a {
|
||||||
color: black;
|
color: black;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: block;
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-content img {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change color of dropdown links on hover */
|
/* Change color of dropdown links on hover */
|
||||||
|
|
|
@ -83,26 +83,47 @@ def htmlNewPost(baseDir: str,path: str) -> str:
|
||||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||||
newPostCSS = cssFile.read()
|
newPostCSS = cssFile.read()
|
||||||
|
|
||||||
|
pathBase=path.replace('/newpost','').replace('/newshare','').replace('/newunlisted','').replace('/newfollowers','').replace('/newdm','')
|
||||||
|
|
||||||
|
scopeIcon='scope_public.png'
|
||||||
|
scopeDescription='Public'
|
||||||
|
placeholderSubject='Subject or Content Warning (optional)...'
|
||||||
|
placeholderMessage='Write something...'
|
||||||
|
if path.endswith('/newunlisted'):
|
||||||
|
scopeIcon='scope_unlisted.png'
|
||||||
|
scopeDescription='Unlisted'
|
||||||
|
if path.endswith('/newfollowers'):
|
||||||
|
scopeIcon='scope_followers.png'
|
||||||
|
scopeDescription='Followers Only'
|
||||||
|
if path.endswith('/newdm'):
|
||||||
|
scopeIcon='scope_dm.png'
|
||||||
|
scopeDescription='Direct Message'
|
||||||
|
if path.endswith('/newshare'):
|
||||||
|
scopeIcon='scope_share.png'
|
||||||
|
scopeDescription='Shared Item'
|
||||||
|
placeholderSubject='Name of the shared item...'
|
||||||
|
placeholderMessage='Description of the item being shared...'
|
||||||
|
|
||||||
newPostForm=htmlHeader(newPostCSS)
|
newPostForm=htmlHeader(newPostCSS)
|
||||||
newPostForm+= \
|
newPostForm+= \
|
||||||
'<form method="POST" action="'+path+'?newpost">' \
|
'<form method="POST" action="'+path+'?newpost">' \
|
||||||
' <div class="vertical-center">' \
|
' <div class="vertical-center">' \
|
||||||
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
||||||
' <input type="text" placeholder="Subject or Content Warning (optional)..." name="subject">' \
|
' <input type="text" placeholder="'+placeholderSubject+'" name="subject">' \
|
||||||
'' \
|
'' \
|
||||||
' <textarea id="message" name="message" placeholder="Write something..." style="height:200px"></textarea>' \
|
' <textarea id="message" name="message" placeholder="'+placeholderMessage+'" style="height:200px"></textarea>' \
|
||||||
'' \
|
'' \
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
' <input type="submit" value="Cancel">' \
|
' <input type="submit" value="Cancel">' \
|
||||||
' <input type="submit" value="Submit">' \
|
' <input type="submit" value="Submit">' \
|
||||||
' <div class="dropdown">' \
|
' <div class="dropdown">' \
|
||||||
' <button class="dropbtn">Scope</button>' \
|
' <img src="/icons/'+scopeIcon+'"/><b class="scope-desc">'+scopeDescription+'</b>' \
|
||||||
' <div class="dropdown-content">' \
|
' <div class="dropdown-content">' \
|
||||||
' <a href="#"><img="/icons/scope_public.png"/><b>Public</b><br>Visible to anyone</a>' \
|
' <a href="'+pathBase+'/newpost"><img src="/icons/scope_public.png"/><b>Public</b><br>Visible to anyone</a>' \
|
||||||
' <a href="#"><img="/icons/scope_unlisted.png"/><b>Unlisted</b><br>Not shown on public timeline</a>' \
|
' <a href="'+pathBase+'/newunlisted"><img src="/icons/scope_unlisted.png"/><b>Unlisted</b><br>Not on public timeline</a>' \
|
||||||
' <a href="#"><img="/icons/scope_followers.png"/><b>Followers Only</b><br>Only sent to followers</a>' \
|
' <a href="'+pathBase+'/newfollowers"><img src="/icons/scope_followers.png"/><b>Followers Only</b><br>Only to followers</a>' \
|
||||||
' <a href="#"><img="/icons/scope_dm.png"/><b>Direct Message</b><br>Sent only to mentioned people</a>' \
|
' <a href="'+pathBase+'/newdm"><img src="/icons/scope_dm.png"/><b>Direct Message</b><br>Only to mentioned people</a>' \
|
||||||
' <a href="#"><img="/icons/scope_offer.png"/><b>Offer</b><br>Describe a shared item</a>' \
|
' <a href="'+pathBase+'/newshare"><img src="/icons/scope_share.png"/><b>Share</b><br>Describe a shared item</a>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
|
|
Loading…
Reference in New Issue