fix(media): resolve 400 Bad Request on next/image proxy, add auto scroll to top on route change, disable swagger in prod, and fix dev ports
Deploy Canina / deploy (push) Successful in 1m51s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s

This commit is contained in:
parsa aghaei committed 2026-08-29 13:37:50 +03:30
1 parent 2d54fc8208
commit c7d7ac3aa3
22 files changed
+9862 -9779

No files matched your search

+2 -19
View File
@@ -57,27 +57,10 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
}
}, [fetchProfile, fetchSettings]);
// Handle scroll position tracking per pathname for reliable mobile back navigation
// Scroll to top on navigation / pathname change
useEffect(() => {
if (typeof window === 'undefined') return;
const key = `scroll_pos_${pathname}`;
const savedPos = sessionStorage.getItem(key);
if (savedPos !== null) {
const targetY = parseInt(savedPos, 10);
requestAnimationFrame(() => {
window.scrollTo({ top: targetY, behavior: 'instant' });
});
}
const handleScroll = () => {
sessionStorage.setItem(`scroll_pos_${pathname}`, window.scrollY.toString());
};
window.addEventListener('scroll', handleScroll, { passive: true });
return () => {
window.removeEventListener('scroll', handleScroll);
};
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
}, [pathname]);
// Check Maintenance Mode (Admin / Partner bypass)
+3 -2
View File
@@ -7,6 +7,7 @@ import { toPersian } from "../lib/utils";
import { useSettingsStore } from "../lib/store/settingsStore";
import { useRouter } from 'next/navigation';
import { Banner } from "../lib/types";
import { getMediaUrl } from "../lib/media";
function StatCounter({ target }: { target: number }) {
const [displayValue, setDisplayValue] = useState(0);
@@ -197,7 +198,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
heroBanners.map((banner, idx) => (
<motion.img
key={banner.imageUrl || idx}
src={banner.imageUrl}
src={getMediaUrl(banner.imageUrl)}
alt={banner.title || "Canina Pharma Germany"}
initial={false}
animate={{
@@ -214,7 +215,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
))
) : activeImageUrl ? (
<img
src={activeImageUrl}
src={getMediaUrl(activeImageUrl)}
alt={activeBanner?.title || "Canina Pharma Germany"}
className="absolute inset-0 w-full h-full object-cover"
loading="eager"
@@ -101,7 +101,11 @@ export default function SafeImage({
loading={priority ? undefined : "lazy"}
sizes={sizes}
quality={quality}
unoptimized={isBlobOrData || !isAllowedHost}
unoptimized={
isBlobOrData ||
!isAllowedHost ||
(typeof src === 'string' && (src.startsWith('/api/uploads/') || src.startsWith('/api/media/') || src.startsWith('/uploads/')))
}
className={cn(
"transition-all duration-500 w-full h-full object-contain",
imgClassName,
+5
View File
@@ -13,6 +13,11 @@ const nextConfig: NextConfig = {
images: {
formats: ['image/avif', 'image/webp'],
minimumCacheTTL: 31536000,
localPatterns: [
{
pathname: '/**',
},
],
remotePatterns: [
{
protocol: 'https',
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 4005",
"dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"lint": "eslint"