diff --git a/next.config.mjs b/next.config.mjs
index 9685eaf..00835c9 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -1,10 +1,20 @@
/** @type {import('next').NextConfig} */
+
+import { readFileSync } from 'fs';
+
+const { version } = JSON.parse(readFileSync('./package.json', 'utf-8'));
+
+console.log(`Version: ${version}`);
+
const nextConfig = {
reactStrictMode: false,
output: 'standalone',
images: {
unoptimized: true,
- }
+ },
+ env: {
+ VERSION: version,
+ },
};
export default nextConfig;
diff --git a/src/components/shared/ProfileInfo.tsx b/src/components/shared/ProfileInfo.tsx
index d7036c3..c6c8617 100644
--- a/src/components/shared/ProfileInfo.tsx
+++ b/src/components/shared/ProfileInfo.tsx
@@ -8,7 +8,7 @@ import { useToast } from "../ui/use-toast";
export default function ProfileInfo() {
const { updateContext, ...user } = useCurrentUser()
- const { immichURL, exImmichUrl } = useConfig();
+ const { immichURL, exImmichUrl, version } = useConfig();
const toast = useToast();
const handleLogout = () => logoutUser()
@@ -44,7 +44,7 @@ export default function ProfileInfo() {
>
)}
-
+
Made with ♥ by{" "}
+
+ v{version}
+
>
);
diff --git a/src/config/environment.ts b/src/config/environment.ts
index 7a5945d..08dc3b2 100644
--- a/src/config/environment.ts
+++ b/src/config/environment.ts
@@ -5,6 +5,7 @@ export const ENV = {
DATABASE_URL: (process.env.DATABASE_URL || `postgresql://${process.env.DB_USERNAME}:${process.env.DB_PASSWORD}@${(process.env.DB_HOST || 'immich_postgres')}:${(process.env.DB_PORT || '5432')}/${process.env.DB_DATABASE_NAME}`),
JWT_SECRET: process.env.JWT_SECRET as string,
SECURE_COOKIE: process.env.SECURE_COOKIE === 'true',
+ VERSION: process.env.VERSION
};
diff --git a/src/contexts/ConfigContext.tsx b/src/contexts/ConfigContext.tsx
index 9c742cf..af5b2f8 100644
--- a/src/contexts/ConfigContext.tsx
+++ b/src/contexts/ConfigContext.tsx
@@ -3,11 +3,13 @@ import { createContext, useContext } from "react";
interface ConfigContextType {
immichURL: string;
exImmichUrl: string;
+ version?: string;
}
const ConfigContext = createContext
({
immichURL: "",
exImmichUrl: "",
+ version: "",
});
export default ConfigContext;
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index d3eaa84..802034b 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -4,14 +4,12 @@ import type { AppProps } from "next/app";
import { ThemeProvider } from "next-themes";
import { ENV } from "@/config/environment";
import ConfigContext from "@/contexts/ConfigContext";
-import { useEffect, useRef, useState } from "react";
-import { getMe } from "@/handlers/api/user.handler";
-import { db } from "@/config/db";
-
+import { useRef } from "react";
interface AppPropsWithProps extends AppProps {
props: {
immichURL: string;
exImmichUrl: string;
+ version?: string;
};
}
const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
@@ -29,10 +27,12 @@ const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
};
App.getInitialProps = async () => {
+
return {
props: {
exImmichUrl: ENV.EXTERNAL_IMMICH_URL,
immichURL: ENV.IMMICH_URL,
+ version: ENV.VERSION
},
};
};