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