Compare commits

...

3 Commits

Author SHA1 Message Date
eaa90c65f1 chore: ignore public/uploads and remove images from tracking
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 19s
Build & Deploy / 🧪 QA (push) Successful in 2m33s
Build & Deploy / 🏗️ Build (push) Successful in 4m55s
Build & Deploy / 🚀 Deploy (push) Successful in 1m29s
Build & Deploy / 🧪 Smoke Test (push) Successful in 1m22s
Build & Deploy / ⚡ Lighthouse (push) Successful in 2m42s
Build & Deploy / 🛡️ Quality Gates (push) Successful in 3m14s
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / ♿ WCAG (push) Has been cancelled
2026-02-23 01:42:37 +01:00
2a47d22e26 feat: change img proxy configuration
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 1m56s
Build & Deploy / 🏗️ Build (push) Successful in 4m5s
Build & Deploy / 🚀 Deploy (push) Successful in 1m19s
Build & Deploy / 🧪 Smoke Test (push) Successful in 48s
Build & Deploy / 🛡️ Quality Gates (push) Successful in 1m39s
Build & Deploy / ⚡ Lighthouse (push) Successful in 5m51s
Build & Deploy / ♿ WCAG (push) Successful in 7m0s
Build & Deploy / 🔔 Notify (push) Successful in 2s
2026-02-23 01:40:13 +01:00
33d2d67774 feat: Improve error handling, refine i18n title fallbacks for product pages, update Next.js type paths, and add an image loader test file.
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 1m58s
Build & Deploy / 🏗️ Build (push) Successful in 5m44s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🧪 Smoke Test (push) Successful in 48s
Build & Deploy / 🛡️ Quality Gates (push) Successful in 1m39s
Build & Deploy / ⚡ Lighthouse (push) Successful in 5m39s
Build & Deploy / ♿ WCAG (push) Successful in 5m35s
Build & Deploy / 🔔 Notify (push) Successful in 2s
2026-02-22 18:30:44 +01:00
10 changed files with 49 additions and 49 deletions

3
.env
View File

@@ -35,4 +35,5 @@ GATEKEEPER_PASSWORD=klz2026
COOKIE_DOMAIN=localhost
INFRA_DIRECTUS_URL=http://localhost:8059
INFRA_DIRECTUS_TOKEN=59fb8f4c1a51b18fe28ad947f713914e
GATEKEEPER_ORIGIN=http://klz.localhost
GATEKEEPER_ORIGIN=http://klz.localhost
OPENROUTER_API_KEY=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

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
node_modules
.next
.DS_Store
public/uploads
# Lighthouse CI
.lighthouseci/

View File

@@ -16,12 +16,18 @@ export default function Error({
const t = useTranslations('Error');
useEffect(() => {
// Treat "Failed to find Server Action" as a deployment sync issue and reload
if (error?.message?.includes('Failed to find Server Action')) {
window.location.reload();
return;
}
const services = getAppServices();
services.errors.captureException(error);
services.logger.error('Application error caught by boundary', {
message: error.message,
stack: error.stack,
digest: error.digest
message: error?.message || 'Unknown error',
stack: error?.stack,
digest: error?.digest,
});
}, [error]);
@@ -36,19 +42,14 @@ export default function Error({
<Heading level={1} className="text-6xl md:text-8xl font-bold mb-2 text-saturated">
500
</Heading>
<Scribble
variant="underline"
className="w-full h-6 -bottom-2 left-0 text-saturated/40"
/>
<Scribble variant="underline" className="w-full h-6 -bottom-2 left-0 text-saturated/40" />
</div>
<Heading level={2} className="text-2xl md:text-3xl font-bold mb-4">
{t('title')}
</Heading>
<p className="text-white/60 mb-10 max-w-md text-lg">
{t('description')}
</p>
<p className="text-white/60 mb-10 max-w-md text-lg">{t('description')}</p>
<div className="flex flex-col sm:flex-row gap-4">
<Button onClick={() => reset()} variant="saturated" size="lg">

View File

@@ -223,7 +223,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
href={`/${locale}/${await mapFileSlugToTranslated('products', locale)}`}
className="hover:text-accent transition-colors"
>
{t.has('breadcrumb') ? t('breadcrumb') : t('title').replace(/<[^>]*>/g, '')}
{t.has('breadcrumb') ? t('breadcrumb') : 'Products'}
</Link>
<span className="mx-3 opacity-30">/</span>
<span className="text-white/90">{categoryTitle}</span>
@@ -384,7 +384,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
href={`/${locale}/${await mapFileSlugToTranslated('products', locale)}`}
className="hover:text-accent transition-colors"
>
{t.has('breadcrumb') ? t('breadcrumb') : t('title').replace(/<[^>]*>/g, '')}
{t.has('breadcrumb') ? t('breadcrumb') : 'Products'}
</Link>
<span className="mx-4 opacity-20">/</span>
<Link

View File

@@ -12,7 +12,11 @@ export default async function Image({ params }: { params: Promise<{ locale: stri
const t = await getTranslations({ locale, namespace: 'Products' });
const fonts = await getOgFonts();
const title = t('meta.title') || t('breadcrumb') || t('title').replace(/<[^>]*>/g, '');
const title = t.has('meta.title')
? t('meta.title')
: t.has('breadcrumb')
? t('breadcrumb')
: 'Products';
const description = t('meta.description') || t('subtitle');
return new ImageResponse(

View File

@@ -17,7 +17,11 @@ interface ProductsPageProps {
export async function generateMetadata({ params }: ProductsPageProps): Promise<Metadata> {
const { locale } = await params;
const t = await getTranslations({ locale, namespace: 'Products' });
const title = t('meta.title') || t('breadcrumb') || t('title').replace(/<[^>]*>/g, '');
const title = t.has('meta.title')
? t('meta.title')
: t.has('breadcrumb')
? t('breadcrumb')
: 'Products';
const description = t('meta.description') || t('subtitle');
return {
title,

View File

@@ -43,7 +43,11 @@ export default function ProductCategories() {
return (
<Section className="bg-neutral-light py-0 md:py-0 lg:py-0 -mt-px">
{t('title') && <h2 className="sr-only">{t('title')}</h2>}
{t.has('title') && (
<h2 className="sr-only">
{t.rich('title', { green: (chunks: any) => <span>{chunks}</span> })}
</h2>
)}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
{categories.map((category, idx) => (
<Link

View File

@@ -155,7 +155,7 @@ services:
- default
klz-imgproxy:
image: darthsim/imgproxy:latest
image: registry.infra.mintel.me/mintel/image-processor:latest
restart: unless-stopped
networks:
- default
@@ -165,12 +165,10 @@ services:
- "cms.klz.localhost:host-gateway"
- "host.docker.internal:host-gateway"
environment:
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
# IMGPROXY_URL_MAPPING is not used by our new service yet, but we can keep it for future parity if we add it back
IMGPROXY_URL_MAPPING: "${NEXT_PUBLIC_BASE_URL}:http://klz-app:3000,${DIRECTUS_URL}:http://klz-cms:8055"
IMGPROXY_USE_ETAG: "true"
IMGPROXY_MAX_SRC_RESOLUTION: 20
IMGPROXY_IGNORE_SSL_ERRORS: "true"
IMGPROXY_LOG_LEVEL: debug
IMGPROXY_ALLOW_LOCAL_NETWORKS: "true"
labels:
- "traefik.enable=true"

View File

@@ -39,34 +39,21 @@ export function getImgproxyUrl(src: string, options: ImgproxyOptions = {}): stri
// Also handle direct container names if needed
}
const {
width = 0,
height = 0,
resizing_type = 'fit',
gravity = 'sm', // Default to smart gravity
enlarge = false,
extension = '',
} = options;
const { width = 0, height = 0, enlarge = false, extension = '' } = options;
// Processing options
// Format: /rs:<type>:<width>:<height>:<enlarge>/g:<gravity>
const processingOptions = [
`rs:${resizing_type}:${width}:${height}:${enlarge ? 1 : 0}`,
`g:${gravity}`,
].join('/');
let quality = 80;
if (extension) quality = 90;
// Using Base64 encoding for the source URL.
// This completely eliminates any risk of intermediate proxies (Traefik/Next.js)
// URL-decoding the path, which corrupts the double-slash (// to /) and causes 403 errors.
// Imgproxy expects URL-safe Base64 (RFC 4648) without padding.
const b64 =
typeof window === 'undefined'
? Buffer.from(absoluteSrc).toString('base64')
: btoa(unescape(encodeURIComponent(absoluteSrc)));
// Re-map imgproxy URL to our new parameter structure
// e.g. /process?url=...&w=...&h=...&q=...&format=...
const queryParams = new URLSearchParams({
url: absoluteSrc,
});
const urlSafeB64 = b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
if (width > 0) queryParams.set('w', width.toString());
if (height > 0) queryParams.set('h', height.toString());
if (extension) queryParams.set('format', extension.replace('.', ''));
if (quality) queryParams.set('q', quality.toString());
const suffix = extension ? `.${extension}` : '';
return `${baseUrl}/unsafe/${processingOptions}/${urlSafeB64}${suffix}`;
return `${baseUrl}/process?${queryParams.toString()}`;
}

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.