Changeset 757eea0 in Klonkt for src/views/pages/admin-audio.ejs


Ignore:
Timestamp:
06/30/2026 03:37:41 AM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
69b509d
Parents:
432831c
Message:

chore(audio): drop the per-track fediverse toggle from Beheer -> Audio

The per-post "share audio to the fediverse" checkbox in the editor is now the single control
(set on save), so the per-track button in the audio admin was redundant. Removed the button +
its AJAX handler + label vars, the dead POST /:id/fedi-open route, and the generic-API
fedi_open field handler + query column. The fedi_open column, the ungated-file gate and the
AS2 Audio attachment all stay; only the per-track UI/routes are gone.

  • src/views/pages/admin-audio.ejs — button, handler, label vars removed
  • src/routes/admin-audio.js — /:id/fedi-open route + /api fedi_open handler + query column removed

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/admin-audio.ejs

    r432831c r757eea0  
    8383        var _aaudDlOn     = t('aaud.dl_on');
    8484        var _aaudDlOff    = t('aaud.dl_off');
    85         var _aaudFediOn   = t('aaud.fedi_on');
    86         var _aaudFediOff  = t('aaud.fedi_off');
    8785        var _aaudDelete   = t('aaud.delete');
    8886        var _aaudCopy     = t('aaud.copy_click');
     
    123121                        style="<%= t.downloadable ? 'color:var(--accent,#6b8f71)' : 'opacity:.5' %>">⬇</button>
    124122              <% } %>
    125               <button type="button" class="ax-icon-btn" data-track-fedi data-id="<%= t.id %>" data-on="<%= t.fedi_open ? '1' : '0' %>"
    126                       aria-label="<%= t.fedi_open ? _aaudFediOn : _aaudFediOff %>" title="<%= t.fedi_open ? _aaudFediOn : _aaudFediOff %>"
    127                       style="<%= t.fedi_open ? 'color:var(--accent,#6b8f71)' : 'opacity:.5' %>">🌐</button>
    128123              <form action="/admin/audio/<%= t.id %>/delete" method="post" data-confirm="<%= _aaudDelConfirm %>" class="ax-track-delete">
    129124                <button type="submit" class="ax-icon-btn ax-icon-btn-danger" aria-label="<%= _aaudDelete %>" title="<%= _aaudDelete %>">🗑</button>
     
    10091004    });
    10101005  });
    1011 
    1012   // Fediverse-share (fedi_open) toggle — AJAX, no page reload (mirrors the download toggle).
    1013   document.querySelectorAll('[data-track-fedi]').forEach(btn => {
    1014     btn.addEventListener('click', async () => {
    1015       if (btn.disabled) return;
    1016       const want = btn.dataset.on === '1' ? 0 : 1;
    1017       btn.disabled = true;
    1018       try {
    1019         const res = await fetch('/admin/audio/api/' + btn.dataset.id, {
    1020           method: 'POST',
    1021           headers: { 'Content-Type': 'application/json' },
    1022           body: JSON.stringify({ fedi_open: !!want }),
    1023         });
    1024         if (!res.ok) throw new Error('HTTP ' + res.status);
    1025         btn.dataset.on = String(want);
    1026         btn.style.color = want ? 'var(--accent,#6b8f71)' : '';
    1027         btn.style.opacity = want ? '1' : '.5';
    1028         btn.title = want ? '<%= t('aaud.fedi_on') %>' : '<%= t('aaud.fedi_off') %>';
    1029       } catch (e) {
    1030         alert('<%= t('aaud.change_failed') %>: ' + (e.message || e));
    1031       } finally {
    1032         btn.disabled = false;
    1033       }
    1034     });
    1035   });
    10361006})();
    10371007</script>
Note: See TracChangeset for help on using the changeset viewer.