first setup configuration
Build LinkLog Development Image / development-image (push) Successful in 10s

This commit is contained in:
Olaf
2026-08-25 22:51:17 +02:00
parent 07e520e03f
commit defe7a83a9
10 changed files with 254 additions and 44 deletions
+26
View File
@@ -0,0 +1,26 @@
// Copyright © 2026 Olaf Kolkman
// SPDX-License-Identifier: GPL-3.0-or-later
document.querySelector('#setup-form').addEventListener('submit', async (event) => {
event.preventDefault();
const form = event.currentTarget;
const status = document.querySelector('#setup-status');
const values = Object.fromEntries(new FormData(form));
values.smtp_port = Number(values.smtp_port);
values.smtp_use_tls = form.elements.smtp_use_tls.checked;
try {
const response = await fetch('/api/setup', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(values),
});
const result = await response.json();
if (!response.ok) throw new Error(result.detail || 'Setup failed');
status.textContent = result.message;
status.style.color = '#94e2d5';
form.replaceChildren(status);
} catch (error) {
status.textContent = error.message;
status.style.color = '#f38ba8';
}
});
+45
View File
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<!-- Copyright © 2026 Olaf Kolkman -->
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Configure LinkLog</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/static/style.css" />
</head>
<body>
<header class="site-header">
<div class="container">
<div class="header-row">
<div>
<img class="site-logo" src="/static/logo.svg" alt="LinkLog" />
<h1>Configure LinkLog</h1>
<p>Create the first administrator and test email delivery.</p>
</div>
</div>
</div>
</header>
<main class="container">
<section class="link-item settings-panel">
<form id="setup-form">
<h2>Administrator</h2>
<label>Username<input name="username" type="text" autocomplete="username" required /></label>
<label>Email address<input name="email" type="email" autocomplete="email" required /></label>
<label>Password<input name="password" type="password" autocomplete="new-password" minlength="8" required /></label>
<h2>SMTP</h2>
<label>SMTP host<input name="smtp_host" type="text" required /></label>
<label>SMTP port<input name="smtp_port" type="number" min="1" max="65535" value="587" required /></label>
<label>SMTP username<input name="smtp_username" type="text" autocomplete="off" /></label>
<label>SMTP password<input name="smtp_password" type="password" autocomplete="new-password" /></label>
<label>From address<input name="smtp_from" type="text" value="LinkLog &lt;no-reply@example.com&gt;" required /></label>
<label class="checkbox-label"><input name="smtp_use_tls" type="checkbox" checked /> Use STARTTLS</label>
<button type="submit">Save and send test mail</button>
<p id="setup-status" class="status" role="status"></p>
</form>
</section>
</main>
<footer class="site-footer">Copyright © 2026 Olaf Kolkman</footer>
<script src="/static/setup.js"></script>
</body>
</html>