From 67eecbb115830fb8958736a497e03b29ffb3e2d0 Mon Sep 17 00:00:00 2001 From: akdeb Date: Fri, 25 Apr 2025 20:55:14 +0100 Subject: [PATCH] updated env variable name --- .DS_Store | Bin 10244 -> 10244 bytes frontend-nextjs/.env.example | 2 +- .../app/api/generate_auth_token/route.ts | 7 ++++--- .../app/components/Settings/AppSettings.tsx | 10 ++++++---- frontend-nextjs/app/page.tsx | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.DS_Store b/.DS_Store index a2de8ffa3c90219a102c452c81ec460ab5d6762f..0f06e701ce9657da6e220e045a32228889acab5b 100644 GIT binary patch delta 1528 zcmeH`OH30{6o&7AL1<+P(+0|P%0sDwL1T*|!FLg*LPZD^D362`I*lWJV5bEoF@;Dp z8XwV7w-||uxk=@fed{$_DVkbRt|s+(oQlF%f0 zT_JHm*y{=jQa7s`5QV{p{*V~(ORYjsQdX1ILgGU`k(ryfdTpt>eCy6VHFXE&3pte$ zR;%L-Jnszmh)2R==oo8Ksphg2Z+-#Kbh(vR>jQ4lBMNTzo=P2$6czA%XDm`36qMPW zyii=iGY&~n$GVaS*Kc4LN1y0-vywV-)l$arEnZiT;AP$F*gs~iZc7Ejw+$q;vi7)F ztJ{{%@Xp?V&nNgpQqs3;H_yxG^c-KU7#-3fS5Rme^b5h{|F&3oR2#?J9lImiVE1Bzfq88%@vc3?khQHN$Y(Sc5MAtK-~yzs$~ zK^#W}!x+ICT*75s!BvdmCT`(2rtt(%@eI%L3Q@endwjxo{J;XGl%X1$NpmSjd1|B^ zshL*NDq2Hr3F#Ec6xx@jM4ie$OEwt`WHXn6ad|su(Aa7j`;y8k`|HY@GNj@EP<>6J z%YfCq;lq7SYR!V1r$7{UpR;v`Pt zw8B(YsK%IH!*z_~1}1O^lbFH-Jj4uU@mQh!0&{qa=pXD3EM!yZTQb^nD-0y^IDMr delta 1580 zcmeH{Sx8i26vw~+m&=UZ@>Zjcqqp3m6t%$$Z86j=w_HbYT*~fvuX$_cj?EqSLJ1?N zG-4i#HtVS7laaC88pVh>(iv#h_j?ANt0bqM(-`2%-MMVojRl6d&n`=a^ zQC1~I-BjJCXo}4)TU%|))>g&c$;az-k3#ubvtwcfu3lmeik*_uq{tFKqSH@l=En*` zomaEkC9_rX8zd$PT&2ch5bqR%;era%sCNyZrtOz3Rd6@MxB5 z2@A2t8)CL3O$BH&MurL&p~~|hJhCUt(mRDLJ}b$GF8&+AN>y~o@mXfyT~BmGAZa9* ztRowVi*%EIa*&)L!{injC6CDq@{Wv?&j5m;M+m0F0230BjHO6N29_ZQr6@-QET~5_ z6l{iujvjQO8{4oGyRjGj7{CD>#UPI31Ww~3hB1OmxQ;uxi+gy8F}%WSyummo@CB1J zkVa4=jihljnWoTGnocw5a=L<+&{ArpBHc`#w8NJHg+H_P-!f!-Ae*$)6B`wmXxG|W zY<8!O3C{hx5~K6-3kr+AS7ORJ|%$VUmo z?1fx~4QPM}8zeZOq6J%_NeuON^q?0zu!jL3z&`B9AsogL9K%VRV$jdvEJJ=7S8xqC za1*1r?T7!Ip?{B$K78MC7XN^g9r4LabLfd_GGHh;W+K2-Y%KrZv)*6iU+LNIzu2>1 E0n7Apq5uE@ diff --git a/frontend-nextjs/.env.example b/frontend-nextjs/.env.example index 4d1a841..6220bbf 100644 --- a/frontend-nextjs/.env.example +++ b/frontend-nextjs/.env.example @@ -1,5 +1,5 @@ # If you want to skip device registration, set this to True. Set to False in production. -SKIP_DEVICE_REGISTRATION=True +NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION=True # Update these with your Supabase details from your project settings > API # https://app.supabase.com/project/_/settings/api diff --git a/frontend-nextjs/app/api/generate_auth_token/route.ts b/frontend-nextjs/app/api/generate_auth_token/route.ts index 2bf4270..962ee4b 100644 --- a/frontend-nextjs/app/api/generate_auth_token/route.ts +++ b/frontend-nextjs/app/api/generate_auth_token/route.ts @@ -3,7 +3,8 @@ import jwt from "jsonwebtoken"; import { createClient } from "@/utils/supabase/server"; const ALGORITHM = "HS256"; -const skipDeviceRegistration = process.env.SKIP_DEVICE_REGISTRATION === "True"; +const skipDeviceRegistration = + process.env.NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION === "True"; interface TokenPayload { [key: string]: any; @@ -71,13 +72,13 @@ export async function GET(req: Request) { } /** - * If `SKIP_DEVICE_REGISTRATION` is true, we use the default dev user. + * If `NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION` is true, we use the default dev user. * Otherwise, we use the user by given by the mac address. * * Steps to register your device: * 1: Register the device `mac_address` and `user_code` in the `devices` tables. * 2: Make sure the user adds the `user_code` to their account in Settings to link the device to their `user_id`. - * 3: When `SKIP_DEVICE_REGISTRATION` is false, we then fetch the user by `mac_address`. + * 3: When `NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION` is false, we then fetch the user by `mac_address`. */ let user; if (skipDeviceRegistration) { diff --git a/frontend-nextjs/app/components/Settings/AppSettings.tsx b/frontend-nextjs/app/components/Settings/AppSettings.tsx index 35546c6..9e8b724 100644 --- a/frontend-nextjs/app/components/Settings/AppSettings.tsx +++ b/frontend-nextjs/app/components/Settings/AppSettings.tsx @@ -1,3 +1,4 @@ +"use client"; import { connectUserToDevice, signOutAction } from "@/app/actions"; import { Button } from "@/components/ui/button"; @@ -19,6 +20,9 @@ interface AppSettingsProps { heading: React.ReactNode; } +const skipDeviceRegistration = process.env.NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION === "True"; + + const AppSettings: React.FC = ({ selectedUser, heading, @@ -88,8 +92,6 @@ const AppSettings: React.FC = ({ }); } - const skipDeviceRegistration = process.env.SKIP_DEVICE_REGISTRATION === "True"; - return ( <> = ({ onClickCallback={() => handleSave()} /> -
+

Device settings

@@ -195,7 +197,7 @@ const AppSettings: React.FC = ({
-
+ ); }; diff --git a/frontend-nextjs/app/page.tsx b/frontend-nextjs/app/page.tsx index 022f50b..9c2e952 100644 --- a/frontend-nextjs/app/page.tsx +++ b/frontend-nextjs/app/page.tsx @@ -12,7 +12,7 @@ import { fetchGithubStars } from "./actions"; export default async function LandingPage() { const supabase = createClient(); - const { stars } = await fetchGithubStars("akdeb/ElatoAI"); + const { stars = 0 } = await fetchGithubStars("akdeb/ElatoAI"); const allPersonalities = await getAllPersonalities(supabase); const adultPersonalities = allPersonalities.filter((personality) => !personality.is_story && !personality.is_child_voice);