Single css file

master
Bob Mottram 2019-07-24 12:03:56 +01:00
parent 9896dffe38
commit 6bea6ceb4b
4 changed files with 42 additions and 131 deletions

View File

@ -344,8 +344,8 @@ class PubServer(BaseHTTPRequestHandler):
# get css
# Note that this comes before the busy flag to avoid conflicts
if self.path.endswith('.css'):
if os.path.isfile('epicyon.css'):
with open('epicyon.css', 'r') as cssfile:
if os.path.isfile('epicyon-profile.css'):
with open('epicyon-profile.css', 'r') as cssfile:
css = cssfile.read()
self._set_headers('text/css')
self.wfile.write(css.encode('utf-8'))
@ -704,8 +704,21 @@ class PubServer(BaseHTTPRequestHandler):
True,self.server.ocapAlways)
if inboxFeed:
if 'text/html' in self.headers['Accept']:
if 'page=' not in self.path:
# if no page was specified then show the first
inboxFeed=personBoxJson(self.server.baseDir, \
self.server.domain, \
self.server.port, \
self.path+'?page=1', \
self.server.httpPrefix, \
maxPostsInFeed, 'inbox', \
True,self.server.ocapAlways)
self._set_headers('text/html')
self.wfile.write(htmlInbox(inboxFeed).encode('utf-8'))
self.wfile.write(htmlInbox(self.server.session, \
self.server.cachedWebfingers, \
self.server.personCache, \
self.server.domain, \
inboxFeed).encode('utf-8'))
else:
self._set_headers('application/json')
self.wfile.write(json.dumps(inboxFeed).encode('utf-8'))
@ -731,8 +744,21 @@ class PubServer(BaseHTTPRequestHandler):
self.server.ocapAlways)
if outboxFeed:
if 'text/html' in self.headers['Accept']:
if 'page=' not in self.path:
# if a page wasn't specified then show the first one
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
self.server.port,self.path+'?page=1', \
self.server.httpPrefix, \
maxPostsInFeed, 'outbox', \
self._isAuthorized(), \
self.server.ocapAlways)
self._set_headers('text/html')
self.wfile.write(htmlOutbox(outboxFeed).encode('utf-8'))
self.wfile.write(htmlOutbox(self.server.session, \
self.server.cachedWebfingers, \
self.server.personCache, \
self.server.domain, \
outboxFeed).encode('utf-8'))
else:
self._set_headers('application/json')
self.wfile.write(json.dumps(outboxFeed).encode('utf-8'))

View File

@ -1,7 +1,9 @@
body, html {
height: 100%;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
max-width: 80%;
min-width: 600px;
margin: 0 auto;
}
.hero-image {

View File

@ -1,121 +0,0 @@
@charset "UTF-8";
body {
margin: 0 auto;
max-width: 80%;
padding: 0 20px;
}
.container {
border: 2px solid #dedede;
background-color: #f1f1f1;
border-radius: 5px;
padding: 10px;
margin: 10px 0;
}
.darker {
border-color: #ccc;
background-color: #ddd;
}
.container::after {
content: "";
clear: both;
display: table;
}
.container img {
float: left;
max-width: 60px;
width: 100%;
margin-right: 20px;
border-radius: 10%;
}
.container img.attachment {
max-width: 100%;
margin-left: 25%;
width: 50%;
border-radius: 10%;
}
.container img.right {
float: right;
margin-left: 20px;
margin-right:0;
}
.time-right {
float: right;
color: #aaa;
}
.time-left {
float: left;
color: #999;
}
.post-title {
margin-top: 0px;
color: #999;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 300px;
margin: auto;
text-align: center;
}
.title {
color: grey;
font-size: 18px;
}
button {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: white;
background-color: #000;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
a {
text-decoration: none;
font-size: 22px;
color: black;
}
button:hover, a:hover {
opacity: 0.7;
}
/* The hero image */
.hero-image {
/* Use "linear-gradient" to add a darken background effect to the image (photographer.jpg). This will make the text easier to read */
/*background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("photographer.jpg");*/
/* Set a specific height */
height: 50%;
/* Position and center the image to scale nicely on all screens */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
/* Place text in the middle of the image */
.hero-text {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}

View File

@ -20,7 +20,7 @@ def htmlHeader(css=None,lang='en') -> str:
'<html lang="'+lang+'">\n' \
' <meta charset="utf-8">\n' \
' <style>\n' \
' @import url("epicyon.css");\n'+ \
' @import url("epicyon-profile.css");\n'+ \
' </style>\n' \
' <body>\n'
else:
@ -298,15 +298,19 @@ def htmlTimeline(session,wfRequest: {},personCache: {}, \
tlStr+=htmlFooter()
return tlStr
def htmlInbox(inboxJson: {}) -> str:
def htmlInbox(session,wfRequest: {},personCache: {}, \
domain: str,inboxJson: {}) -> str:
"""Show the inbox as html
"""
return htmlTimeline(inboxJson)
return htmlTimeline(session,wfRequest,personCache, \
domain,inboxJson)
def htmlOutbox(outboxJson: {}) -> str:
def htmlOutbox(session,wfRequest: {},personCache: {}, \
domain: str,outboxJson: {}) -> str:
"""Show the Outbox as html
"""
return htmlTimeline(outboxJson)
return htmlTimeline(session,wfRequest,personCache, \
domain,outboxJson)
def htmlIndividualPost(session,wfRequest: {},personCache: {}, \
domain: str,postJsonObject: {}) -> str: