|
|
|
@ -35,7 +35,14 @@ def help():
|
|
|
|
|
@app.route('/status')
|
|
|
|
|
@requires_auth
|
|
|
|
|
def status():
|
|
|
|
|
return render_template('status.html')
|
|
|
|
|
locked = False
|
|
|
|
|
t = 0
|
|
|
|
|
with open('locked_till.txt', 'rb') as f:
|
|
|
|
|
txt = f.read()
|
|
|
|
|
t = float(txt)
|
|
|
|
|
locked = time.time() < t
|
|
|
|
|
timestring = time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t))
|
|
|
|
|
return render_template('status.html', locked=locked, timestring=timestring)
|
|
|
|
|
|
|
|
|
|
@app.route('/lock-fridge/<duration>')
|
|
|
|
|
@requires_auth
|
|
|
|
@ -49,7 +56,7 @@ def lock_fridge(duration):
|
|
|
|
|
def unlock_fridge():
|
|
|
|
|
with open('locked_till.txt', 'wb') as f:
|
|
|
|
|
f.write('0')
|
|
|
|
|
return '{"success":true}'
|
|
|
|
|
return redirect(url_for('status'))
|
|
|
|
|
|
|
|
|
|
@app.route('/open/<what>')
|
|
|
|
|
@requires_auth
|
|
|
|
|