mirror of
https://github.com/Alexander-D-Karpov/webring.git
synced 2026-03-16 22:07:41 +03:00
* major changes
Introduce full user system and approval workflow
——————————————————————————————————————————
Login & sessions
Telegram one‑click login (/login → /auth/telegram) with HMAC verification
New users and sessions tables; telegram_id now optional, TTL‑based cleanup job
Secure session_id cookie (configurable TTL and Secure/SameSite flags)
User dashboard (/user)
Lists the member’s sites and their uptime status
Forms to submit new site or update requests; validation and slug/url sanitisation
View pending requests with change diff
Request storage
update_requests table captures create/update ops as JSONB “changed_fields”
Admin review
/admin/requests interface to approve / reject queued requests
Approval auto‑creates sites (with ordered display_order) or patches existing ones, then refreshes favicon
Super‑admin panel
/admin/setup lists all users, toggle is_admin and forcibly logs them out
Notifications
On every new request, all admins with a Telegram ID receive a Markdown summary via bot API
Public UI tweaks
Header shows login/logout, role‑aware links and call‑to‑action cards
/submit page creates a queued request
Config & env
Added TELEGRAM_BOT_TOKEN, TELEGRAM_BOT_USERNAME, SESSION_TTL_HOURS, SESSION_SECURE_COOKIE
.env.template updated accordingly
Migrations 004–010
Users, sessions, foreign key on sites, display_order, update_requests, telegram_id nullability
BREAKING CHANGE
Environment must supply Telegram bot credentials
Database must be migrated; existing “dashboard” auth remains but admin routes are now session‑protected where applicable
219 lines
3.8 KiB
CSS
219 lines
3.8 KiB
CSS
@import "/static/reset.css";
|
|
@import "/static/theme.css";
|
|
|
|
body {
|
|
padding: 1rem;
|
|
}
|
|
|
|
header, main, footer {
|
|
padding: 1rem 1.5rem;
|
|
width: 100%;
|
|
max-width: 48rem;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
header {
|
|
background: var(--color-primary-950);
|
|
color: var(--color-primary-100);
|
|
border-radius: 6px;
|
|
}
|
|
|
|
footer {
|
|
color: var(--color-gray-400);
|
|
padding-top: 0;
|
|
}
|
|
|
|
.join-link {
|
|
color: var(--color-gray-400);
|
|
}
|
|
|
|
ul {
|
|
flex-direction: column;
|
|
display: flex;
|
|
gap: 1.25rem;
|
|
font-size: 1.25rem;
|
|
}
|
|
|
|
li {
|
|
display: flex;
|
|
gap: 1rem;
|
|
align-items: center;
|
|
}
|
|
|
|
li img {
|
|
width: 20px;
|
|
aspect-ratio: 1 / 1;
|
|
}
|
|
|
|
li .favicon-fallback {
|
|
width: 20px;
|
|
height: 20px;
|
|
background: var(--color-gray-900);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.user-bar {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-top: 1rem;
|
|
padding-top: 1rem;
|
|
border-top: 1px solid var(--color-primary-900);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.user-actions {
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
align-items: center;
|
|
}
|
|
|
|
.user-action {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
padding: 0.5rem 0.75rem;
|
|
background: var(--color-primary-900);
|
|
color: var(--color-primary-100);
|
|
text-decoration: none;
|
|
border-radius: 4px;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
transition: all 0.2s ease;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.user-action:hover {
|
|
background: var(--color-primary-950);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.user-action.admin {
|
|
background: var(--color-green-700);
|
|
}
|
|
|
|
.user-action.admin:hover {
|
|
background: var(--color-green-700);
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.user-action.docs {
|
|
background: var(--color-gray-600);
|
|
}
|
|
|
|
.user-action.docs:hover {
|
|
background: var(--color-gray-400);
|
|
}
|
|
|
|
.user-action.logout {
|
|
background: var(--color-red-700);
|
|
}
|
|
|
|
.user-action.logout:hover {
|
|
background: var(--color-red-700);
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.user-action i {
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
/* Override form hiding for logout */
|
|
.user-actions form {
|
|
display: inline !important;
|
|
}
|
|
|
|
/* Action Section Styles */
|
|
.action-section {
|
|
margin-top: 3rem;
|
|
padding-top: 2rem;
|
|
border-top: 1px solid var(--color-gray-900);
|
|
}
|
|
|
|
.action-section h2 {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
margin-bottom: 1.5rem;
|
|
text-align: center;
|
|
color: var(--color-gray-100);
|
|
}
|
|
|
|
.action-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
|
|
.action-card {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
padding: 1.25rem;
|
|
background: var(--color-gray-900);
|
|
border-radius: 8px;
|
|
border: 1px solid var(--color-gray-600);
|
|
text-decoration: none;
|
|
color: var(--color-gray-100);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.action-card:hover {
|
|
background: var(--color-gray-600);
|
|
border-color: var(--color-gray-400);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.action-card-primary {
|
|
background: var(--color-primary-900);
|
|
border-color: var(--color-primary-900);
|
|
color: var(--color-primary-100);
|
|
}
|
|
|
|
.action-card-primary:hover {
|
|
background: var(--color-primary-950);
|
|
border-color: var(--color-primary-900);
|
|
}
|
|
|
|
.action-card i {
|
|
font-size: 1.5rem;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.action-content {
|
|
flex: 1;
|
|
}
|
|
|
|
.action-title {
|
|
font-weight: 600;
|
|
font-size: 1rem;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.action-description {
|
|
font-size: 0.875rem;
|
|
opacity: 0.8;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.user-bar {
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
align-items: stretch;
|
|
text-align: center;
|
|
}
|
|
|
|
.user-actions {
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.action-cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.action-card {
|
|
padding: 1rem;
|
|
}
|
|
} |