Skip to content

Commit

Permalink
routing for kult.cash
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbuechele committed Sep 13, 2024
1 parent e4d2934 commit 10a910d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Sentry.init({

export const handleError = Sentry.sentryHandleError;

const KULT_CASH_PATH_PREFIXES = new Set<string | undefined>(['$$', 'learn']);

export default async function handleRequest(
request: Request,
responseStatusCode: number,
Expand All @@ -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 = <RemixServer context={remixContext} url={request.url} />;
await getDataFromTree(App);
const initialState = apolloClient.extract();
Expand Down
6 changes: 6 additions & 0 deletions app/routes/learn.tsx
Original file line number Diff line number Diff line change
@@ -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');
}

0 comments on commit 10a910d

Please sign in to comment.