feat(media): implement nextjs media proxy API routes (/api/uploads & /api/media) with server-side caching and streaming
Deploy Canina / deploy (push) Successful in 1m34s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s

This commit is contained in:
parsa aghaei committed 2026-08-29 12:13:16 +03:30
1 parent d9c693c41b
commit fa1a35c835
19 files changed
+13806 -13030

No files matched your search

@@ -4,6 +4,7 @@ import Image from "next/image";
import { Sparkles } from "lucide-react";
import { cn } from "../lib/utils";
import { useSettingsStore } from "../lib/store/settingsStore";
import { getMediaUrl } from "../lib/media";
interface SafeImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> {
src?: string;
@@ -19,7 +20,7 @@ interface SafeImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>,
}
export default function SafeImage({
src,
src: rawSrc,
alt = "تصویر مکمل کنینا",
className,
imgClassName,
@@ -34,6 +35,8 @@ export default function SafeImage({
const [loading, setLoading] = React.useState(!priority);
const logoUrl = useSettingsStore(state => state.getText('site_logo', ''));
const src = React.useMemo(() => getMediaUrl(rawSrc), [rawSrc]);
// Check if external domain is in allowed remote patterns or relative path
const isExternal = typeof src === 'string' && (src.startsWith('http://') || src.startsWith('https://'));
const isBlobOrData = typeof src === 'string' && (src.startsWith('blob:') || src.startsWith('data:'));