Commit 85c6f9c1 authored by Nelso Jost's avatar Nelso Jost

NEW: added api route for getting board hash

parent 05693459
......@@ -14,6 +14,32 @@ from datetime import datetime
def JSONError(message):
return jsonify({'Error': message})
@api.route('/get/boardhash', methods=['POST'])
def get_boardhash():
if not request.json:
return JSONError("Request does not have a valid JSON attribute.")
js = request.json
if type(js) is str:
js = json.loads(js)
board = Board.get(int(js['board_id']))
return JSONError("Missing or invalid 'board_id' attribute.")
user_checked = board.user.verify_password(js['user_password'])
return JSONError("Missing or invalid 'user_password' attribute.")
if user_checked:
return jsonify({'board_hash': board._userhash})
return JSONError("Invalid 'user_password'.")
@api.route('/post/rawsensordata', methods=['POST'])
def post_rawsensordata():
''' Expects a request with valid JSON attribute containing sensor data.
......@@ -73,7 +73,7 @@
"{{ + '_graphdiv' }}"),
{{ board.get_dygraph_data(|safe }},
{labelsUTC: true,
{labelsUTC: false,
labels: ["Data", "{{ }}"]
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