From 6bea6ceb4ba7e01c34749965a5e75a8356d0edef Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Jul 2019 12:03:56 +0100 Subject: [PATCH] Single css file --- daemon.py | 34 +++++++++++-- epicyon-profile.css | 4 +- epicyon.css | 121 -------------------------------------------- webinterface.py | 14 +++-- 4 files changed, 42 insertions(+), 131 deletions(-) delete mode 100644 epicyon.css diff --git a/daemon.py b/daemon.py index 1246ef81..a1521175 100644 --- a/daemon.py +++ b/daemon.py @@ -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')) diff --git a/epicyon-profile.css b/epicyon-profile.css index 4b10155f..6ef53a1e 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -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 { diff --git a/epicyon.css b/epicyon.css deleted file mode 100644 index 5ad46366..00000000 --- a/epicyon.css +++ /dev/null @@ -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; -} diff --git a/webinterface.py b/webinterface.py index efa6eacc..74094c48 100644 --- a/webinterface.py +++ b/webinterface.py @@ -20,7 +20,7 @@ def htmlHeader(css=None,lang='en') -> str: '\n' \ ' \n' \ ' \n' \ ' \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: