source: Klonkt/src/views/pages/authorize-interaction.ejs@ 3d7312a

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

feat(activitypub): remote interaction — reply to any fediverse post from your own server

Standard 'reply from your own server' flow: every post page has a 'Reply via the
fediverse' button that bounces the visitor to their home server's
/authorize_interaction?uri=. Klonkt implements that endpoint: the site owner
composes a reply that's resolved (resolveRemoteNote) + federated back to the
remote post as the site actor. Works Klonkt<->Klonkt and with Mastodon.

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

  • Property mode set to 100644
File size: 2.5 KB
Line 
1<div class="auth-interact">
2 <h1 class="auth-interact-title"><%= t('fedi.remote_title') %></h1>
3
4 <% if (!target) { %>
5 <p class="auth-interact-note"><%= t('fedi.remote_notfound') %></p>
6 <form method="get" action="/authorize_interaction" class="auth-interact-form">
7 <input type="url" name="uri" placeholder="https://…/een-post" value="<%= uri || '' %>" required>
8 <button type="submit" class="btn btn-primary"><%= t('fedi.remote_load') %></button>
9 </form>
10 <% } else { %>
11 <p class="auth-interact-meta">
12 <%= t('fedi.remote_replying_to') %>
13 <a href="<%= target.actor_url %>" rel="nofollow noopener" target="_blank"><strong><%= target.actor_name %></strong></a>
14 <span class="fedi-handle"><%= target.actor_handle %></span>
15 </p>
16 <% if (target.preview) { %>
17 <blockquote class="auth-interact-preview"><%= target.preview %></blockquote>
18 <% } %>
19 <form method="post" action="/authorize_interaction" class="auth-interact-form">
20 <input type="hidden" name="uri" value="<%= uri %>">
21 <textarea name="text" rows="4" required placeholder="<%= t('fedi.reply_ph') %>"></textarea>
22 <div class="auth-interact-actions">
23 <button type="submit" class="btn btn-primary"><%= t('fedi.send') %></button>
24 <a href="<%= uri %>" class="btn"><%= t('comments.cancel') %></a>
25 </div>
26 </form>
27 <p class="auth-interact-note"><%= t('fedi.remote_as', { site: siteTitle }) %></p>
28 <% } %>
29</div>
30
31<style>
32 .auth-interact { max-width: 580px; margin: 2rem auto; padding: 0 1rem; }
33 .auth-interact-title { margin: 0 0 1rem; }
34 .auth-interact-meta { color: var(--ink-soft, #888); margin: 0 0 .75rem; }
35 .auth-interact-preview {
36 margin: 0 0 1rem; padding: .75rem 1rem; border-left: 3px solid var(--accent, #888);
37 background: color-mix(in srgb, var(--ink, #000) 4%, transparent); border-radius: 0 12px 12px 0;
38 color: var(--ink, inherit);
39 }
40 .auth-interact-form { display: flex; flex-direction: column; gap: .75rem; }
41 .auth-interact-form textarea, .auth-interact-form input[type=url] {
42 width: 100%; box-sizing: border-box; padding: .6rem .8rem; font: inherit; resize: vertical;
43 border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent);
44 background: var(--paper, #fff); color: var(--ink, #000);
45 }
46 .auth-interact-actions { display: flex; gap: .5rem; align-items: center; }
47 .auth-interact-note { color: var(--ink-soft, #999); font-size: .85rem; margin-top: 1rem; }
48</style>
Note: See TracBrowser for help on using the repository browser.