From af1410a41a1ebb72c62966e5b70a5569937314f3 Mon Sep 17 00:00:00 2001 From: Oksamies Date: Thu, 4 Sep 2025 22:10:34 +0300 Subject: [PATCH] Rename window.ENV to reduce clashing with other scripts In some cases 3rd party scripts, like ads, will try to use such generic name as window.ENV --- apps/cyberstorm-remix/app/root.tsx | 22 ++++++++----------- .../cyberstorm/security/publicEnvVariables.ts | 10 ++++----- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index 08a25635a..00b897a09 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -38,7 +38,7 @@ import { } from "@thunderstore/ts-api-react/src/SessionContext"; import { getPublicEnvVariables, - publicEnvVariables, + publicEnvVariablesType, } from "cyberstorm/security/publicEnvVariables"; import { StorageManager } from "@thunderstore/ts-api-react/src/storage"; @@ -47,7 +47,7 @@ import { StorageManager } from "@thunderstore/ts-api-react/src/storage"; declare global { interface Window { - ENV: publicEnvVariables; + NIMBUS_PUBLIC_ENV: publicEnvVariablesType; Dapper: DapperTs; nitroAds?: { createAd: ( @@ -104,9 +104,7 @@ export async function loader() { sessionId: undefined, }; return { - publicEnvVariables: { - ENV: publicEnvVariables, - }, + publicEnvVariables: publicEnvVariables, currentUser: undefined, config, }; @@ -137,9 +135,7 @@ export async function clientLoader() { const currentUser = await sessionTools.getSessionCurrentUser(); const config = sessionTools.getConfig(publicEnvVariables.VITE_API_URL); return { - publicEnvVariables: { - ENV: publicEnvVariables, - }, + publicEnvVariables: publicEnvVariables, currentUser: currentUser.username ? currentUser : undefined, config, }; @@ -221,8 +217,8 @@ export function Layout({ children }: { children: React.ReactNode }) {