source: Klonkt/src/views/pages/admin-circle.ejs@ 974de34

main
Last change on this file since 974de34 was 0091cb7, checked in by roboburr <roboburr@…>, 3 months ago

Circles v1 — steps 4+5: Admin UI + /cirkel feed

  • Mode 'Circles' in Admin > Settings (radio + section).
  • Admin > Circle (admin-circle): add sources/list/status, per source Refresh (syncOne) + Delete (cleans up orphaned cache), and a visibility toggle (sites.allow_circle, opt-out for surfacing).
  • /cirkel feed: cached remote_posts as static cards (source/avatar, title, summary, cover, link to source). Only when tenancy=circle.
  • allow_circle column (ensureColumn) + CircleFederation respects it.
  • Output escaped everywhere + URL-scheme guards (http/https) against XSS import.

v1 functionally complete (publish + pull + UI + feed). Remaining: hardening/review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

  • Property mode set to 100644
File size: 5.8 KB
Line 
1<div class="container admin-page">
2 <h1>Cirkel</h1>
3 <p><a href="/admin/settings" class="btn">&larr; Instellingen</a></p>
4
5 <% if (success) { %><div class="alert alert-success"><%= success %></div><% } %>
6 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
7
8 <% if (tenancy !== 'circle') { %>
9 <section class="set-card">
10 <p class="set-help">De modus staat niet op <strong>Cirkels</strong>. Zet 'm aan bij
11 <a href="/admin/settings">Instellingen</a> om je cirkel-feed te tonen op <code>/cirkel</code>.
12 Je kunt hieronder al wel bronnen klaarzetten.</p>
13 </section>
14 <% } %>
15
16 <section class="set-card" style="margin-top:1rem">
17 <h2>Mijn zichtbaarheid</h2>
18 <p class="set-help">Mag jouw site verschijnen in cirkels van anderen? (Toont je publieke
19 posts via <code>/.klonkt/outbox.json</code>.)</p>
20 <form method="post" action="/admin/circle/allow" class="set-form">
21 <label class="set-opt" style="align-items:center">
22 <input type="checkbox" name="allow_circle" value="on" <%= allowCircle ? 'checked' : '' %>>
23 <span><strong>Toon mijn site in cirkels van anderen</strong></span>
24 </label>
25 <button type="submit" class="btn btn-primary">Opslaan</button>
26 </form>
27 </section>
28
29 <section class="set-card" style="margin-top:1rem">
30 <h2>Klonkt-site toevoegen</h2>
31 <p class="set-help">Plak de basis-URL van een andere Klonkt-site. Asymmetrisch: jij toont
32 hen, los van of zij jou tonen.</p>
33 <form method="post" action="/admin/circle/add" class="set-form">
34 <label class="set-field">
35 <span>URL</span>
36 <input type="url" name="remote_url" placeholder="https://artiest.klonkt.com" required>
37 </label>
38 <label class="set-field">
39 <span>Label <small style="font-weight:400">— optioneel</small></span>
40 <input type="text" name="label" maxlength="80" placeholder="bijv. Joost Klein">
41 </label>
42 <button type="submit" class="btn btn-primary">Toevoegen</button>
43 </form>
44 </section>
45
46 <section class="set-card" style="margin-top:1rem">
47 <h2>In mijn cirkel (<%= links.length %>)</h2>
48 <% if (!links.length) { %>
49 <p class="set-help">Nog geen bronnen. Voeg er hierboven een toe.</p>
50 <% } else { %>
51 <ul class="circ-list">
52 <% links.forEach(function(l){ %>
53 <li class="circ-item">
54 <div class="circ-main">
55 <strong><%= l.label || l.remote_url %></strong>
56 <small><%= l.remote_url %></small>
57 <small>
58 <% if (l.status === 'active') { %>
59 <span class="circ-badge ok">&#10003; actief</span>
60 <%= counts[l.id] || 0 %> posts
61 <% if (l.last_synced) { %>&middot; laatst: <%= l.last_synced %><% } %>
62 <% } else if (l.status === 'error') { %>
63 <span class="circ-badge err">&#9888; fout</span>
64 <%= l.last_error || '' %>
65 <% } else { %>
66 <span class="circ-badge">&#9208; gepauzeerd</span>
67 <% } %>
68 </small>
69 </div>
70 <div class="circ-actions">
71 <form method="post" action="/admin/circle/<%= l.id %>/sync" style="display:inline">
72 <button type="submit" class="btn">Verversen</button>
73 </form>
74 <form method="post" action="/admin/circle/<%= l.id %>/remove" style="display:inline"
75 onsubmit="return confirm('Verwijderen uit je cirkel?')">
76 <button type="submit" class="btn btn-danger">Verwijder</button>
77 </form>
78 </div>
79 </li>
80 <% }); %>
81 </ul>
82 <% } %>
83 </section>
84</div>
85
86<style>
87.admin-page { max-width: 760px; margin: 3rem auto; padding: 0 1rem; }
88.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 .25rem; }
89.set-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem; }
90.set-card h2 { font-family: var(--font-display, serif); font-size: 1.25rem; margin: 0 0 .5rem; }
91.set-help { color: var(--ink-muted); font-size: .9rem; margin: 0 0 1rem; }
92.set-form { display: flex; flex-direction: column; gap: 1rem; }
93.set-opt { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
94.set-field { display: flex; flex-direction: column; gap: .3rem; }
95.set-field > span { font-size: .8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
96.set-field input { width: 100%; box-sizing: border-box; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
97.set-form .btn, .circ-actions .btn { align-self: flex-start; }
98.circ-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
99.circ-item { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); flex-wrap: wrap; }
100.circ-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
101.circ-main small { color: var(--ink-muted); font-size: .78rem; word-break: break-all; }
102.circ-actions { display: flex; gap: .4rem; flex-shrink: 0; }
103.circ-badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 20px; background: var(--rule); }
104.circ-badge.ok { background: #d1fae5; color: #065f46; }
105.circ-badge.err { background: #fee2e2; color: #991b1b; }
106.btn-danger { color: #991b1b; border-color: #fca5a5; }
107.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
108.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
109.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
110</style>
Note: See TracBrowser for help on using the repository browser.