first commit

This commit is contained in:
2025-12-06 07:47:30 +00:00
commit 17a0bf05cc
23 changed files with 1458 additions and 0 deletions

31
templates/base.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ with .PageData }}{{ .Title }}{{ end }} - {{ .AppName }}</title>
<link href="/static/tailwind.css" rel="stylesheet">
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen flex flex-col">
<header class="bg-gray-800 p-4">
<nav class="flex justify-between">
<a href="/" class="text-xl font-bold">{{ .AppName }}</a>
{{ if .Authenticated }}
<ul class="flex space-x-4">
<li><a href="/urllists">URL Lists</a></li>
<li><a href="/domains">Domains</a></li>
<li><a href="/logs">Logs</a></li>
<li><a href="/profile">Profile</a></li>
<li><a href="/logout">Logout</a></li>
</ul>
{{ end }}
</nav>
</header>
<main class="flex-grow container mx-auto p-4">
{{ block "content" . }}{{ end }}
</main>
<footer class="bg-gray-800 p-4 text-center">
&copy; 2025 {{ .AppName }}
</footer>
</body>
</html>

8
templates/dashboard.html Normal file
View File

@@ -0,0 +1,8 @@
{{ define "content" }}
<h1 class="text-2xl mb-4">Dashboard</h1>
<p>Welcome to Unifi Custom Blocklist Manager.</p>
<form method="POST" action="/apply">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<button type="submit" class="bg-green-600 p-2 rounded">Apply Changes</button>
</form>
{{ end }}

28
templates/domains.html Normal file
View File

@@ -0,0 +1,28 @@
{{ define "content" }}
<h1 class="text-2xl mb-4">Domains</h1>
<form method="GET" class="mb-4">
<input type="text" name="query" placeholder="Search (use * for wildcard)" value="{{ with .PageData }}{{ .Query }}{{ end }}" class="p-2 bg-gray-700 rounded">
<button type="submit" class="bg-blue-600 p-2 rounded">Search</button>
</form>
<form method="POST" class="mb-4">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<input type="hidden" name="action" value="add">
<input type="text" name="domain" placeholder="Add Domain" class="p-2 bg-gray-700 rounded">
<button type="submit" class="bg-green-600 p-2 rounded">Add</button>
</form>
<ul class="space-y-2">
{{ with .PageData }}
{{ range .Domains }}
<li class="flex justify-between bg-gray-800 p-2 rounded">
{{ . }}
<form method="POST" class="inline">
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
<input type="hidden" name="action" value="remove">
<input type="hidden" name="domain" value="{{ . }}">
<button type="submit" class="bg-red-600 p-1 rounded">Remove</button>
</form>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

9
templates/login.html Normal file
View File

@@ -0,0 +1,9 @@
{{ define "content" }}
<form method="POST" class="max-w-md mx-auto bg-gray-800 p-6 rounded">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<input type="text" name="username" placeholder="Username" class="w-full mb-4 p-2 bg-gray-700 rounded" required>
<input type="password" name="password" placeholder="Password" class="w-full mb-4 p-2 bg-gray-700 rounded" required>
<input type="text" name="mfa_code" placeholder="MFA Code (if enabled)" class="w-full mb-4 p-2 bg-gray-700 rounded">
<button type="submit" class="w-full bg-blue-600 p-2 rounded">Login</button>
</form>
{{ end }}

6
templates/mfa_setup.html Normal file
View File

@@ -0,0 +1,6 @@
{{ define "content" }}
<h1 class="text-2xl mb-4">MFA Setup</h1>
<p>MFA Secret: {{ with .PageData }}{{ .MFASecret }}{{ end }}</p>
<p>OTP URL: {{ with .PageData }}{{ .OTPURL }}{{ end }}</p>
<p>Use a QR code generator with the OTP URL or enter the secret in your authenticator app.</p>
{{ end }}

17
templates/profile.html Normal file
View File

@@ -0,0 +1,17 @@
{{ define "content" }}
<h1 class="text-2xl mb-4">Profile</h1>
{{ with .PageData }}
<div class="bg-gray-800 p-4 rounded mb-4">
<p class="mb-2"><strong>Username:</strong> admin</p>
<p class="mb-2">
<strong>MFA Status:</strong>
{{ if .MFAEnabled }}
<span class="text-green-400">Enabled</span>
{{ else }}
<span class="text-yellow-400">Disabled</span>
{{ end }}
</p>
<p class="text-sm text-gray-400 mt-4">To manage MFA or change password, use the command-line interface with the executable flags.</p>
</div>
{{ end }}
{{ end }}

32
templates/urllists.html Normal file
View File

@@ -0,0 +1,32 @@
{{ define "content" }}
<h1 class="text-2xl mb-4">URL Lists</h1>
<form method="POST" class="mb-4">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<input type="hidden" name="action" value="add">
<input type="text" name="url" placeholder="Add URL" class="p-2 bg-gray-700 rounded">
<button type="submit" class="bg-blue-600 p-2 rounded">Add</button>
</form>
<ul class="space-y-2">
{{ with .PageData }}
{{ range $i, $url := .URLs }}
<li class="flex justify-between bg-gray-800 p-2 rounded">
{{ $url }}
<div>
<form method="POST" class="inline">
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
<input type="hidden" name="action" value="toggle">
<input type="hidden" name="index" value="{{ $i }}">
<button type="submit" class="bg-yellow-600 p-1 rounded">Toggle</button>
</form>
<form method="POST" class="inline">
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
<input type="hidden" name="action" value="remove">
<input type="hidden" name="index" value="{{ $i }}">
<button type="submit" class="bg-red-600 p-1 rounded">Remove</button>
</form>
</div>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}