Changeset fef781e in Klonkt for src/routes/audio.js


Ignore:
Timestamp:
06/20/2026 04:46:35 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
0d7acdf
Parents:
8ab20b6
Message:

revert: remove YouTube audio functionality (doesn't work)

YouTube blocks audio-only/hidden embed playback with a "Sign in to confirm
you're not a bot" gate → not reliably usable. All YT-audio reverted:

  • embed-player.js + embed.css → state before the feature (audio-only card, YT-album, buildYtAlbum, prewarm, mode-routing removed). Video embeds + the YT/SC volume button remain.
  • audio-player.js → YT backend (ytMode/ensureYT/playYouTube/playYouTubeList/…) removed; only the blob-<audio> player + existing features.
  • AudioEmbedService.js → audio:/video: mode parsing + data-embed-mode removed.
  • audio.js → /yt-title oEmbed proxy removed.
  • post-edit.ejs → audio/video choice on the embed button removed ([[embed:url]]

normal).

busters audio-player.js?v=28, embed-player.js?v=16, embed.css?v=8.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/audio.js

    r8ab20b6 rfef781e  
    158158});
    159159
    160 // Same-origin proxy voor de YouTube-titel (oEmbed). YouTube's oEmbed stuurt geen
    161 // CORS-header, dus de browser kan 'm niet direct fetchen — wij halen 'm server-
    162 // side op (geen CORS) en cachen 't. Gebruikt door de audio-only YT-embed om de
    163 // echte videotitel te tonen i.p.v. "YouTube".
    164 const ytTitleCache = new Map();
    165 router.get('/yt-title', async (req, res) => {
    166   const url = String(req.query.url || '');
    167   if (!/^https:\/\/(www\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\//i.test(url)) {
    168     return res.status(400).json({ error: 'bad url' });
    169   }
    170   if (ytTitleCache.has(url)) return res.json({ title: ytTitleCache.get(url) });
    171   try {
    172     const ac = new AbortController();
    173     const timer = setTimeout(() => ac.abort(), 6000);
    174     const r = await fetch('https://www.youtube.com/oembed?format=json&url=' + encodeURIComponent(url), { signal: ac.signal });
    175     clearTimeout(timer);
    176     if (!r.ok) { ytTitleCache.set(url, ''); return res.json({ title: '' }); }
    177     const d = await r.json();
    178     const title = (d && d.title) ? String(d.title).slice(0, 200) : '';
    179     ytTitleCache.set(url, title);
    180     res.json({ title });
    181   } catch (e) {
    182     res.status(502).json({ error: 'fetch failed' });
    183   }
    184 });
    185 
    186160export default router;
Note: See TracChangeset for help on using the changeset viewer.