From ca7dc792b238065fafd72886d6fd2c76f58a39bd Mon Sep 17 00:00:00 2001 From: Yannic Kilcher Date: Sat, 25 Nov 2023 16:46:25 +0100 Subject: [PATCH] apparently, prod ignores redirects or process env --- website/next.config.js | 24 ------------------------ website/src/hooks/env/BrowserEnv.ts | 1 + website/src/pages/api/config.ts | 1 + website/src/pages/bye.tsx | 3 ++- website/src/pages/chat/[id].tsx | 10 +++++++++- website/src/pages/contributors.tsx | 9 +++++++++ website/src/pages/dashboard.tsx | 9 ++++++++- website/src/pages/index.tsx | 7 +++++++ website/src/types/Config.ts | 1 + website/types/env.d.ts | 1 + 10 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 website/src/pages/contributors.tsx diff --git a/website/next.config.js b/website/next.config.js index 0fee93b73f..911de0c25c 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -31,30 +31,6 @@ const nextConfig = { ignoreDuringBuilds: true, }, async redirects() { - if (process.env.BYE === "true") { - return [ - { - source: "/", - destination: "/bye", - permanent: false, - }, - { - source: "/dashboard", - destination: "/bye", - permanent: false, - }, - { - source: "/chat", - destination: "/bye", - permanent: false, - }, - { - source: "/contributors", - destination: "https://ykilcher.com/oa-contributors", - permanent: false, - }, - ]; - } if (process.env.MAINTENANCE_MODE !== "true") { return []; } diff --git a/website/src/hooks/env/BrowserEnv.ts b/website/src/hooks/env/BrowserEnv.ts index 4d863c0d9a..8ed2f357f9 100644 --- a/website/src/hooks/env/BrowserEnv.ts +++ b/website/src/hooks/env/BrowserEnv.ts @@ -1,6 +1,7 @@ import { createContext, useContext } from "react"; export interface BrowserConfig { + BYE: boolean; ENABLE_CHAT: boolean; ENABLE_DRAFTS_WITH_PLUGINS: boolean; NUM_GENERATED_DRAFTS: number; diff --git a/website/src/pages/api/config.ts b/website/src/pages/api/config.ts index 36c4a6b53d..33c9d8c70a 100644 --- a/website/src/pages/api/config.ts +++ b/website/src/pages/api/config.ts @@ -4,6 +4,7 @@ import { BrowserConfig } from "src/types/Config"; // don't put sensitive information here const config: BrowserConfig = { + BYE: boolean(process.env.BYE), ENABLE_CHAT: boolean(process.env.ENABLE_CHAT), ENABLE_DRAFTS_WITH_PLUGINS: boolean(process.env.ENABLE_DRAFTS_WITH_PLUGINS), NUM_GENERATED_DRAFTS: Number(process.env.NUM_GENERATED_DRAFTS), diff --git a/website/src/pages/bye.tsx b/website/src/pages/bye.tsx index 02ea848d50..0ad9018b04 100644 --- a/website/src/pages/bye.tsx +++ b/website/src/pages/bye.tsx @@ -1,4 +1,5 @@ import Image from "next/image"; +import Link from "next/link"; import { Container } from "src/components/Container"; export { getStaticProps } from "src/lib/defaultServerSideProps"; @@ -20,7 +21,7 @@ const ByePage = () => {

Links: