diff --git a/app/(app)/ads/slots/page.tsx b/app/(app)/ads/slots/page.tsx index fd0a50b1..b0fffe1d 100644 --- a/app/(app)/ads/slots/page.tsx +++ b/app/(app)/ads/slots/page.tsx @@ -95,7 +95,15 @@ export default async function SlotsPage() { ← Ad campaigns -

Monetize your site

+
+

Monetize your site

+ {/* Always-visible way to add a site to monetize — a site is a project, + so this starts the project-creation flow. Previously the only link + to it was hidden inside the empty state. */} + + Monetize a new site + +

Show CrawlProof network ads on your site and earn crypto for the clicks. Opt a project in, drop one tag on your page, and add a payout wallet. @@ -104,7 +112,7 @@ export default async function SlotsPage() { {projects.length === 0 ? (

You have no projects yet.{" "} - + Create one {" "} to enable a slot. diff --git a/app/(app)/projects/new/form.tsx b/app/(app)/projects/new/form.tsx index 15759dec..016e543c 100644 --- a/app/(app)/projects/new/form.tsx +++ b/app/(app)/projects/new/form.tsx @@ -4,6 +4,11 @@ import { useState, useTransition } from "react"; import { useRouter } from "next/navigation"; import { createProject } from "@/app/actions/createProject"; +// Only honour same-site relative paths (guards against open redirects). +function safeNext(next: string | null | undefined): string | null { + return next && next.startsWith("/") && !next.startsWith("//") ? next : null; +} + function deriveName(url: string): string { if (!url) return ""; try { @@ -14,8 +19,11 @@ function deriveName(url: string): string { } } -export function NewProjectForm() { +export function NewProjectForm({ next }: { next?: string | null }) { const router = useRouter(); + // e.g. /projects/new?next=/ads/slots — return to Monetize after creating so + // the new site is right there to "Enable ads". + const nextPath = safeNext(next); const [pending, startTransition] = useTransition(); const [name, setName] = useState(""); const [nameTouched, setNameTouched] = useState(false); @@ -41,7 +49,7 @@ export function NewProjectForm() { setError(res.error ?? "Could not create project."); return; } - router.push(`/projects/${res.id}`); + router.push(nextPath ?? `/projects/${res.id}`); }); } diff --git a/app/(app)/projects/new/page.tsx b/app/(app)/projects/new/page.tsx index 306d4fb6..c7ba04a4 100644 --- a/app/(app)/projects/new/page.tsx +++ b/app/(app)/projects/new/page.tsx @@ -3,7 +3,12 @@ import { NewProjectForm } from "./form"; export const metadata = { title: "New project" }; -export default function NewProjectPage() { +export default async function NewProjectPage({ + searchParams, +}: { + searchParams: Promise<{ next?: string }>; +}) { + const { next } = await searchParams; return (
@@ -13,7 +18,7 @@ export default function NewProjectPage() {

Group audits under one project. You can also schedule weekly re-audits on Pro.

- +
); }