This commit is contained in:
Rainer 2025-04-29 23:36:37 +02:00
commit ce1095bb24
27 changed files with 621 additions and 0 deletions

30
app/static/js/admin.js Normal file
View file

@ -0,0 +1,30 @@
function systemCommand(cmd) {
fetch(`/admin/${cmd}`, { method: "POST" })
.then(res => res.text())
.then(alert);
}
function fetchLogs() {
fetch("/admin/logs")
.then(res => res.text())
.then(data => {
document.getElementById("logs").innerText = data;
});
}
document.getElementById("adminForm").addEventListener("submit", function(e) {
e.preventDefault();
const data = new FormData(e.target);
const json = {};
for (let [k, v] of data.entries()) {
json[k] = v;
}
json["ziel_aktiviert"] = data.get("ziel_aktiviert") === "on";
fetch("/admin/save", {
method: "POST",
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(json)
}).then(res => res.text())
.then(alert);
});