save custom msg to json after clicking add
This commit is contained in:
parent
6b7913aa97
commit
c394a216cd
19
server.py
19
server.py
@ -1533,6 +1533,25 @@ def fetch_custom_msg():
|
||||
return (the_info)
|
||||
|
||||
|
||||
@app.route("/sendMsgToJSON", methods = ['PUT', 'POST'])
|
||||
def sendMsgToJSON():
|
||||
|
||||
data= request.data.decode('utf-8')
|
||||
input_settings = json.loads(data)
|
||||
|
||||
if input_settings['name'] != '' and input_settings['text'] != '':
|
||||
try:
|
||||
with open('csv/message_settings.json','r') as f:
|
||||
message_settings = json.load(f)
|
||||
except:
|
||||
message_settings = {"feature": "Custom Messages", "speed": "medium", "speed2": "medium", "animation": "down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic!", "text_colour": "White", "size": "Large", "background_colour": "Black"}, {"name": "get_started", "text": "To get started, connect your device to the \"Fintic Hotspot\" and access \"fintic.local:1024\" on your web browser. You can connect your ticker to Wi-Fi there.", "text_colour": "White", "size": "Small", "background_colour": "Black"}]}
|
||||
message_settings['messages'].append(input_settings)
|
||||
with open('csv/message_settings.json', 'w') as f:
|
||||
json.dump(message_settings, f)
|
||||
|
||||
return index()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
app.run(host='0.0.0.0', port=1024, debug=False) # the debuggger causes flickering
|
||||
|
Loading…
Reference in New Issue
Block a user