This commit is contained in:
cay 2026-03-27 15:53:34 +00:00
parent 4a447b7cc7
commit 6f5c9a28a1

View File

@ -1,34 +1,85 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<title><%= title %></title> <title><%= title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style> <style>
body { font-family: Arial, sans-serif; background:#f5f5f5; padding:20px; } body {
.card { max-width: 560px; margin: 0 auto; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); } font-family: Arial, sans-serif;
label { display:block; margin-top: 12px; font-weight: 600; } background: #f5f5f5;
input { width: 100%; padding: 10px; margin-top: 6px; border-radius: 8px; border: 1px solid #ddd; } padding: 20px;
.row { display:flex; gap: 12px; } }
.row > div { flex: 1; } .card {
button { margin-top: 16px; padding: 10px 14px; border: 0; border-radius: 10px; cursor:pointer; } max-width: 560px;
.btn-primary { background:#2563eb; color:white; } margin: 0 auto;
.btn-secondary { background:#111827; color:white; } background: white;
.msg { margin-top: 10px; padding:10px; border-radius: 10px; display:none; } padding: 20px;
.msg.ok { background:#dcfce7; color:#166534; } border-radius: 12px;
.msg.bad { background:#fee2e2; color:#991b1b; } box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
</style> }
</head> label {
<body> display: block;
margin-top: 12px;
font-weight: 600;
}
input {
width: 100%;
padding: 10px;
margin-top: 6px;
border-radius: 8px;
border: 1px solid #ddd;
}
.row {
display: flex;
gap: 12px;
}
.row > div {
flex: 1;
}
button {
margin-top: 16px;
padding: 10px 14px;
border: 0;
border-radius: 10px;
cursor: pointer;
}
.btn-primary {
background: #2563eb;
color: white;
}
.btn-secondary {
background: #111827;
color: white;
}
.msg {
margin-top: 10px;
padding: 10px;
border-radius: 10px;
display: none;
}
.msg.ok {
background: #dcfce7;
color: #166534;
}
.msg.bad {
background: #fee2e2;
color: #991b1b;
}
</style>
</head>
<body>
<div class="card">
<h2>🛠️ Erstinstallation</h2>
<p>
Bitte DB Daten eingeben. Danach wird
<code>config.enc</code> gespeichert.
</p>
<div class="card"> <form method="POST" action="/setup">
<h2>🛠️ Erstinstallation</h2>
<p>Bitte DB Daten eingeben. Danach wird <code>config.enc</code> gespeichert.</p>
<form method="POST" action="/setup">
<label>DB Host</label> <label>DB Host</label>
<input name="host" placeholder="192.168.0.86" required /> <input name="host" placeholder="85.215.63.122" required />
<label>DB Port</label> <label>DB Port</label>
<input name="port" placeholder="3306" value="3306" required /> <input name="port" placeholder="3306" value="3306" required />
@ -42,43 +93,51 @@
<label>DB Name</label> <label>DB Name</label>
<input name="name" placeholder="praxissoftware" required /> <input name="name" placeholder="praxissoftware" required />
<label>Passwort</label> <label>Passwort</label>
<input name="password" type="password" value="<%= defaults.password %>" /> <input
name="password"
type="password"
value="<%= defaults.password %>"
/>
<button type="button" class="btn-secondary" onclick="testConnection()">🔍 Verbindung testen</button> <button type="button" class="btn-secondary" onclick="testConnection()">
<button type="submit" class="btn-primary">✅ Speichern & Setup abschließen</button> 🔍 Verbindung testen
</button>
<button type="submit" class="btn-primary">
✅ Speichern & Setup abschließen
</button>
<div id="msg" class="msg"></div> <div id="msg" class="msg"></div>
</form> </form>
</div> </div>
<script> <script>
async function testConnection() { async function testConnection() {
const form = document.querySelector("form"); const form = document.querySelector("form");
const data = new FormData(form); const data = new FormData(form);
const body = Object.fromEntries(data.entries()); const body = Object.fromEntries(data.entries());
const msg = document.getElementById("msg"); const msg = document.getElementById("msg");
msg.style.display = "block"; msg.style.display = "block";
msg.className = "msg"; msg.className = "msg";
msg.textContent = "Teste Verbindung..."; msg.textContent = "Teste Verbindung...";
try { try {
const res = await fetch("/setup/test", { const res = await fetch("/setup/test", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify(body) body: JSON.stringify(body),
}); });
const json = await res.json(); const json = await res.json();
msg.textContent = json.message; msg.textContent = json.message;
if (json.ok) msg.classList.add("ok"); if (json.ok) msg.classList.add("ok");
else msg.classList.add("bad"); else msg.classList.add("bad");
} catch (e) { } catch (e) {
msg.textContent = "❌ Fehler: " + e.message; msg.textContent = "❌ Fehler: " + e.message;
msg.classList.add("bad"); msg.classList.add("bad");
}
} }
} </script>
</script> </body>
</body>
</html> </html>