diff --git a/src/app/harbor/shipyard/new-ship-form.tsx b/src/app/harbor/shipyard/new-ship-form.tsx index 191324ab..d503974b 100644 --- a/src/app/harbor/shipyard/new-ship-form.tsx +++ b/src/app/harbor/shipyard/new-ship-form.tsx @@ -157,6 +157,28 @@ export default function NewShipForm({ return } + if (!screenshotUrl.startsWith('https://')) { + toast({ + title: "That screenshot doesn't work!", + description: + 'Please use http or https links (no data urls), please host your files in #cdn!', + }) + setStaging(false) + return + } + if ( + deploymentUrl.includes('localhost') || + deploymentUrl.includes('127.0.0.1') + ) { + toast({ + title: "That's not a demo link!", + description: + 'Please make sure your link isnt a local link.. Please submit a deployed link instead!', + }) + setStaging(false) + return + } + if (readmeUrl.includes('github.com')) { toast({ title: "This isn't a markdown link!", diff --git a/src/middleware.ts b/src/middleware.ts index 457c3912..1705eba7 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -22,7 +22,13 @@ async function loadShipsCookie( const ships = await fetchShips(slackId, 3) response.cookies.set({ name: 'ships', - value: JSON.stringify(ships), + value: JSON.stringify( + ships.map((s) => { + if (s.screenshotUrl.startsWith('data:')) + s.screenshotUrl = `replace_me_with_a_non_dataencoded_url_plz` + return s + }), + ), path: '/', sameSite: 'strict', expires: new Date(Date.now() + 5 * 60 * 1000), // In 5 mins