Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws/bin/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ new Environment(app, {
stripePublishableKey:
'pk_test_51R8r2g2ejpbHZUu9RxWKmyDJTK7amXkB4vE5nRhrd0qvWCnViJsazl9oNjM144gwopnJi1zi3abUk3W4qEk7aWLy00fVUZIeTO',
userRegistrationAllowlist: ['.*@ccb\\.sh', '.*@paragoncybersecurity\\.sh'],
noIndex: true,
});

new Environment(app, {
Expand Down
2 changes: 2 additions & 0 deletions aws/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface Props {
pricing: Pricing;
stripeEventSourceName?: string;
userRegistrationAllowlist?: string[];
noIndex?: boolean;
}

export class Environment {
Expand Down Expand Up @@ -72,6 +73,7 @@ export class Environment {
stripeSecretKeySecretName: globalBaseStack.stripeSecretKeySecretName,
triggerReportGeneration: region === props.regions[0],
userRegistrationAllowlist: props.userRegistrationAllowlist,
noIndex: props.noIndex,
});
regionalStacks.push(regionalStack);
regionalStack.addDependency(globalBaseStack);
Expand Down
2 changes: 2 additions & 0 deletions aws/lib/regional-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ interface Props extends StackProps {
stripeSecretKeySecretName: string;
triggerReportGeneration?: boolean;
userRegistrationAllowlist?: string[];
noIndex?: boolean;
}

export class RegionalStack extends Stack {
Expand Down Expand Up @@ -330,6 +331,7 @@ export class RegionalStack extends Stack {
NEXT_PUBLIC_CDN_URL: `https://${s3BucketDistDomainName}/public/frontend`,
NEXT_PUBLIC_PUBLIC_S3_BUCKET_NAME: publicS3BucketName,
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: props.stripePublishableKey,
NEXT_PUBLIC_NO_INDEX: props.noIndex ? 'true' : '',
Copy link

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider explicitly setting NEXT_PUBLIC_NO_INDEX to 'false' when props.noIndex is not provided, instead of an empty string, to ensure consistent boolean handling.

Suggested change
NEXT_PUBLIC_NO_INDEX: props.noIndex ? 'true' : '',
NEXT_PUBLIC_NO_INDEX: props.noIndex ? 'true' : 'false',

Copilot uses AI. Check for mistakes.
OPENAPI_YAML: fs.readFileSync(path.join(__dirname, '../../backend/api/apispec/openapi.yaml'), 'utf8'),
},
directory: path.join(__dirname, '../../frontend'),
Expand Down
1 change: 1 addition & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ARG NEXT_PUBLIC_CDN_URL
ARG NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
ARG NEXT_PUBLIC_AWS_ACCOUNT_ID
ARG NEXT_PUBLIC_PUBLIC_S3_BUCKET_NAME
ARG NEXT_PUBLIC_NO_INDEX

RUN npm run generate
RUN npm run build
Expand Down
1 change: 1 addition & 0 deletions frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const nextConfig: NextConfig = {
? {
loader: 'custom',
loaderFile: './src/image-loader.ts',
Copy link

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that setting 'unoptimized: true' for the custom image loader is a deliberate decision, as it may impact image performance and optimization.

Suggested change
loaderFile: './src/image-loader.ts',
loaderFile: './src/image-loader.ts',
// Setting `unoptimized: true` because image optimization is handled externally by the CDN.

Copilot uses AI. Check for mistakes.
unoptimized: true,
}
: undefined,
experimental: {
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/app/(public-area)/articles/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArrowUturnLeftIcon } from '@heroicons/react/24/outline';
import type { Metadata } from 'next';
import type { Metadata, ResolvingMetadata } from 'next';
import Image from 'next/image';
import Link from 'next/link';

Expand All @@ -15,9 +15,10 @@ export async function generateStaticParams() {

type Props = { params: Promise<{ slug: string }> };

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata({ params }: Props, parent: ResolvingMetadata): Promise<Metadata> {
const { slug } = await params;
const article = articles[slug];
const previousImages = (await parent).openGraph?.images || [];

return {
title: article.title,
Expand All @@ -27,6 +28,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
description: article.description,
type: 'article',
publishedTime: article.date.toISOString(),
images: previousImages,
},
};
}
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ const geistMono = Geist_Mono({
});

export const metadata: Metadata = {
metadataBase: process.env.NEXT_PUBLIC_CDN_URL ? new URL(process.env.NEXT_PUBLIC_CDN_URL) : undefined,
openGraph: {
images: ['/images/opengraph.png'],
},
robots: process.env.NEXT_PUBLIC_NO_INDEX
? {
index: false,
follow: false,
}
: undefined,
title: {
template: '%s | Cloud Snitch',
default: 'Cloud Snitch',
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/image-loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

export default function imageLoader({ src }: { src: string }) {
if (!src.startsWith('/')) {
return src;
Expand Down
Loading