fix: use relative URLs for local media storage to fix CSP blocking

Media files were stored with absolute http://localhost:5555/... URLs,
which got blocked by the Content Security Policy when the app runs at
https://socialflow.fnancy.fr. Now stores relative /uploads/... paths
and resolves to absolute URLs only when needed by external APIs
(Facebook, FFmpeg internal service).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-03-25 08:30:07 +01:00
1 parent 8f7f580b2f
commit b353fb6ded
4 files changed
+41 -22

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@ import { bundle } from "@remotion/bundler";
import { renderMedia, selectComposition } from "@remotion/renderer";
import { ffmpegService } from "../services/ffmpeg";
import { storage as dbStorage } from "../storage";
import { minioService as cloudinaryService, buildMinioUrl } from "../services/minio";
import { minioService as cloudinaryService, buildMinioUrl, resolvePublicUrl } from "../services/minio";
import { facebookService } from "../services/facebook";
import * as musicMetadata from "music-metadata";
@@ -319,7 +319,7 @@ remotionRouter.post("/publish", async (req, res) => {
if (!scheduledFor) {
console.log(`🚀 Publishing to ${page.pageName}...`);
const reelId = await facebookService.publishReel(page, cloudinaryResult.originalUrl, description || "");
const reelId = await facebookService.publishReel(page, resolvePublicUrl(cloudinaryResult.originalUrl), description || "");
await dbStorage.updateScheduledPost(scheduledPost.id, { publishedAt: new Date(), externalPostId: reelId });
results.push({ pageId, success: true, reelId });
} else {