updated env variable name

This commit is contained in:
akdeb 2025-04-25 20:55:14 +01:00
parent 5e6baf1255
commit 67eecbb115
5 changed files with 12 additions and 9 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -1,5 +1,5 @@
# If you want to skip device registration, set this to True. Set to False in production. # 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 # Update these with your Supabase details from your project settings > API
# https://app.supabase.com/project/_/settings/api # https://app.supabase.com/project/_/settings/api

View file

@ -3,7 +3,8 @@ import jwt from "jsonwebtoken";
import { createClient } from "@/utils/supabase/server"; import { createClient } from "@/utils/supabase/server";
const ALGORITHM = "HS256"; const ALGORITHM = "HS256";
const skipDeviceRegistration = process.env.SKIP_DEVICE_REGISTRATION === "True"; const skipDeviceRegistration =
process.env.NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION === "True";
interface TokenPayload { interface TokenPayload {
[key: string]: any; [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. * Otherwise, we use the user by given by the mac address.
* *
* Steps to register your device: * Steps to register your device:
* 1: Register the device `mac_address` and `user_code` in the `devices` tables. * 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`. * 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; let user;
if (skipDeviceRegistration) { if (skipDeviceRegistration) {

View file

@ -1,3 +1,4 @@
"use client";
import { connectUserToDevice, signOutAction } from "@/app/actions"; import { connectUserToDevice, signOutAction } from "@/app/actions";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@ -19,6 +20,9 @@ interface AppSettingsProps {
heading: React.ReactNode; heading: React.ReactNode;
} }
const skipDeviceRegistration = process.env.NEXT_PUBLIC_SKIP_DEVICE_REGISTRATION === "True";
const AppSettings: React.FC<AppSettingsProps> = ({ const AppSettings: React.FC<AppSettingsProps> = ({
selectedUser, selectedUser,
heading, heading,
@ -88,8 +92,6 @@ const AppSettings: React.FC<AppSettingsProps> = ({
}); });
} }
const skipDeviceRegistration = process.env.SKIP_DEVICE_REGISTRATION === "True";
return ( return (
<> <>
<GeneralUserForm <GeneralUserForm
@ -100,7 +102,7 @@ const AppSettings: React.FC<AppSettingsProps> = ({
onClickCallback={() => handleSave()} onClickCallback={() => handleSave()}
/> />
<section className="space-y-4 max-w-screen-sm mt-12"> <div className="space-y-4 max-w-screen-sm mt-12">
<h2 className="text-lg font-semibold border-b border-gray-200 pb-2"> <h2 className="text-lg font-semibold border-b border-gray-200 pb-2">
Device settings Device settings
</h2> </h2>
@ -195,7 +197,7 @@ const AppSettings: React.FC<AppSettingsProps> = ({
</Button> </Button>
</form> </form>
</div> </div>
</section> </div>
</> </>
); );
}; };

View file

@ -12,7 +12,7 @@ import { fetchGithubStars } from "./actions";
export default async function LandingPage() { export default async function LandingPage() {
const supabase = createClient(); const supabase = createClient();
const { stars } = await fetchGithubStars("akdeb/ElatoAI"); const { stars = 0 } = await fetchGithubStars("akdeb/ElatoAI");
const allPersonalities = await getAllPersonalities(supabase); const allPersonalities = await getAllPersonalities(supabase);
const adultPersonalities = allPersonalities.filter((personality) => !personality.is_story && !personality.is_child_voice); const adultPersonalities = allPersonalities.filter((personality) => !personality.is_story && !personality.is_child_voice);