added graps

This commit is contained in:
2026-09-19 12:46:23 +05:00
parent b5593fa7f4
commit bd973a641c
16 changed files with 735 additions and 1508 deletions
+60 -397
View File
@@ -1,445 +1,108 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parental Control</title>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
background: #f4f5f7;
color: #1f2937;
}
header {
background: #111827;
color: white;
padding: 20px 30px;
}
header h1 {
margin: 0;
font-size: 24px;
}
main {
max-width: 1100px;
margin: 30px auto;
padding: 0 20px;
}
.topbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 25px;
}
.topbar h2 {
margin: 0;
}
.card {
background: white;
border-radius: 12px;
padding: 20px;
margin-bottom: 15px;
box-shadow:
0 2px 8px rgba(0, 0, 0, 0.08);
}
.user-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.username {
font-size: 20px;
font-weight: 600;
}
.status {
display: inline-block;
padding: 5px 10px;
border-radius: 20px;
font-size: 13px;
}
.status-enabled {
background: #dcfce7;
color: #166534;
}
.status-disabled {
background: #fee2e2;
color: #991b1b;
}
.actions {
display: flex;
gap: 10px;
margin-top: 15px;
flex-wrap: wrap;
}
button {
border: 0;
border-radius: 7px;
padding: 9px 15px;
cursor: pointer;
font-size: 14px;
}
.button-primary {
background: #2563eb;
color: white;
}
.button-danger {
background: #dc2626;
color: white;
}
.button-secondary {
background: #e5e7eb;
color: #111827;
}
.add-user {
margin-top: 30px;
}
.add-user form {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
input {
border: 1px solid #d1d5db;
border-radius: 7px;
padding: 9px 12px;
font-size: 14px;
}
.empty {
color: #6b7280;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f4f5f7; color: #1f2937; }
header { background: #111827; color: white; padding: 20px 30px; }
header h1 { margin: 0; font-size: 24px; }
main { max-width: 1100px; margin: 30px auto; padding: 0 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; gap: 15px; }
.card { background: white; border-radius: 12px; padding: 20px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.user-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; }
.username { font-size: 20px; font-weight: 600; }
.muted { color: #6b7280; font-size: 14px; }
.status { display: inline-block; padding: 5px 10px; border-radius: 20px; font-size: 13px; }
.status-enabled { background: #dcfce7; color: #166534; }
.status-locked { background: #fee2e2; color: #991b1b; }
.actions { display: flex; gap: 10px; margin-top: 15px; flex-wrap: wrap; }
button, .button { border: 0; border-radius: 7px; padding: 9px 15px; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; }
.button-primary { background: #2563eb; color: white; }
.button-danger { background: #dc2626; color: white; }
.button-secondary { background: #e5e7eb; color: #111827; }
.add-user form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input, select { border: 1px solid #d1d5db; border-radius: 7px; padding: 9px 12px; font-size: 14px; background: white; }
select { min-width: 320px; }
.empty { color: #6b7280; }
.info { margin-top: 10px; padding: 12px 14px; background: #eff6ff; border-radius: 8px; color: #1e40af; font-size: 14px; }
@media (max-width: 700px) { select { min-width: 100%; } }
</style>
</head>
<body>
<header>
<h1>
Parental Control
</h1>
<div style="margin-top:8px;font-size:14px;">Signed in as <strong>{{ username }}</strong>
<h1>Parental Control</h1>
<div style="margin-top:8px;font-size:14px;">
Signed in as <strong>{{ username }}</strong>
<form method="post" action="/logout" style="display:inline;margin-left:12px;">
<input type="hidden" name="csrf" value="{{ csrf_token }}">
<input type="hidden" name="csrf" value="{{ csrf_token }}">
<button type="submit" class="button-secondary">Log out</button>
</form>
</div>
</header>
<main>
<div class="topbar">
<h2>
Users
</h2>
<div>
<h2 style="margin:0;">Users</h2>
<div class="muted" style="margin-top:6px;">Configure Linux accounts controlled by this service.</div>
</div>
</div>
{% if users %}
{% for user in users %}
<div class="card">
<div class="user-header">
<div>
<div class="username">
{{ user.username }}
</div>
<div>
Linux user ID:
{{ user.id }}
</div>
<div class="username">{{ user.username }}</div>
<div class="muted">Application user ID: {{ user.id }}</div>
</div>
{% if user.enabled %}
<span class="status status-enabled">
Enabled
</span>
{% else %}
<span class="status status-disabled">
Disabled
</span>
<span class="status status-enabled">Enabled</span>
{% endif %}
</div>
<div class="actions">
<a
href="/admin/users/{{ user.id }}"
>
<button
class="button-primary"
type="button"
>
Manage
</button>
</a>
<form
method="post"
action="/admin/users/{{ user.id }}/delete"
>
<a class="button button-primary" href="/admin/users/{{ user.id }}">Manage</a>
<form method="post" action="/admin/users/{{ user.id }}/delete">
<input type="hidden" name="csrf" value="{{ csrf_token }}">
<button
class="button-danger"
type="submit"
>
Delete
</button>
<button class="button-danger" type="submit" onclick="return confirm('Remove this user from parental control?');">Delete</button>
</form>
</div>
</div>
{% endfor %}
{% else %}
<div class="card empty">
No users configured yet.
</div>
<div class="card empty">No users configured yet.</div>
{% endif %}
<div class="card add-user">
<h2 style="margin-top:0;">Add User</h2>
<p class="muted">Select an existing regular Linux account. Root, system accounts, and accounts with standard sudo/wheel access are excluded.</p>
<h2>
Add User
</h2>
<p>
Add an existing Linux account to
parental control.
</p>
<form
method="post"
action="/admin/users"
>
<input type="hidden" name="csrf" value="{{ csrf_token }}">
<input
type="text"
name="username"
placeholder="Linux username"
required
>
<button
class="button-primary"
type="submit"
>
Add User
</button>
{% if available_users %}
<form method="post" action="/admin/users">
<input type="hidden" name="csrf" value="{{ csrf_token }}">
<select name="username" required>
<option value="" selected disabled>Select a Linux user</option>
{% for candidate in available_users %}
<option value="{{ candidate.username }}">
{{ candidate.username }}
</option>
{% endfor %}
</select>
<button class="button-primary" type="submit">Add User</button>
</form>
{% else %}
<div class="info">No eligible non-root Linux users are currently available to add.</div>
{% endif %}
</div>
<div class="card">
<strong>PAM administration group:</strong> <code>{{ pam_group }}</code>
<div class="muted" style="margin-top:6px;">Only Linux users who authenticate with PAM and belong to this group can use the web panel.</div>
</div>
</main>
</body>
</html>
+17 -64
View File
@@ -3,80 +3,33 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign in — Parental Control</title>
<title>Parental Control Login</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #f4f5f7;
color: #1f2937;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.card {
width: min(420px, calc(100% - 32px));
background: white;
border-radius: 12px;
padding: 28px;
box-shadow: 0 2px 12px rgba(0,0,0,.10);
}
h1 { margin: 0 0 8px; }
p { color: #6b7280; }
label { display:block; margin-top:16px; font-weight:600; font-size:14px; }
input {
width:100%;
margin-top:7px;
border:1px solid #d1d5db;
border-radius:7px;
padding:10px 12px;
font-size:15px;
}
button {
width:100%;
margin-top:22px;
border:0;
border-radius:7px;
padding:11px 15px;
background:#2563eb;
color:white;
cursor:pointer;
font-size:15px;
}
.error {
background:#fef2f2;
color:#991b1b;
border:1px solid #fecaca;
border-radius:7px;
padding:10px 12px;
margin-top:16px;
}
.hint { font-size:13px; }
body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #f4f5f7; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #1f2937; }
.card { width: min(420px, calc(100% - 32px)); background: white; padding: 28px; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
h1 { margin-top: 0; }
label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }
button { width: 100%; margin-top: 20px; padding: 10px 14px; border: 0; border-radius: 8px; background: #2563eb; color: white; font-size: 15px; cursor: pointer; }
.error { padding: 10px 12px; border-radius: 8px; background: #fee2e2; color: #991b1b; margin-bottom: 14px; font-size: 14px; }
.muted { color: #6b7280; font-size: 14px; line-height: 1.5; }
code { background: #f3f4f6; padding: 2px 5px; border-radius: 4px; }
</style>
</head>
<body>
<main class="card">
<div class="card">
<h1>Parental Control</h1>
<p>Sign in with a Linux account authenticated through PAM.</p>
{% if error %}
<div class="error">{{ error }}</div>
{% endif %}
<p class="muted">Sign in with your Linux username and password. You must also be a member of the <code>{{ pam_group }}</code> Linux group.</p>
{% if error %}<div class="error">{{ error }}</div>{% endif %}
<form method="post" action="/login">
<input type="hidden" name="next" value="{{ next }}">
<label for="username">Linux username</label>
<input id="username" name="username" type="text" autocomplete="username" required autofocus>
<label for="password">Password</label>
<input id="password" name="password" type="password" autocomplete="current-password" required>
<input id="username" name="username" autocomplete="username" required>
<label for="password">Linux password</label>
<input id="password" type="password" name="password" autocomplete="current-password" required>
<button type="submit">Sign in</button>
</form>
<p class="hint">The application does not store your Linux password.</p>
</main>
</div>
</body>
</html>
+243 -775
View File
File diff suppressed because it is too large Load Diff