diff --git a/server/index.mjs b/server/index.mjs index 10f038a..8e615ee 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -3071,7 +3071,11 @@ app.post('/api/ai/summarize', aiLimiter, async (req, res) => { // Generic JSON forwarder helper async function forwardJson(req, res, base) { try { - const pathPart = req.originalUrl.replace(/^\/api\/(dm|odysee|twitch-api|twitch-auth)/, ''); + // Accepte les deux préfixes : `/api/` (prod canonique) ET + // `/proxy/` (repli du front, défini dans proxy.conf.json pour le dev). + // Sans le second, les replis `/proxy/...` tombaient sur le fallback SPA + // (index.html) → erreur de parse JSON "status 200 / ok:false". + const pathPart = req.originalUrl.replace(/^\/(?:proxy\/)?(?:api\/)?(dm|odysee|twitch-api|twitch-auth)/, ''); const targetUrl = `${base}${pathPart}`; const method = (req.method || 'GET').toUpperCase(); // Ne transfère que les headers utiles : tout le reste (cookies, content-length @@ -3105,6 +3109,12 @@ app.all('/api/dm/*', (req, res) => forwardJson(req, res, 'https://api.dailymotio app.all('/api/odysee/*', (req, res) => forwardJson(req, res, 'https://api.na-backend.odysee.com')); app.all('/api/twitch-api/*', (req, res) => forwardJson(req, res, 'https://api.twitch.tv')); app.all('/api/twitch-auth/*', (req, res) => forwardJson(req, res, 'https://id.twitch.tv')); +// Alias `/proxy/...` : le front utilise ces chemins en repli (cf. proxy.conf.json +// pour le dev). En prod ils doivent répondre du JSON, pas le shell SPA. +app.all('/proxy/dm/*', (req, res) => forwardJson(req, res, 'https://api.dailymotion.com')); +app.all('/proxy/odysee/*', (req, res) => forwardJson(req, res, 'https://api.na-backend.odysee.com')); +app.all('/proxy/twitch-api/*', (req, res) => forwardJson(req, res, 'https://api.twitch.tv')); +app.all('/proxy/twitch-auth/*', (req, res) => forwardJson(req, res, 'https://id.twitch.tv')); // -------------------- Unified search endpoint (GET) -------------------- app.get('/api/search', async (req, res) => { diff --git a/src/components/shorts/watch-short.component.html b/src/components/shorts/watch-short.component.html index 2458639..4605aa5 100644 --- a/src/components/shorts/watch-short.component.html +++ b/src/components/shorts/watch-short.component.html @@ -1,7 +1,7 @@ -
+
-