From 9935b1c6a0e0845f724a9c495caf01977ee81fbb Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Tue, 6 Oct 2026 13:51:24 +1300 Subject: website deploy button --- backend.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'backend.py') diff --git a/backend.py b/backend.py index 2def49c..79dde40 100644 --- a/backend.py +++ b/backend.py @@ -183,5 +183,32 @@ def fav_song(): "artist": "Oxlo" } +@app.get("/automate/zola") +def zola(): + result = subprocess.run( + [ + "sh", "-c", + "cd /srv/www/_src-v3 && " + "git pull && " + "~/.cargo/bin/zola build -o /srv/www/_site-v3 -f" + ], + capture_output=True, + text=True, + ) + + if result.returncode != 0: + print(result.stdout) + print(result.stderr) + return "deployment failed", 500 + + subprocess.Popen([ + "mpv", + "--no-video", + "--audio-device=pipewire", + "/srv/shares/public/Media/done.mp3", + ]) + + return "ok" + if __name__ == "__main__": app.run(host="0.0.0.0", port=6732) -- cgit v1.2.3