Changeset 757eea0 in Klonkt for src/routes/admin-audio.js


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/routes/admin-audio.js

    r432831c r757eea0  
    9696  const rows = db.prepare(`
    9797    SELECT t.id, t.title, t.artist, t.album, t.duration, t.cover_url,
    98            t.position, t.created_at, t.downloadable, t.fedi_open, m.filename, m.size, m.mime_type
     98           t.position, t.created_at, t.downloadable, m.filename, m.size, m.mime_type
    9999    FROM audio_tracks t
    100100    LEFT JOIN media m ON m.id = t.media_id
     
    288288});
    289289
    290 // Federate-the-file (fedi_open) per track on/off. When on, this track's audio file is shared
    291 // as a real AS2 Audio attachment + served ungated → it plays inline in EVERY fediverse client
    292 // (incl. the Mastodon apps), but the file is downloadable. Off (default) = gated, web-player only.
    293 router.post('/:id/fedi-open', requireGod, (req, res) => {
    294   const site = res.locals.site;
    295   if (!site) return res.status(404).send('Site required');
    296   const row = db.prepare('SELECT fedi_open FROM audio_tracks WHERE id = ? AND site_id = ?').get(req.params.id, site.id);
    297   if (row) {
    298     db.prepare('UPDATE audio_tracks SET fedi_open = ? WHERE id = ? AND site_id = ?')
    299       .run(row.fedi_open ? 0 : 1, req.params.id, site.id);
    300   }
    301   res.redirect('/admin/audio');
    302 });
    303 
    304290router.post('/:id/delete', requireGod, (req, res) => {
    305291  const site = res.locals.site;
     
    494480    fields.push('downloadable = ?'); values.push(body.downloadable ? 1 : 0);
    495481  }
    496   if (Object.prototype.hasOwnProperty.call(body, 'fedi_open')) {
    497     fields.push('fedi_open = ?'); values.push(body.fedi_open ? 1 : 0);
    498   }
    499482  if (Object.prototype.hasOwnProperty.call(body, 'credit')) {
    500483    fields.push('credit = ?'); values.push(String(body.credit || '').trim() || null);
Note: See TracChangeset for help on using the changeset viewer.