new web page added and weather api key save added

This commit is contained in:
Neythen Treloar
2022-02-24 18:35:43 +00:00
parent 9c81db3665
commit 3a6eef93fb
50 changed files with 71360 additions and 3095 deletions

View File

@@ -237,16 +237,9 @@ def update():
os.system("sudo reboot now")
return index()
@app.route("/display_format", methods = ['PUT', 'POST', 'GET'])
def display_format():
global professional
data = str(request.data)
if "Standard" in data:
professional = False
elif "Professional" in data:
professional = True
print(professional)
@app.route("/restart", methods=['PUT','POST'])
def restart():
os.system("sudo reboot now")
return index()
@app.route("/save", methods = ['PUT', 'POST', 'GET'])
@@ -447,7 +440,27 @@ def hostname():
json.dump(general_settings, open('csv/general_settings.json', 'w+'))
return index()
@app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST'])
def saveWeatherAPIKey():
data= request.data.decode('utf-8')
settings = json.loads(data)
key = settings['api_key']
print(key)
with open('./api_keys.txt') as f:
lines = f.readlines()
if len(lines) == 1:
lines.append(str(key))
elif len(lines) == 2:
lines[1] = str(key)
print(lines)
with open('./api_keys.txt', 'w') as f:
for line in lines:
f.write(line)
return index()
@app.route("/screensaver", methods = ['PUT', 'POST'])
def screensaver():
@@ -516,7 +529,6 @@ def save_trade_settings(input_settings):
current_settings['percent'] = input_settings['percent']
current_settings['point'] = input_settings['point']
current_settings['logos'] = input_settings['logos']
current_settings['chart'] = input_settings['chart']
current_settings['title'] = input_settings['title']