From b2f38529d004821974daae455473c0f16d30e639 Mon Sep 17 00:00:00 2001 From: "Robert J. Simmons" <442315+robsimmons@users.noreply.github.com> Date: Sun, 31 Mar 2024 20:16:54 -0400 Subject: [PATCH] Change dev twelf-wasm redirect strategy (#31) Hopefully the new strategy is one that works --- wiki/astro.config.mjs | 11 +++++---- wiki/src/pages/twelf-wasm/[...path].ts | 31 -------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 wiki/src/pages/twelf-wasm/[...path].ts diff --git a/wiki/astro.config.mjs b/wiki/astro.config.mjs index 8988a1da..d120c891 100644 --- a/wiki/astro.config.mjs +++ b/wiki/astro.config.mjs @@ -5,12 +5,11 @@ import starlightLinksValidator from "starlight-links-validator"; // https://astro.build/config export default defineConfig({ site: "https://twelf.org", - redirects: - import.meta.env.MODE === "development" - ? { - "/twelf-wasm/": "/twelf-wasm/index.html", - } - : {}, + redirects: import.meta.env.DEV + ? { + "/twelf-wasm/": "https://jcreedcmu.github.io/twelf-wasm/", + } + : {}, trailingSlash: "always", integrations: [ starlight({ diff --git a/wiki/src/pages/twelf-wasm/[...path].ts b/wiki/src/pages/twelf-wasm/[...path].ts deleted file mode 100644 index 1398af5f..00000000 --- a/wiki/src/pages/twelf-wasm/[...path].ts +++ /dev/null @@ -1,31 +0,0 @@ -export function getStaticPaths() { - /* - * On render.com, all these rewrites are handled by a generic Apache-style - * URL rewriting scheme that proxies /twelf-wasm/whatever to - * . This list only has - * to be right in order for the local development server to work correctly. - * That means it's likely to fix if Jason changes something about - * twelf-wasm, but only for local development, and it should be easy to fix - * (just figure out which files aren't being found and add them to the - * static paths). - */ - return [ - { params: { path: "assets/bundle.js" } }, - { params: { path: "assets/twelf.wasm" } }, - { params: { path: "assets/twelf-icon.png" } }, - { params: { path: "assets/worker.js" } }, - { params: { path: "css/style.css" } }, - { params: { path: "index.html" } }, - ]; -} - -import type { APIRoute } from "astro"; - -export const prerender = false; -export const GET: APIRoute = async ({ url }) => { - return new Response( - await fetch(`https://jcreedcmu.github.io${url.pathname}`).then((response) => - response.blob() - ) - ); -};