| [3ceaef6] | 1 | <%#
|
|---|
| 2 | Een object van een andere server: hoe het eruit ziet, en wat je ermee kunt.
|
|---|
| 3 |
|
|---|
| 4 | EEN PLEK, TWEE INGANGEN (de zoekbalk en /authorize_interaction). Dit stond
|
|---|
| 5 | alleen op die tweede pagina, en toen de zoekfunctie een URL leerde herkennen
|
|---|
| 6 | zou het een tweede render worden -- en daarmee een tweede plek waar een poort,
|
|---|
| 7 | een sanitizer of een knop vergeten kan worden. De formulieren posten dus ook
|
|---|
| 8 | vanaf de zoekpagina naar /authorize_interaction/..., want daar zit het werk en
|
|---|
| 9 | daar zit de rechtencontrole.
|
|---|
| 10 |
|
|---|
| 11 | Verwacht: target (uit resolveRemoteNote), uri, reacted {liked,boosted}.
|
|---|
| 12 | Optioneel: mayReply (false = alleen lezen en reageren, geen antwoordvenster),
|
|---|
| 13 | cancelUrl (waar Annuleren heen gaat, standaard het origineel), siteTitle.
|
|---|
| 14 | %>
|
|---|
| 15 | <% const _cancel = (typeof cancelUrl !== 'undefined' && cancelUrl) ? cancelUrl : uri; %>
|
|---|
| 16 | <p class="auth-interact-meta">
|
|---|
| 17 | <%= t('fedi.remote_replying_to') %>
|
|---|
| 18 | <a href="<%= target.actor_url %>" rel="nofollow noopener" target="_blank"><strong><%= target.actor_name %></strong></a>
|
|---|
| 19 | <span class="fedi-handle"><%= target.actor_handle %></span>
|
|---|
| 20 | </p>
|
|---|
| 21 | <blockquote class="auth-interact-preview">
|
|---|
| 22 | <% if (target.content) { %><div class="auth-interact-content"><%- target.content %></div>
|
|---|
| 23 | <% } else if (target.preview) { %><%= target.preview %><% } %>
|
|---|
| 24 | <% (target.images || []).forEach(function(im){ %>
|
|---|
| 25 | <img class="auth-interact-img" src="<%= im %>" alt="" loading="lazy">
|
|---|
| 26 | <% }); %>
|
|---|
| 27 | </blockquote>
|
|---|
| 28 | <% if (target.url || uri) { %>
|
|---|
| 29 | <a class="auth-view-src" href="<%= target.url || uri %>" target="_blank" rel="nofollow noopener">
|
|---|
| 30 | <svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17 17 7"/><path d="M7 7h10v10"/></svg>
|
|---|
| 31 | <span><%= t('fedi.remote_view_original') %></span>
|
|---|
| 32 | </a>
|
|---|
| 33 | <% } %>
|
|---|
| 34 | <% if (target.poll) { var _pl = target.poll; var _tot = _pl.options.reduce(function(s,o){return s+(o.count||0);},0); var _vn = (_pl.voters!=null?_pl.voters:_tot); %>
|
|---|
| 35 | <% if (!_pl.closed) { %>
|
|---|
| 36 | <form method="post" action="/authorize_interaction/vote" class="auth-poll">
|
|---|
| 37 | <input type="hidden" name="uri" value="<%= uri %>">
|
|---|
| 38 | <% _pl.options.forEach(function(o){ %>
|
|---|
| 39 | <label class="auth-poll-choice"><input type="<%= _pl.multiple ? 'checkbox' : 'radio' %>" name="choice" value="<%= o.name %>"><span><%= o.name %></span></label>
|
|---|
| 40 | <% }); %>
|
|---|
| 41 | <div class="auth-interact-actions">
|
|---|
| 42 | <button type="submit" class="btn btn-primary"><%= t('poll.vote') %></button>
|
|---|
| 43 | </div>
|
|---|
| 44 | <p class="auth-poll-foot"><%= _vn %> <%= _vn === 1 ? t('poll.voter_one') : t('poll.voter_many') %> · <%= t('poll.open') %><% if (_pl.endTime) { %> · <%= t('poll.closes') %> <%= new Date(_pl.endTime).toLocaleString() %><% } %><% if (_pl.multiple) { %> · <%= t('poll.multiple') %><% } %></p>
|
|---|
| 45 | </form>
|
|---|
| 46 | <% } else { %>
|
|---|
| 47 | <div class="auth-poll">
|
|---|
| 48 | <% _pl.options.forEach(function(o){ var _pct = _tot ? Math.round((o.count||0)*100/_tot) : 0; %>
|
|---|
| 49 | <div class="auth-poll-res"><span class="auth-poll-fill" style="width:<%= _pct %>%"></span><span class="auth-poll-name"><%= o.name %></span><span class="auth-poll-pct"><%= _pct %>%</span></div>
|
|---|
| 50 | <% }); %>
|
|---|
| 51 | <p class="auth-poll-foot"><%= _vn %> <%= _vn === 1 ? t('poll.voter_one') : t('poll.voter_many') %> · <%= t('poll.closed') %><% if (_pl.multiple) { %> · <%= t('poll.multiple') %><% } %></p>
|
|---|
| 52 | </div>
|
|---|
| 53 | <% } %>
|
|---|
| 54 | <% } %>
|
|---|
| 55 | <% var _liked = (typeof reacted !== 'undefined' && reacted.liked); var _boosted = (typeof reacted !== 'undefined' && reacted.boosted); %>
|
|---|
| 56 | <div class="auth-interact-react">
|
|---|
| 57 | <form method="post" action="/authorize_interaction/like" class="fedi-react-form">
|
|---|
| 58 | <input type="hidden" name="uri" value="<%= uri %>">
|
|---|
| 59 | <button type="submit" class="fedi-bigact fedi-bigact-like<%= _liked ? ' is-on' : '' %>" data-on="<%= t('fedi.unlike_short') %>" data-off="<%= t('fedi.like_short') %>">
|
|---|
| 60 | <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2.6l2.9 5.88 6.49.95-4.7 4.58 1.11 6.46L12 17.96l-5.8 3.06 1.1-6.46-4.69-4.58 6.49-.95z"/></svg>
|
|---|
| 61 | <span class="fedi-bigact-label"><%= _liked ? t('fedi.unlike_short') : t('fedi.like_short') %></span>
|
|---|
| 62 | </button>
|
|---|
| 63 | </form>
|
|---|
| 64 | <form method="post" action="/authorize_interaction/boost" class="fedi-react-form">
|
|---|
| 65 | <input type="hidden" name="uri" value="<%= uri %>">
|
|---|
| 66 | <button type="submit" class="fedi-bigact fedi-bigact-boost<%= _boosted ? ' is-on' : '' %>" data-on="<%= t('tl.unboost') %>" data-off="<%= t('fedi.boost_short') %>">
|
|---|
| 67 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
|
|---|
| 68 | <span class="fedi-bigact-label"><%= _boosted ? t('tl.unboost') : t('fedi.boost_short') %></span>
|
|---|
| 69 | </button>
|
|---|
| 70 | </form>
|
|---|
| 71 | </div>
|
|---|
| 72 | <% if (locals.mayReply !== false) { %>
|
|---|
| 73 | <p class="auth-interact-or"><%= t('fedi.or_reply') %></p>
|
|---|
| 74 | <p class="auth-interact-where">💬 <%= t('fedi.reply_where') %></p>
|
|---|
| 75 | <div class="auth-interact-form">
|
|---|
| 76 | <%- include('./reply-editor', {
|
|---|
| 77 | action: '/authorize_interaction',
|
|---|
| 78 | hiddenFields: [{ name: 'uri', value: uri }],
|
|---|
| 79 | placeholder: t('fedi.reply_ph'),
|
|---|
| 80 | submitLabel: t('fedi.send'),
|
|---|
| 81 | rows: 4,
|
|---|
| 82 | participants: (target && target.actor_uri) ? [{
|
|---|
| 83 | uri: target.actor_uri,
|
|---|
| 84 | url: target.actor_url || target.actor_uri,
|
|---|
| 85 | handle: target.actor_handle || '',
|
|---|
| 86 | }] : [],
|
|---|
| 87 | }) %>
|
|---|
| 88 | <div class="auth-interact-actions"><a href="<%= _cancel %>" class="btn"><%= t('comments.cancel') %></a></div>
|
|---|
| 89 | </div>
|
|---|
| 90 | <% } %>
|
|---|
| 91 | <p class="auth-interact-note"><%= t('fedi.remote_as', { site: siteTitle }) %></p>
|
|---|
| 92 | <details class="auth-report">
|
|---|
| 93 | <summary>🚩 <%= t('fedi.report_open') %></summary>
|
|---|
| 94 | <form method="post" action="/authorize_interaction/report" class="auth-interact-form">
|
|---|
| 95 | <input type="hidden" name="uri" value="<%= uri %>">
|
|---|
| 96 | <input type="hidden" name="actor_uri" value="<%= target.actor_uri %>">
|
|---|
| 97 | <p class="auth-report-note"><%= t('fedi.report_where') %></p>
|
|---|
| 98 | <textarea name="reason" rows="3" maxlength="3000" placeholder="<%= t('fedi.report_ph') %>"></textarea>
|
|---|
| 99 | <div class="auth-interact-actions">
|
|---|
| 100 | <button type="submit" class="btn btn-danger"><%= t('fedi.report_send') %></button>
|
|---|
| 101 | </div>
|
|---|
| 102 | </form>
|
|---|
| 103 | </details>
|
|---|