source: Klonkt/src/views/pages/admin.ejs@ 283f618

main
Last change on this file since 283f618 was 283f618, checked in by Robin Genis <roboburr@…>, 2 months ago

feat(fediverse): add an ActivityPub on/off toggle (off = no federation, no comments)

A solo site can now run without the fediverse. ap_enabled (default on, Beheer ->
Instellingen). When off: /ap/*, WebFinger and NodeInfo 404 (undiscoverable), the
'from the fediverse' reactions section is hidden on posts (= no comments, since
native comments were removed), the profile follow button and the fediverse admin
links disappear. Cirkels is separate (not gated here).

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 11.3 KB
Line 
1<div class="container admin-page">
2 <h1><%= t('admin.title') %></h1>
3 <%
4 var _premOn = (typeof premiumEnabled !== 'undefined' && premiumEnabled);
5 var _premActive = _premOn && (typeof isPremium !== 'undefined' && isPremium);
6 var _premCls = _premActive ? 'on' : (_premOn ? 'off' : 'free');
7 var _premLbl = _premActive ? ('★ ' + t('adash.prem_active'))
8 : (_premOn ? ('⚠ ' + t('adash.prem_unlinked'))
9 : t('adash.prem_layeroff'));
10 %>
11 <a class="prem-badge <%= _premCls %>" href="/admin/settings" title="<%= t('admin.b_settings') %>"><%= _premLbl %></a>
12 <style>
13 .prem-badge{display:inline-flex;align-items:center;gap:.35rem;font-size:.78rem;font-weight:700;letter-spacing:.02em;padding:.3rem .85rem;border-radius:999px;text-decoration:none;border:1px solid transparent;margin:.1rem 0 .3rem}
14 .prem-badge.on{background:rgba(232,176,75,.16);color:var(--accent);border-color:rgba(232,176,75,.45)}
15 .prem-badge.off{background:rgba(239,68,68,.12);color:#ef9a9a;border-color:rgba(239,68,68,.35)}
16 .prem-badge.free{background:var(--paper-2);color:var(--ink-muted);border-color:var(--rule)}
17 .prem-badge:hover{filter:brightness(1.08)}
18 </style>
19 <% if (tenancy === 'hub') { %>
20 <p class="admin-tagline"><%= t('admin.tagline_hub') %></p>
21 <% } else { %>
22 <p class="admin-tagline"><%= t('admin.tagline_solo') %></p>
23 <% } %>
24
25 <nav class="admin-quick-links" aria-label="Beheer-snelkoppelingen">
26 <% if (tenancy === 'hub') { %>
27 <a href="/admin/sites" class="btn"><%= t('admin.b_sites') %></a>
28 <a href="/admin/users" class="btn"><%= t('admin.b_users') %></a>
29 <% if (typeof audioEnabled === 'undefined' || audioEnabled) { %>
30 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
31 <a href="/admin/playlists" class="btn"><%= t('admin.b_playlists') %></a>
32 <% } %>
33 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
34 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
35 <% } else { %>
36 <a href="/posts/new" class="btn"><%= t('admin.b_newpost') %></a>
37 <% if (typeof audioEnabled === 'undefined' || audioEnabled) { %>
38 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
39 <% } %>
40 <% if (primarySite) { %>
41 <a href="/admin/sites/<%= primarySite.slug %>/edit" class="btn"><%= t('admin.b_look') %></a>
42 <% } else { %>
43 <a href="/admin/sites/new" class="btn"><%= t('admin.b_makesite') %></a>
44 <% } %>
45 <% if (tenancy === 'circle') { %>
46 <a href="/admin/circle" class="btn"><%= t('admin.b_circle') %></a>
47 <% } %>
48 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
49 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
50 <% } %>
51 <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
52 <a href="/admin/stats" class="btn"><%= t('admin.b_stats') %></a>
53 <a href="/admin/newsletter" class="btn"><%= t('admin.b_newsletter') %></a>
54 <% if (tenancy !== 'hub' && primarySite) { %><a href="/pers" class="btn" target="_blank"><%= t('admin.b_perskit') %></a><% } %>
55 <% if (tenancy !== 'hub' && primarySite) { %><a href="/downloads" class="btn" target="_blank"><%= t('admin.b_downloads') %></a><% } %>
56 <% if (tenancy !== 'hub' && primarySite) { %><a href="/links" class="btn" target="_blank"><%= t('admin.b_linkbio') %></a><% } %>
57 <a href="/admin/shows" class="btn"><%= t('admin.b_agenda') %></a>
58 <% } %>
59 <% if (typeof apEnabled === 'undefined' || apEnabled) { %>
60 <a href="/tijdlijn" class="btn">🌐 <%= t('tl.title') %></a>
61 <a href="/meldingen" class="btn">🔔 <%= t('notif.title') %></a>
62 <a href="/fediverse" class="btn">🐘 <%= t('admin.b_fediverse') %></a>
63 <a href="/blokkeren" class="btn">🚫 <%= t('blk.title') %></a>
64 <% } %>
65 <a href="/admin/updates" class="btn"><%= t('admin.b_updates') %></a>
66 <a href="/admin/handleiding" class="btn"><%= t('admin.b_help') %></a>
67 </nav>
68
69 <div class="admin-stats">
70 <% if (tenancy === 'hub') { %>
71 <div class="stat-card"><div class="stat-num"><%= stats.users %></div><div class="stat-label"><%= t('admin.st_users') %></div></div>
72 <div class="stat-card"><div class="stat-num"><%= stats.sites %></div><div class="stat-label"><%= t('admin.st_sites') %></div></div>
73 <% } %>
74 <div class="stat-card"><div class="stat-num"><%= stats.posts %></div><div class="stat-label"><%= t('admin.st_posts') %></div></div>
75 <div class="stat-card"><div class="stat-num"><%= stats.published %></div><div class="stat-label"><%= t('admin.st_published') %></div></div>
76 </div>
77
78 <% if (typeof posts !== 'undefined' && posts && posts.length) { %>
79 <% var _drafts = posts.filter(function(p){ return p.isDraft; }).length; %>
80 <h2><%= t('admin.sec_posts') %><% if (_drafts) { %> <span class="pl-draftcount"><%= _drafts %> <%= t('admin.draft').toLowerCase() %><%= _drafts === 1 ? '' : 's' %></span><% } %></h2>
81 <ul class="post-admin-list">
82 <% posts.forEach(function(p) { %>
83 <li class="pal-row<%= p.isDraft ? ' is-draft' : '' %>">
84 <a class="pal-title" href="<%= p.editUrl %>">
85 <% if (p.isDraft) { %><span class="pal-badge"><%= t('admin.draft') %></span><% } %>
86 <span class="pal-name"><%= p.title || '(zonder titel)' %></span>
87 </a>
88 <span class="pal-actions">
89 <a class="pal-link" href="<%= p.editUrl %>"><%= t('admin.edit') %></a>
90 <% if (!p.isDraft) { %><a class="pal-link" href="<%= p.viewUrl %>"><%= t('admin.view') %></a><% } %>
91 </span>
92 </li>
93 <% }); %>
94 </ul>
95 <% } %>
96
97 <% if (sites && sites.length) { %>
98 <h2><%= t('admin.sec_sites') %></h2>
99 <table class="admin-table">
100 <thead>
101 <tr><th><%= t('admin.th_slug') %></th><th><%= t('admin.th_title') %></th><th><%= t('admin.th_owner') %></th><th><%= t('admin.th_created') %></th></tr>
102 </thead>
103 <tbody>
104 <% sites.forEach(function(s) { %>
105 <tr>
106 <td><code><%= s.slug %></code></td>
107 <td><%= s.title %></td>
108 <td><%= s.owner_username || '—' %></td>
109 <td><%= formatDate(s.created_at) %></td>
110 </tr>
111 <% }); %>
112 </tbody>
113 </table>
114 <% } %>
115
116 <% if (users && users.length) { %>
117 <h2><%= t('admin.sec_users') %></h2>
118 <table class="admin-table">
119 <thead>
120 <tr><th><%= t('admin.th_username') %></th><th><%= t('admin.th_email') %></th><th><%= t('admin.th_role') %></th><th><%= t('admin.th_joined') %></th></tr>
121 </thead>
122 <tbody>
123 <% users.forEach(function(u) { %>
124 <tr>
125 <td><%= u.username %></td>
126 <td><%= u.email %></td>
127 <td><span class="role-pill role-<%= u.role %>"><%= u.role %></span></td>
128 <td><%= formatDate(u.created_at) %></td>
129 </tr>
130 <% }); %>
131 </tbody>
132 </table>
133 <% } %>
134
135</div>
136
137<style>
138.admin-page { max-width: 1000px; margin: 3rem auto; padding: 0 1rem; }
139.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.25rem; }
140.admin-page h2 { font-family: var(--font-display, serif); font-size: 1.4rem; margin: 2rem 0 0.75rem; }
141.admin-tagline { color: var(--ink-muted); margin: 0 0 2rem; }
142.admin-tagline em { font-style: normal; opacity: 0.7; }
143
144/* Posts/concepten-lijst */
145.pl-draftcount { font-family: var(--font-ui, system-ui); font-size: 0.8rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.55rem; border-radius: 99px; vertical-align: middle; }
146.post-admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
147.pal-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); transition: border-color 120ms; }
148.pal-row:hover { border-color: var(--accent); }
149.pal-row.is-draft { border-left: 3px solid var(--accent); }
150.pal-title { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; }
151.pal-title:hover { color: var(--accent); }
152.pal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
153.pal-badge { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.5rem; border-radius: 99px; }
154.pal-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
155.pal-link { color: var(--ink-muted); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
156.pal-link:hover { color: var(--accent); text-decoration: underline; }
157
158/* Quick-links grid — mobile-first.
159 auto-fit + minmax means: as many equal columns as fit, each at least 140px.
160 Mobile (~360-440px): 2 per row.
161 Tablet (~480-700px): 3 per row.
162 Desktop (≥ ~720px): all 5 in a single row. */
163.admin-quick-links {
164 display: grid;
165 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
166 gap: 0.5rem;
167 margin: 0 0 1.5rem;
168 padding: 0;
169}
170.admin-quick-links .btn {
171 justify-content: center;
172 padding: 0.7rem 0.9rem;
173 font-weight: 600;
174 text-align: center;
175}
176.admin-quick-links .btn:hover {
177 background: color-mix(in srgb, var(--accent) 8%, var(--paper-2));
178 border-color: var(--accent);
179}
180
181.admin-stats {
182 display: grid;
183 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
184 gap: 0.75rem;
185 margin-bottom: 1rem;
186}
187.stat-card {
188 background: var(--paper-2);
189 border: 1px solid var(--rule);
190 border-radius: 8px;
191 padding: 1rem 1.25rem;
192 text-align: center;
193}
194.stat-num {
195 font-size: 2rem;
196 font-weight: 700;
197 color: var(--accent);
198 line-height: 1;
199 font-family: var(--font-display, serif);
200}
201.stat-label {
202 color: var(--ink-muted);
203 font-size: 0.85rem;
204 text-transform: uppercase;
205 letter-spacing: 0.05em;
206 margin-top: 0.25rem;
207}
208
209.admin-table {
210 width: 100%;
211 border-collapse: collapse;
212 background: var(--paper-2);
213 border: 1px solid var(--rule);
214 border-radius: 8px;
215 overflow: hidden;
216}
217.admin-table th, .admin-table td {
218 padding: 0.6rem 0.9rem;
219 text-align: left;
220 border-bottom: 1px solid var(--rule);
221}
222.admin-table th {
223 background: var(--paper);
224 font-weight: 600;
225 font-size: 0.85rem;
226 text-transform: uppercase;
227 letter-spacing: 0.05em;
228 color: var(--ink-muted);
229}
230.admin-table tr:last-child td { border-bottom: 0; }
231.admin-table code { background: var(--paper); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
232
233.role-pill {
234 display: inline-block;
235 padding: 0.1rem 0.5rem;
236 border-radius: 10px;
237 font-size: 0.75rem;
238 text-transform: uppercase;
239 letter-spacing: 0.05em;
240 background: var(--paper);
241 color: var(--ink-muted);
242}
243.role-pill.role-god { background: var(--accent); color: white; }
244.role-pill.role-admin { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
245
246.admin-todo {
247 margin: 2rem 0 0;
248 padding: 0.75rem 1rem;
249 background: var(--paper-2);
250 border-left: 3px solid var(--accent);
251 border-radius: 4px;
252 font-size: 0.9rem;
253 color: var(--ink-muted);
254}
255
256@media (max-width: 600px) {
257 .admin-table { font-size: 0.85rem; }
258 .admin-table th, .admin-table td { padding: 0.45rem 0.6rem; }
259}
260</style>
Note: See TracBrowser for help on using the repository browser.