source: Klonkt/src/views/pages/authorize-interaction.ejs@ 41a7637

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

fix(activitypub): instant Send + confirmation on remote reply

Send now resolves+delivers in the background and immediately shows a 'Sent ✅'
confirmation, instead of awaiting delivery and redirecting to a raw AP-JSON URL
(which felt like nothing happened).

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

  • Property mode set to 100644
File size: 3.8 KB
Line 
1<div class="auth-interact">
2 <% if (typeof sent !== 'undefined' && sent) { %>
3 <h1 class="auth-interact-title"><%= t('fedi.remote_sent_title') %></h1>
4 <p class="auth-interact-note"><%= t('fedi.remote_sent') %></p>
5 <p class="auth-interact-actions">
6 <% if (uri) { %><a class="btn" href="<%= uri %>" target="_blank" rel="nofollow noopener"><%= t('fedi.remote_view_original') %></a><% } %>
7 <a class="btn btn-primary" href="/"><%= t('fedi.remote_back') %></a>
8 </p>
9 <% } else { %>
10 <h1 class="auth-interact-title"><%= t('fedi.remote_title') %></h1>
11
12 <% if (!target) { %>
13 <p class="auth-interact-note"><%= t('fedi.remote_notfound') %></p>
14 <form method="get" action="/authorize_interaction" class="auth-interact-form">
15 <input type="url" name="uri" placeholder="https://…/een-post" value="<%= uri || '' %>" required>
16 <button type="submit" class="btn btn-primary"><%= t('fedi.remote_load') %></button>
17 </form>
18 <% } else { %>
19 <p class="auth-interact-meta">
20 <%= t('fedi.remote_replying_to') %>
21 <a href="<%= target.actor_url %>" rel="nofollow noopener" target="_blank"><strong><%= target.actor_name %></strong></a>
22 <span class="fedi-handle"><%= target.actor_handle %></span>
23 </p>
24 <blockquote class="auth-interact-preview">
25 <% if (target.content) { %><div class="auth-interact-content"><%- target.content %></div>
26 <% } else if (target.preview) { %><%= target.preview %><% } %>
27 <% (target.images || []).forEach(function(im){ %>
28 <img class="auth-interact-img" src="<%= im %>" alt="" loading="lazy">
29 <% }); %>
30 <% if (target.url || uri) { %>
31 <p class="auth-interact-orig"><a href="<%= target.url || uri %>" target="_blank" rel="nofollow noopener"><%= t('fedi.remote_view_original') %></a></p>
32 <% } %>
33 </blockquote>
34 <form method="post" action="/authorize_interaction" class="auth-interact-form">
35 <input type="hidden" name="uri" value="<%= uri %>">
36 <textarea name="text" rows="4" required placeholder="<%= t('fedi.reply_ph') %>"></textarea>
37 <div class="auth-interact-actions">
38 <button type="submit" class="btn btn-primary"><%= t('fedi.send') %></button>
39 <a href="<%= uri %>" class="btn"><%= t('comments.cancel') %></a>
40 </div>
41 </form>
42 <p class="auth-interact-note"><%= t('fedi.remote_as', { site: siteTitle }) %></p>
43 <% } %>
44 <% } %>
45</div>
46
47<style>
48 .auth-interact { max-width: 580px; margin: 2rem auto; padding: 0 1rem; }
49 .auth-interact-title { margin: 0 0 1rem; }
50 .auth-interact-meta { color: var(--ink-soft, #888); margin: 0 0 .75rem; }
51 .auth-interact-preview {
52 margin: 0 0 1rem; padding: .75rem 1rem; border-left: 3px solid var(--accent, #888);
53 background: color-mix(in srgb, var(--ink, #000) 4%, transparent); border-radius: 0 12px 12px 0;
54 color: var(--ink, inherit);
55 }
56 .auth-interact-form { display: flex; flex-direction: column; gap: .75rem; }
57 .auth-interact-form textarea, .auth-interact-form input[type=url] {
58 width: 100%; box-sizing: border-box; padding: .6rem .8rem; font: inherit; resize: vertical;
59 border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent);
60 background: var(--paper, #fff); color: var(--ink, #000);
61 }
62 .auth-interact-actions { display: flex; gap: .5rem; align-items: center; }
63 .auth-interact-note { color: var(--ink-soft, #999); font-size: .85rem; margin-top: 1rem; }
64 .auth-interact-content { line-height: 1.55; }
65 .auth-interact-content p { margin: .35rem 0; }
66 .auth-interact-content p:first-child { margin-top: 0; }
67 .auth-interact-img { max-width: 100%; height: auto; border-radius: 10px; margin: .5rem 0 0; display: block; }
68 .auth-interact-orig { margin: .75rem 0 0; font-size: .85rem; }
69 .auth-interact-orig a { color: var(--accent, #06c); }
70</style>
Note: See TracBrowser for help on using the repository browser.