From c4dcbf7c7fe518ced97b2c64666cd2e72469f976 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 16 Apr 2024 00:13:44 -0400 Subject: [PATCH] re-route index controller --- app/routes/IdealEnigma.tsx | 32 -------------------- app/routes/Sonic.tsx | 34 +++++++++++++++++++++ app/routes/_index.tsx | 62 ++++++++++++++++++-------------------- 3 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 app/routes/IdealEnigma.tsx create mode 100644 app/routes/Sonic.tsx diff --git a/app/routes/IdealEnigma.tsx b/app/routes/IdealEnigma.tsx deleted file mode 100644 index dc7b46676a..0000000000 --- a/app/routes/IdealEnigma.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import type { HeadersFunction } from "@remix-run/deno"; -import { withProtectionRoute } from "~/modules/withProtectedRoute"; -import { PageEnigma } from "~/pages/PageEnigma"; - -// NB(bt): Netlify's custom directives cannot set headers for pages served by Remix, -// so we must specify them here instead. Netlify header rules (in either _headers or -// netlify.toml) will apply to statically served files (images, css, js), however. -// Setting these headers in `vite.config.ts` will also fail to apply them in -// production. -export const headers: HeadersFunction = ({ - actionHeaders, - errorHeaders, - loaderHeaders, - parentHeaders, -}) => ({ - // NB(bt): The following two headers are required for enabling SharedArrayBuffer (required by - // ffmpeg.wasm) in the post-SPECTRE world. Without these headers being sent by the page, the - // page cannot use SharedArrayBuffer. Downstream services must also set relevant CORS headers. - // - // See the following documentation on how this complex system works: - // - // - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements - // - https://stackoverflow.com/questions/73275184/enable-shared-array-buffer-in-cross-domain - // - https://blog.logrocket.com/understanding-sharedarraybuffer-and-cross-origin-isolation/ - // - https://github.com/ffmpegwasm/react-app/issues/3 - // - "Cross-Origin-Embedder-Policy": "require-corp", - "Cross-Origin-Opener-Policy": "same-origin", -}); - -const IdealEnigma = withProtectionRoute(()=>); -export default IdealEnigma; diff --git a/app/routes/Sonic.tsx b/app/routes/Sonic.tsx new file mode 100644 index 0000000000..0c0712364b --- /dev/null +++ b/app/routes/Sonic.tsx @@ -0,0 +1,34 @@ +import type { MetaFunction } from "@remix-run/deno"; +import { TopBarHelmet } from "~/modules/TopBarHelmet"; + +import sonic from "./_assets/sonic-the-hedgehog-classic-sonic.gif"; +import { useSignals } from "@preact/signals-react/runtime"; +import { useEffect } from "react"; +import { pageHeight, pageWidth } from "~/store"; +import { sidePanelWidth, timelineHeight } from "~/pages/PageEnigma/store"; + +export const meta: MetaFunction = () => { + return [ + { title: "New Remix App" }, + { name: "description", content: "Welcome to Remix!" }, + ]; +}; + +export default function Sonic() { + return ( +
+ {null} + sonic +
+ ); +} diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 26bce9aff5..8535f8ba3b 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,34 +1,32 @@ -import type { MetaFunction } from "@remix-run/deno"; -import { TopBarHelmet } from "~/modules/TopBarHelmet"; +import type { HeadersFunction } from "@remix-run/deno"; +import { withProtectionRoute } from "~/modules/withProtectedRoute"; +import { PageEnigma } from "~/pages/PageEnigma"; -import sonic from "./_assets/sonic-the-hedgehog-classic-sonic.gif"; -import { useSignals } from "@preact/signals-react/runtime"; -import { useEffect } from "react"; -import { pageHeight, pageWidth } from "~/store"; -import { sidePanelWidth, timelineHeight } from "~/pages/PageEnigma/store"; +// NB(bt): Netlify's custom directives cannot set headers for pages served by Remix, +// so we must specify them here instead. Netlify header rules (in either _headers or +// netlify.toml) will apply to statically served files (images, css, js), however. +// Setting these headers in `vite.config.ts` will also fail to apply them in +// production. +export const headers: HeadersFunction = ({ + actionHeaders, + errorHeaders, + loaderHeaders, + parentHeaders, +}) => ({ + // NB(bt): The following two headers are required for enabling SharedArrayBuffer (required by + // ffmpeg.wasm) in the post-SPECTRE world. Without these headers being sent by the page, the + // page cannot use SharedArrayBuffer. Downstream services must also set relevant CORS headers. + // + // See the following documentation on how this complex system works: + // + // - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements + // - https://stackoverflow.com/questions/73275184/enable-shared-array-buffer-in-cross-domain + // - https://blog.logrocket.com/understanding-sharedarraybuffer-and-cross-origin-isolation/ + // - https://github.com/ffmpegwasm/react-app/issues/3 + // + "Cross-Origin-Embedder-Policy": "require-corp", + "Cross-Origin-Opener-Policy": "same-origin", +}); -export const meta: MetaFunction = () => { - return [ - { title: "New Remix App" }, - { name: "description", content: "Welcome to Remix!" }, - ]; -}; - -export default function Index() { - return ( -
- {null} - sonic -
- ); -} +const Index = withProtectionRoute(()=>); +export default Index;