feat: complete go rewrite

This commit is contained in:
Blake Ridgway
2025-11-12 19:18:29 -06:00
parent 9d78f1fdb4
commit cb3293c7b0
26 changed files with 1286 additions and 531 deletions

55
web/static/css/style.css Normal file
View File

@@ -0,0 +1,55 @@
body {
font-family: Arial, sans-serif;
padding: 20px;
}
table {
border-collapse: collapse;
width: 100%;
}
th,
td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
a {
margin-right: 10px;
}
form {
max-width: 600px;
margin: 0 auto;
}
label {
display: block;
margin-top: 15px;
}
input[type="text"],
input[type="password"],
textarea {
width: 100%;
padding: 8px;
}
button {
margin-top: 15px;
padding: 10px 20px;
}
.flash {
background-color: #f8d7da;
color: #721c24;
padding: 10px;
margin-bottom: 10px;
text-align: center;
}

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Admin Panel - Subscribers</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #4CAF50; color: white; }
.btn { padding: 10px 20px; margin: 5px; cursor: pointer; }
.btn-primary { background-color: #4CAF50; color: white; }
.btn-logout { background-color: #f44336; color: white; }
</style>
</head>
<body>
<h1>Admin Panel</h1>
<a href="/logout" class="btn btn-logout">Logout</a>
<a href="/send_update" class="btn btn-primary">Send Update</a>
<h2>Subscribers ({{ len .emails }})</h2>
<table>
<tr>
<th>Email</th>
</tr>
{{ range .emails }}
<tr>
<td>{{ . }}</td>
</tr>
{{ end }}
</table>
</body>
</html>

28
web/templates/login.html Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Admin Login</title>
<style>
body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; }
.login-container { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); width: 300px; }
h1 { text-align: center; }
input { width: 100%; padding: 10px; margin: 10px 0; box-sizing: border-box; }
button { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background-color: #45a049; }
.error { color: red; margin: 10px 0; }
</style>
</head>
<body>
<div class="login-container">
<h1>Admin Login</h1>
{{ if .error }}
<div class="error">{{ .error }}</div>
{{ end }}
<form method="POST">
<input type="text" name="username" placeholder="Username" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title>Send Update</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.container { max-width: 800px; margin: 0 auto; }
textarea { width: 100%; padding: 10px; }
input { width: 100%; padding: 10px; margin: 10px 0; box-sizing: border-box; }
button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; }
button:hover { background-color: #45a049; }
.message { padding: 10px; margin: 10px 0; border-radius: 4px; }
.success { background-color: #d4edda; color: #155724; }
.error { background-color: #f8d7da; color: #721c24; }
a { margin-right: 10px; }
</style>
</head>
<body>
<div class="container">
<h1>Send Newsletter Update</h1>
<a href="/">Back to Subscribers</a>
<a href="/logout">Logout</a>
{{ if .success }}
<div class="message success">{{ .success }}</div>
{{ end }}
{{ if .error }}
<div class="message error">{{ .error }}</div>
{{ end }}
<form method="POST">
<label for="subject">Subject:</label>
<input type="text" id="subject" name="subject" required>
<label for="body">Message:</label>
<textarea id="body" name="body" rows="10" required></textarea>
<button type="submit">Send to All Subscribers</button>
</form>
</div>
</body>
</html>