feat: added version

Signed-off-by: Varun Raj <mailme@varunraj.in>
This commit is contained in:
Varun Raj committed 2024-09-07 20:24:18 +05:30
1 parent 610cd0e899
commit 574f83615e
5 files changed
+23 -7

No files matched your search

+11 -1
View File
@@ -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;
+5 -2
View File
@@ -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() {
</>
)}
</div>
<div className="border text-muted-foreground text-xs text-center py-2">
<div className="border text-muted-foreground text-xs py-2 flex justify-between items-center px-2">
<p>
Made with <span className="text-red-500">&hearts;</span> by{" "}
<Link
@@ -55,6 +55,9 @@ export default function ProfileInfo() {
@zathvarun
</Link>
</p>
<Link target="_blank" href={`https://github.com/varun-raj/immich-power-tools/releases/tag/v${version}`}>
v{version}
</Link>
</div>
</>
);
+1
View File
@@ -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
};
+2
View File
@@ -3,11 +3,13 @@ import { createContext, useContext } from "react";
interface ConfigContextType {
immichURL: string;
exImmichUrl: string;
version?: string;
}
const ConfigContext = createContext<ConfigContextType>({
immichURL: "",
exImmichUrl: "",
version: "",
});
export default ConfigContext;
+4 -4
View File
@@ -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
},
};
};