From 84a97ff52340c965a5490c8f622e24f3f4662f85 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Sat, 20 Jul 2013 06:48:17 +0200 Subject: [PATCH] Custom templates of open/close pages for local display, write a symlink so meta-refresh works. --- .gitignore | 1 + .../supybot/plugins/StratumMonitor/plugin.py | 27 +- server/www/closed-local.html | 17 + server/www/closed.svg | 1602 +++++++++++++++++ server/www/open-local.html | 16 + server/www/open.svg | 1602 +++++++++++++++++ 6 files changed, 3249 insertions(+), 16 deletions(-) create mode 100644 server/www/closed-local.html create mode 100644 server/www/closed.svg create mode 100644 server/www/open-local.html create mode 100644 server/www/open.svg diff --git a/.gitignore b/.gitignore index e5b65db..b6296d8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ server/www/status.html server/www/status.txt server/www/status.json server/www/status.xml +server/www/status-local.html diff --git a/server/supybot/plugins/StratumMonitor/plugin.py b/server/supybot/plugins/StratumMonitor/plugin.py index e04b349..6c8100e 100644 --- a/server/supybot/plugins/StratumMonitor/plugin.py +++ b/server/supybot/plugins/StratumMonitor/plugin.py @@ -138,21 +138,9 @@ class StratumMonitor(callbacks.Plugin): API_ARCHIVE_FILE = API_PATH % "archive.txt" API_ARCHIVE_TEMPLATE = "{{{ACTION}}}: {{{SINCE}}}\r\n" - API_LOCAL_HTML_FILE = API_PATH % "local.html" - API_LOCAL_HTML_TEMPLATE = """ - - - - Stratum 0 Space Status - - - -
-

{{{STATUS}}}

- {{{STATUS}}} -
-""" + LOCAL_HTML_FILE = API_PATH % "status-local.html" + LOCAL_HTML_OPEN_FILE = API_PATH % "open-local.html" + LOCAL_HTML_CLOSED_FILE = API_PATH % "closed-local.html" VERSION = "0.1" ### Bump this for new Open/Close API versions @@ -293,8 +281,15 @@ def writeFiles(self): self.writeFile(self.API_JSON_FILE, self.API_JSON_TEMPLATE) self.writeFile(self.API_XML_FILE, self.API_XML_TEMPLATE) self.writeFile(self.API_HTML_FILE, self.API_HTML_TEMPLATE) - self.writeFile(self.API_LOCAL_HTML_FILE, self.API_LOCAL_HTML_TEMPLATE) self.writeFile(self.API_ARCHIVE_FILE, self.API_ARCHIVE_TEMPLATE, True) + + if(self.isOpen): + r = os.system("rm %s; ln -s %s %s" % (self.LOCAL_HTML_FILE, + self.LOCAL_HTML_OPEN_FILE, self.LOCAL_HTML_FILE)) + else: + r = os.system("rm %s; ln -s %s %s" % (self.LOCAL_HTML_FILE, + self.LOCAL_HTML_CLOSED_FILE, self.LOCAL_HTML_FILE)) + r = os.system("sudo killall -HUP nginx"); # NOTE: must be in sudoers to do that! def spaceopen(self, irc, msg, args, nick): diff --git a/server/www/closed-local.html b/server/www/closed-local.html new file mode 100644 index 0000000..8ce9110 --- /dev/null +++ b/server/www/closed-local.html @@ -0,0 +1,17 @@ + + + + + Stratum 0 Space Status + + + +
+

Es ist zu :-(

+ zu +

Du willst rein?
+ https://stratum0.org/key

+
+ diff --git a/server/www/closed.svg b/server/www/closed.svg new file mode 100644 index 0000000..446d738 --- /dev/null +++ b/server/www/closed.svg @@ -0,0 +1,1602 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/server/www/open-local.html b/server/www/open-local.html new file mode 100644 index 0000000..baf93c6 --- /dev/null +++ b/server/www/open-local.html @@ -0,0 +1,16 @@ + + + + + Stratum 0 Space Status + + + +
+

Es ist offen :-)

+ offen +

Einfach die Tür aufdrücken

+
+ diff --git a/server/www/open.svg b/server/www/open.svg new file mode 100644 index 0000000..8f90b6a --- /dev/null +++ b/server/www/open.svg @@ -0,0 +1,1602 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + +