mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-05 22:29:16 +01:00
📈 Fix env
This commit is contained in:
@@ -55,7 +55,7 @@ const env = createEnv({
|
||||
DATABASE_URL: process.env.DATABASE_URL,
|
||||
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
|
||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
||||
NEXT_PUBLIC_DISABLE_ANALYTICS: process.env.NEXT_PUBLIC_DISABLE_ANALYTICS,
|
||||
NEXT_PUBLIC_DISABLE_ANALYTICS: process.env.DISABLE_ANALYTICS,
|
||||
DOCKER_HOST: process.env.DOCKER_HOST,
|
||||
DOCKER_PORT: process.env.DOCKER_PORT,
|
||||
VERCEL_URL: process.env.VERCEL_URL,
|
||||
|
||||
@@ -46,6 +46,7 @@ function App(
|
||||
environmentColorScheme: MantineColorScheme;
|
||||
packageAttributes: ServerSidePackageAttributesType;
|
||||
editModeEnabled: boolean;
|
||||
analyticsEnabled: boolean;
|
||||
config?: ConfigType;
|
||||
primaryColor?: MantineTheme['primaryColor'];
|
||||
secondaryColor?: MantineTheme['primaryColor'];
|
||||
@@ -56,6 +57,7 @@ function App(
|
||||
}>
|
||||
) {
|
||||
const { Component, pageProps } = props;
|
||||
const analyticsEnabled = pageProps.analyticsEnabled ?? true;
|
||||
// TODO: make mapping from our locales to moment locales
|
||||
const language = getLanguageByCode(pageProps.session?.user?.language ?? 'en');
|
||||
require(`dayjs/locale/${language.locale}.js`);
|
||||
@@ -93,12 +95,12 @@ function App(
|
||||
return (
|
||||
<>
|
||||
<CommonHead />
|
||||
{env.NEXT_PUBLIC_DISABLE_ANALYTICS !== 'true' && (
|
||||
{analyticsEnabled === true && (
|
||||
<Script
|
||||
src="https://umami.homarr.dev/script.js"
|
||||
data-website-id="f133f10c-30a7-4506-889c-3a803f328fa4"
|
||||
strategy="lazyOnload"
|
||||
/>
|
||||
src="https://umami.homarr.dev/script.js"
|
||||
data-website-id="f133f10c-30a7-4506-889c-3a803f328fa4"
|
||||
strategy="lazyOnload"
|
||||
/>
|
||||
)}
|
||||
<SessionProvider session={pageProps.session}>
|
||||
<ColorSchemeProvider {...pageProps}>
|
||||
@@ -152,6 +154,8 @@ App.getInitialProps = async ({ ctx }: { ctx: GetServerSidePropsContext }) => {
|
||||
);
|
||||
}
|
||||
|
||||
const analyticsEnabled = env.NEXT_PUBLIC_DISABLE_ANALYTICS !== 'true';
|
||||
|
||||
const session = await getSession(ctx);
|
||||
|
||||
// Set the cookie language to the user language if it is not set correctly
|
||||
@@ -164,6 +168,7 @@ App.getInitialProps = async ({ ctx }: { ctx: GetServerSidePropsContext }) => {
|
||||
pageProps: {
|
||||
...getActiveColorScheme(session, ctx),
|
||||
packageAttributes: getServiceSidePackageAttributes(),
|
||||
analyticsEnabled,
|
||||
session,
|
||||
locale: ctx.locale ?? 'en',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user