Commit 961c6df6 authored by mik's avatar mik

add redirect to open/close in wiki

parent 7b465977
...@@ -38,6 +38,7 @@ class MyHandler(BaseHTTPRequestHandler): ...@@ -38,6 +38,7 @@ class MyHandler(BaseHTTPRequestHandler):
client.end_headers() client.end_headers()
def do_GET(self): def do_GET(self):
global r
if self.path == "/": if self.path == "/":
self.send_response(200) self.send_response(200)
self.send_header("Content-type", "application/json") self.send_header("Content-type", "application/json")
...@@ -46,6 +47,14 @@ class MyHandler(BaseHTTPRequestHandler): ...@@ -46,6 +47,14 @@ class MyHandler(BaseHTTPRequestHandler):
self.wfile.write(str.encode(generate_hackerspaceapi_json())) self.wfile.write(str.encode(generate_hackerspaceapi_json()))
except BrokenPipeError: except BrokenPipeError:
pass pass
elif self.path == "/openstatus":
self.send_response(302)
if str(r.get('devlol/h19/door/lockstatus'),'utf-8') == 'UNLOCKED':
self.send_header('Location','https://devlol.org/wiki/DevLoL?action=AttachFile&do=get&target=open.png')
else:
self.send_header('Location','https://devlol.org/wiki/DevLoL?action=AttachFile&do=get&target=closed.png')
self.end_headers()
def on_message(client, userdata, msg): def on_message(client, userdata, msg):
global r global r
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment