File tree Expand file tree Collapse file tree 10 files changed +39
-27
lines changed
Expand file tree Collapse file tree 10 files changed +39
-27
lines changed Original file line number Diff line number Diff line change @@ -31,30 +31,6 @@ const nextConfig = {
3131 ignoreDuringBuilds : true ,
3232 } ,
3333 async redirects ( ) {
34- if ( process . env . BYE === "true" ) {
35- return [
36- {
37- source : "/" ,
38- destination : "/bye" ,
39- permanent : false ,
40- } ,
41- {
42- source : "/dashboard" ,
43- destination : "/bye" ,
44- permanent : false ,
45- } ,
46- {
47- source : "/chat" ,
48- destination : "/bye" ,
49- permanent : false ,
50- } ,
51- {
52- source : "/contributors" ,
53- destination : "https://ykilcher.com/oa-contributors" ,
54- permanent : false ,
55- } ,
56- ] ;
57- }
5834 if ( process . env . MAINTENANCE_MODE !== "true" ) {
5935 return [ ] ;
6036 }
Original file line number Diff line number Diff line change 11import { createContext , useContext } from "react" ;
22
33export interface BrowserConfig {
4+ BYE : boolean ;
45 ENABLE_CHAT : boolean ;
56 ENABLE_DRAFTS_WITH_PLUGINS : boolean ;
67 NUM_GENERATED_DRAFTS : number ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { BrowserConfig } from "src/types/Config";
44
55// don't put sensitive information here
66const config : BrowserConfig = {
7+ BYE : boolean ( process . env . BYE ) ,
78 ENABLE_CHAT : boolean ( process . env . ENABLE_CHAT ) ,
89 ENABLE_DRAFTS_WITH_PLUGINS : boolean ( process . env . ENABLE_DRAFTS_WITH_PLUGINS ) ,
910 NUM_GENERATED_DRAFTS : Number ( process . env . NUM_GENERATED_DRAFTS ) ,
Original file line number Diff line number Diff line change 11import Image from "next/image" ;
2+ import Link from "next/link" ;
23import { Container } from "src/components/Container" ;
34export { getStaticProps } from "src/lib/defaultServerSideProps" ;
45
@@ -20,7 +21,7 @@ const ByePage = () => {
2021 < h2 className = "text-2xl font-bold mt-4 mb-2" > Links:</ h2 >
2122 < ul className = "text-2xl list-none text-blue-500" >
2223 < li >
23- < a href = "/contributors" > List of contributors</ a >
24+ < Link href = "/contributors" > List of contributors</ Link >
2425 </ li >
2526 < li >
2627 < a href = "https://ykilcher.com/oa-paper" > Paper</ a >
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ import { get } from "src/lib/api";
88import { ModelInfo , PluginEntry } from "src/types/Chat" ;
99export { getServerSideProps } from "src/lib/defaultServerSideProps" ;
1010import useSWRImmutable from "swr/immutable" ;
11+ import { useBrowserConfig } from "src/hooks/env/BrowserEnv" ;
1112
1213const Chat = ( ) => {
13- const { query } = useRouter ( ) ;
14+ const { BYE } = useBrowserConfig ( ) ;
15+ const router = useRouter ( ) ;
16+ const { query } = router ;
1417 const id = query . id as string ;
1518 const { t } = useTranslation ( [ "common" , "chat" ] ) ;
1619 const { data : modelInfos } = useSWRImmutable < ModelInfo [ ] > ( "/api/chat/models" , get , {
@@ -20,6 +23,11 @@ const Chat = () => {
2023 keepPreviousData : true ,
2124 } ) ;
2225
26+ if ( BYE ) {
27+ router . push ( "/bye" ) ;
28+ return null ;
29+ }
30+
2331 return (
2432 < >
2533 < Head >
Original file line number Diff line number Diff line change 1+ import { useRouter } from "next/router" ;
2+
3+ const ContributorsPage = ( ) => {
4+ const router = useRouter ( ) ;
5+ router . push ( "https://ykilcher.com/oa-contributors" ) ;
6+ return null ;
7+ } ;
8+
9+ export default ContributorsPage ;
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ import { useBrowserConfig } from "src/hooks/env/BrowserEnv";
1414import { useCurrentLocale } from "src/hooks/locale/useCurrentLocale" ;
1515import { API_ROUTES } from "src/lib/routes" ;
1616import useSWR from "swr" ;
17+ import { useRouter } from "next/router" ;
1718
1819const Dashboard = ( ) => {
1920 const { t } = useTranslation ( [ "dashboard" , "common" , "tasks" ] ) ;
20- const { ENABLE_CHAT } = useBrowserConfig ( ) ;
21+ const { ENABLE_CHAT , BYE } = useBrowserConfig ( ) ;
22+ const router = useRouter ( ) ;
2123 const lang = useCurrentLocale ( ) ;
2224 const { data } = useSWR < AvailableTasks > ( API_ROUTES . AVAILABLE_TASK ( { lang } ) , get , {
2325 refreshInterval : 2 * 60 * 1000 , //2 minutes
@@ -55,6 +57,11 @@ const Dashboard = () => {
5557 } ,
5658 } ;
5759
60+ if ( BYE ) {
61+ router . push ( "/bye" ) ;
62+ return null ;
63+ }
64+
5865 return (
5966 < >
6067 < Head >
Original file line number Diff line number Diff line change @@ -8,8 +8,10 @@ import { CallToAction } from "src/components/CallToAction";
88import { Faq } from "src/components/Faq" ;
99import { Hero } from "src/components/Hero" ;
1010export { getDefaultServerSideProps as getStaticProps } from "src/lib/defaultServerSideProps" ;
11+ import { useBrowserConfig } from "src/hooks/env/BrowserEnv" ;
1112
1213const Home = ( ) => {
14+ const { BYE } = useBrowserConfig ( ) ;
1315 const router = useRouter ( ) ;
1416 const { status } = useSession ( ) ;
1517 const { t } = useTranslation ( ) ;
@@ -19,6 +21,11 @@ const Home = () => {
1921 }
2022 } , [ router , status ] ) ;
2123
24+ if ( BYE ) {
25+ router . push ( "/bye" ) ;
26+ return null ;
27+ }
28+
2229 return (
2330 < >
2431 < Head >
Original file line number Diff line number Diff line change 11export interface BrowserConfig {
2+ BYE : boolean ;
23 ENABLE_CHAT : boolean ;
34 ENABLE_DRAFTS_WITH_PLUGINS : boolean ; // Whether draft messages should be generated if plugins are in use
45 NUM_GENERATED_DRAFTS : number ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ declare global {
99 ADMIN_USERS : string ;
1010 MODERATOR_USERS : string ;
1111 INFERENCE_SERVER_HOST : string ;
12+ BYE : boolean ;
1213 ENABLE_CHAT : boolean ;
1314 ENABLE_DRAFTS_WITH_PLUGINS : boolean ;
1415 NUM_GENERATED_DRAFTS : number ;
You can’t perform that action at this time.
0 commit comments