Compare commits
3 Commits
v1.2.11-rc
...
v1.2.11-rc
| Author | SHA1 | Date | |
|---|---|---|---|
| eaa90c65f1 | |||
| 2a47d22e26 | |||
| 33d2d67774 |
3
.env
3
.env
@@ -35,4 +35,5 @@ GATEKEEPER_PASSWORD=klz2026
|
|||||||
COOKIE_DOMAIN=localhost
|
COOKIE_DOMAIN=localhost
|
||||||
INFRA_DIRECTUS_URL=http://localhost:8059
|
INFRA_DIRECTUS_URL=http://localhost:8059
|
||||||
INFRA_DIRECTUS_TOKEN=59fb8f4c1a51b18fe28ad947f713914e
|
INFRA_DIRECTUS_TOKEN=59fb8f4c1a51b18fe28ad947f713914e
|
||||||
GATEKEEPER_ORIGIN=http://klz.localhost
|
GATEKEEPER_ORIGIN=http://klz.localhost
|
||||||
|
OPENROUTER_API_KEY=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
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.next
|
.next
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
public/uploads
|
||||||
|
|
||||||
# Lighthouse CI
|
# Lighthouse CI
|
||||||
.lighthouseci/
|
.lighthouseci/
|
||||||
|
|||||||
@@ -16,12 +16,18 @@ export default function Error({
|
|||||||
const t = useTranslations('Error');
|
const t = useTranslations('Error');
|
||||||
|
|
||||||
useEffect(() => {
|
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();
|
const services = getAppServices();
|
||||||
services.errors.captureException(error);
|
services.errors.captureException(error);
|
||||||
services.logger.error('Application error caught by boundary', {
|
services.logger.error('Application error caught by boundary', {
|
||||||
message: error.message,
|
message: error?.message || 'Unknown error',
|
||||||
stack: error.stack,
|
stack: error?.stack,
|
||||||
digest: error.digest
|
digest: error?.digest,
|
||||||
});
|
});
|
||||||
}, [error]);
|
}, [error]);
|
||||||
|
|
||||||
@@ -36,19 +42,14 @@ export default function Error({
|
|||||||
<Heading level={1} className="text-6xl md:text-8xl font-bold mb-2 text-saturated">
|
<Heading level={1} className="text-6xl md:text-8xl font-bold mb-2 text-saturated">
|
||||||
500
|
500
|
||||||
</Heading>
|
</Heading>
|
||||||
<Scribble
|
<Scribble variant="underline" className="w-full h-6 -bottom-2 left-0 text-saturated/40" />
|
||||||
variant="underline"
|
|
||||||
className="w-full h-6 -bottom-2 left-0 text-saturated/40"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Heading level={2} className="text-2xl md:text-3xl font-bold mb-4">
|
<Heading level={2} className="text-2xl md:text-3xl font-bold mb-4">
|
||||||
{t('title')}
|
{t('title')}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
<p className="text-white/60 mb-10 max-w-md text-lg">
|
<p className="text-white/60 mb-10 max-w-md text-lg">{t('description')}</p>
|
||||||
{t('description')}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div className="flex flex-col sm:flex-row gap-4">
|
<div className="flex flex-col sm:flex-row gap-4">
|
||||||
<Button onClick={() => reset()} variant="saturated" size="lg">
|
<Button onClick={() => reset()} variant="saturated" size="lg">
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ export default async function ProductPage({ params }: ProductPageProps) {
|
|||||||
href={`/${locale}/${await mapFileSlugToTranslated('products', locale)}`}
|
href={`/${locale}/${await mapFileSlugToTranslated('products', locale)}`}
|
||||||
className="hover:text-accent transition-colors"
|
className="hover:text-accent transition-colors"
|
||||||
>
|
>
|
||||||
{t.has('breadcrumb') ? t('breadcrumb') : t('title').replace(/<[^>]*>/g, '')}
|
{t.has('breadcrumb') ? t('breadcrumb') : 'Products'}
|
||||||
</Link>
|
</Link>
|
||||||
<span className="mx-3 opacity-30">/</span>
|
<span className="mx-3 opacity-30">/</span>
|
||||||
<span className="text-white/90">{categoryTitle}</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)}`}
|
href={`/${locale}/${await mapFileSlugToTranslated('products', locale)}`}
|
||||||
className="hover:text-accent transition-colors"
|
className="hover:text-accent transition-colors"
|
||||||
>
|
>
|
||||||
{t.has('breadcrumb') ? t('breadcrumb') : t('title').replace(/<[^>]*>/g, '')}
|
{t.has('breadcrumb') ? t('breadcrumb') : 'Products'}
|
||||||
</Link>
|
</Link>
|
||||||
<span className="mx-4 opacity-20">/</span>
|
<span className="mx-4 opacity-20">/</span>
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ export default async function Image({ params }: { params: Promise<{ locale: stri
|
|||||||
const t = await getTranslations({ locale, namespace: 'Products' });
|
const t = await getTranslations({ locale, namespace: 'Products' });
|
||||||
const fonts = await getOgFonts();
|
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');
|
const description = t('meta.description') || t('subtitle');
|
||||||
|
|
||||||
return new ImageResponse(
|
return new ImageResponse(
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ interface ProductsPageProps {
|
|||||||
export async function generateMetadata({ params }: ProductsPageProps): Promise<Metadata> {
|
export async function generateMetadata({ params }: ProductsPageProps): Promise<Metadata> {
|
||||||
const { locale } = await params;
|
const { locale } = await params;
|
||||||
const t = await getTranslations({ locale, namespace: 'Products' });
|
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');
|
const description = t('meta.description') || t('subtitle');
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ export default function ProductCategories() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Section className="bg-neutral-light py-0 md:py-0 lg:py-0 -mt-px">
|
<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">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
|
||||||
{categories.map((category, idx) => (
|
{categories.map((category, idx) => (
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ services:
|
|||||||
- default
|
- default
|
||||||
|
|
||||||
klz-imgproxy:
|
klz-imgproxy:
|
||||||
image: darthsim/imgproxy:latest
|
image: registry.infra.mintel.me/mintel/image-processor:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
@@ -165,12 +165,10 @@ services:
|
|||||||
- "cms.klz.localhost:host-gateway"
|
- "cms.klz.localhost:host-gateway"
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
environment:
|
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_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_LOG_LEVEL: debug
|
||||||
IMGPROXY_ALLOW_LOCAL_NETWORKS: "true"
|
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
|
|||||||
@@ -39,34 +39,21 @@ export function getImgproxyUrl(src: string, options: ImgproxyOptions = {}): stri
|
|||||||
// Also handle direct container names if needed
|
// Also handle direct container names if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { width = 0, height = 0, enlarge = false, extension = '' } = options;
|
||||||
width = 0,
|
|
||||||
height = 0,
|
|
||||||
resizing_type = 'fit',
|
|
||||||
gravity = 'sm', // Default to smart gravity
|
|
||||||
enlarge = false,
|
|
||||||
extension = '',
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
// Processing options
|
let quality = 80;
|
||||||
// Format: /rs:<type>:<width>:<height>:<enlarge>/g:<gravity>
|
if (extension) quality = 90;
|
||||||
const processingOptions = [
|
|
||||||
`rs:${resizing_type}:${width}:${height}:${enlarge ? 1 : 0}`,
|
|
||||||
`g:${gravity}`,
|
|
||||||
].join('/');
|
|
||||||
|
|
||||||
// Using Base64 encoding for the source URL.
|
// Re-map imgproxy URL to our new parameter structure
|
||||||
// This completely eliminates any risk of intermediate proxies (Traefik/Next.js)
|
// e.g. /process?url=...&w=...&h=...&q=...&format=...
|
||||||
// URL-decoding the path, which corrupts the double-slash (// to /) and causes 403 errors.
|
const queryParams = new URLSearchParams({
|
||||||
// Imgproxy expects URL-safe Base64 (RFC 4648) without padding.
|
url: absoluteSrc,
|
||||||
const b64 =
|
});
|
||||||
typeof window === 'undefined'
|
|
||||||
? Buffer.from(absoluteSrc).toString('base64')
|
|
||||||
: btoa(unescape(encodeURIComponent(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}/process?${queryParams.toString()}`;
|
||||||
|
|
||||||
return `${baseUrl}/unsafe/${processingOptions}/${urlSafeB64}${suffix}`;
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <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
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
Reference in New Issue
Block a user