Changeset c06816e in Klonkt for src/views/pages


Ignore:
Timestamp:
07/01/2026 09:49:52 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
5a27ba4
Parents:
8cf8b5f
Message:

feat(audio): sharing openly on the fediverse is one-way + lock the editor choice

Once a track has federated openly the file is out there — re-gating would be false
security. Opening is now permanent: the flag can be set but never cleared, the editor
locks the checkbox once open, and warns before you tick it. Default stays closed
(safe default; self-hosters choose per track).

  • src/routes/posts.js — setAudioFediOpen never writes fedi_open back to 0 (one-way).
  • src/views/pages/post-edit.ejs — locked (checked+disabled) checkbox with an explainer once open; a red permanence warning appears when ticking it on a gated post. Also fixes the poll fields showing while "Add a poll" was unchecked: the conditional style attribute was emitted through an escaping tag, turning it into entity soup — the condition now lives inside the quoted attribute.
  • src/services/i18n.js — pedit.fedi_audio_oneway + pedit.fedi_audio_locked (nl/en/de).
  • CHANGELOG(.nl/.de).md — "Sharing audio openly is now one-way" under Changed.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/post-edit.ejs

    r8cf8b5f rc06816e  
    262262               placeholder="<%= t('pedit.nsfw_cw_ph') %>"
    263263               style="width:100%;box-sizing:border-box;margin:6px 0 2px;font-size:13px;padding:7px 9px">
     264        <% var _fediOpen = (typeof fediOpenAudio !== 'undefined' && fediOpenAudio); %>
    264265        <label class="pe-checkbox">
    265           <input type="checkbox" name="fedi_open_audio" value="1" <%= (typeof fediOpenAudio !== 'undefined' && fediOpenAudio) ? 'checked' : '' %>>
     266          <%# One-way: once opened, the file has federated — re-gating would be false security, so the box locks. %>
     267          <input type="checkbox" name="fedi_open_audio" value="1" id="pe-fedi-audio" <%= _fediOpen ? 'checked disabled' : '' %>>
    266268          <span>🌐 <%= t('pedit.fedi_audio_label') %></span>
    267269        </label>
     270        <% if (_fediOpen) { %>
     271          <p style="font-size:12px;opacity:.7;margin:2px 0 0 26px"><%= t('pedit.fedi_audio_locked') %></p>
     272        <% } else { %>
     273          <p id="pe-fedi-audio-warn" style="font-size:12px;color:#c0392b;margin:2px 0 0 26px" hidden>⚠️ <%= t('pedit.fedi_audio_oneway') %></p>
     274          <script>
     275          (function () {
     276            var cb = document.getElementById('pe-fedi-audio'), w = document.getElementById('pe-fedi-audio-warn');
     277            if (cb && w && !cb.__wired) { cb.__wired = true; cb.addEventListener('change', function () { w.hidden = !cb.checked; }); }
     278          })();
     279          </script>
     280        <% } %>
    268281        <script>
    269282        (function () {
     
    298311          .pe-poll-dur { padding: 7px 9px; border-radius: 7px; border: 1px solid var(--rule, rgba(128,128,128,.35)); background: transparent; color: inherit; font-size: 13px; }
    299312        </style>
    300         <div id="pe-poll-fields" class="pe-poll"<%= _poll ? '' : ' style="display:none"' %>>
     313        <%# NB: keep the condition INSIDE the quoted attribute — escaped output (equals-tag)
     314            turns a whole emitted style attribute into entity soup (fields showed always). %>
     315        <div id="pe-poll-fields" class="pe-poll" style="<%= _poll ? '' : 'display:none' %>">
    301316          <% if (_pollLocked) { %><p class="pe-poll-locked"><%= t('pedit.poll_locked') %></p><% } %>
    302317          <div id="pe-poll-opts" data-ph="<%= t('pedit.poll_option_ph') %>" data-del="<%= t('pedit.poll_remove') %>">
Note: See TracChangeset for help on using the changeset viewer.