changeset 277:0a1c02160e66

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 17 Nov 2015 22:26:35 +0800
parents 74c3ae4e3307 (current diff) 2630995fb973 (diff)
children fd9c6517225e
files web/templog.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/web/config.py	Tue Nov 17 22:26:00 2015 +0800
+++ b/web/config.py	Tue Nov 17 22:26:35 2015 +0800
@@ -31,8 +31,8 @@
     'sensor_fridge_setpoint': 'Setpoint',
     'sensor_fridge_on': 'Cool',
     'sensor_28-0000042cf4dd': "Wort",
-    'sensor_28-0000042cccc4': "Fridge",
-    'sensor_28-0000042c6dbb': "Ambient",
+    'sensor_28-0000042cccc4': "OldFridge",
+    'sensor_28-0000042c6dbb': "Fridge",
     'sensor_internal': "Processor",
     }
 
--- a/web/templog.py	Tue Nov 17 22:26:00 2015 +0800
+++ b/web/templog.py	Tue Nov 17 22:26:35 2015 +0800
@@ -69,6 +69,12 @@
 
 @route('/set/update', method='post')
 def set_update():
+    if not secure.check_user_hash(config.ALLOWED_USERS):
+        # the "Save" button should be disabled if the cert wasn't
+        # good
+        response.status = 403
+        return "No cert, dodginess"
+
     post_json = json.loads(request.forms.data)
 
     csrf_blob = post_json['csrf_blob']
@@ -79,7 +85,7 @@
 
     ret = log.update_params(post_json['params'])
     if not ret is True:
-        response.status = 403
+        response.status = 409 # Conflict
         return ret
         
     return "Good"
@@ -157,6 +163,11 @@
     #var_lookup = environ['mod_ssl.var_lookup']
     #return var_lookup("SSL_SERVER_I_DN_O")
 
+@route('/h')
+def headers():
+    response.set_header('Content-Type', 'text/plain')
+    return '\n'.join("%s: %s" % x for x in request.headers.items())
+
 @route('/get_settings')
 def get_settings():
     response.set_header('Cache-Control', 'no-cache')