From 10a910d798155389c59c8931026445a00737570e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Bu=CC=88chele?= Date: Fri, 13 Sep 2024 17:30:25 +0100 Subject: [PATCH] routing for kult.cash --- app/entry.server.tsx | 15 +++++++++++++++ app/routes/learn.tsx | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 app/routes/learn.tsx diff --git a/app/entry.server.tsx b/app/entry.server.tsx index 2df1656..9762486 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -20,6 +20,8 @@ Sentry.init({ export const handleError = Sentry.sentryHandleError; +const KULT_CASH_PATH_PREFIXES = new Set(['$$', 'learn']); + export default async function handleRequest( request: Request, responseStatusCode: number, @@ -30,6 +32,19 @@ export default async function handleRequest( return await sitemap(request, remixContext); } + const url = new URL(request.url); + if (KULT_CASH_PATH_PREFIXES.has(url.pathname.split('/')?.at(1))) { + if (url.hostname === 'kult.cash') { + // we are good + } else if (url.hostname === 'localhost') { + console.warn( + `Accessing ${url.pathname} in production is only possible via kult.cash`, + ); + } else { + return new Response('Not Found', {status: 404}); + } + } + const App = ; await getDataFromTree(App); const initialState = apolloClient.extract(); diff --git a/app/routes/learn.tsx b/app/routes/learn.tsx new file mode 100644 index 0000000..f9d0082 --- /dev/null +++ b/app/routes/learn.tsx @@ -0,0 +1,6 @@ +import type {LoaderFunctionArgs} from '@remix-run/node'; +import {redirect} from 'remix-typedjson'; + +export async function loader(args: LoaderFunctionArgs) { + throw redirect('https://www.youtube.com/watch?v=2arxBGrjBgI'); +}