Enhance API functionality: add token generation methods, implement entry management, and improve setup process with settings storage

This commit is contained in:
marc-go committed 2026-10-06 14:46:25 +02:00
1 parent 8ef5f7a941
commit 9316818753
9 files changed
+248 -25

No files matched your search

+26 -5
View File
@@ -66,6 +66,18 @@
<md-filled-button id="close-button">Close</md-filled-button>
</div>
</md-dialog>
<md-dialog id="success-dialog">
<div slot="headline">
Success!
</div>
<form slot="content" method="dialog" id="error-dialog-text">
Your Guestbook is finaly configurated! You can find the admin Panel on <span id="success-admin-url"></span>.
</form>
<div slot="actions">
<md-filled-button id="success-dialog-home">Open Guestbook</md-filled-button>
<md-filled-button id="success-dialog-admin">Open Admin Panel</md-filled-button>
</div>
</md-dialog>
<script>
if (window.location.protocol == "http:") {
document.getElementById("http-dialog").setAttribute("open", "");
@@ -80,7 +92,15 @@
document.getElementById("close-button").addEventListener("click", function() {
document.getElementById("error-dialog").removeAttribute("open");
})
});
document.getElementById("success-dialog-home").addEventListener("click", function() {
window.location.reload();
});
document.getElementById("success-dialog-admin").addEventListener("click", function() {
window.location.href = "/admin";
});
function checkSetup() {
const username = document.getElementById("setup-username").value;
@@ -108,14 +128,15 @@
}
})
.then(response => response.json())
.then(data => function() {
if (data.status !== 200) {
.then(data => {
if (data.status == 200) {
document.getElementById("success-admin-url").innerHTML = window.location.href + "admin";
document.getElementById("success-dialog").setAttribute("open", "");
}else{
console.error("Server returned following message: " + data.error);
document.getElementById("error-dialog-text").innerHTML = data.display_error;
document.getElementById("error-dialog").setAttribute("open", "");
}else{
alert("Tres bien!");
}
})
}