diff --git a/display_images/Crypto.ppm b/display_images/Crypto.ppm index 52a78ba..fcdf9be 100755 Binary files a/display_images/Crypto.ppm and b/display_images/Crypto.ppm differ diff --git a/display_images/Forex.ppm b/display_images/Forex.ppm index 8c672b4..adfdbc0 100755 Binary files a/display_images/Forex.ppm and b/display_images/Forex.ppm differ diff --git a/server.py b/server.py index 32a1d2b..8ce04b4 100644 --- a/server.py +++ b/server.py @@ -307,7 +307,16 @@ def wifi(): os.system('wpa_cli -i wlan0 reconfigure') return index() +@app.route("/hostname", methods = ['PUT', 'POST', 'GET']) +def hostname(): + data= request.data.decode('utf-8') + settings = json.loads(data) + hostname = settings['hostname'] + print('hostname', hostname) + os.system("sudo hostnamectl set-hostname {}".format(hostname)) + os.system("sudo systemctl restart avahi-daemon") + return index() @app.route("/screensaver", methods = ['PUT', 'POST']) @@ -477,6 +486,10 @@ def save_message_settings(input_settings): def shutdown(): os.system("sudo shutdown now") return index() + + + + @app.route("/matrix") def matrix(): diff --git a/static/app.js b/static/app.js index 3d1b8a9..3c9e56b 100644 --- a/static/app.js +++ b/static/app.js @@ -1309,6 +1309,13 @@ let hostNameText = document.getElementById("host-name"); hostNameBtn.addEventListener("click", () => { hostNameText.innerText = hostNameInput.value; localStorage.setItem("hostName", hostNameText.innerText); + + data = {hostname:hostNameText.innerText} + + fetch("/hostname", { + method: "POST", + body: JSON.stringify(data), + }); }); // change brightness