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} */ /** @type {import('next').NextConfig} */
import { readFileSync } from 'fs';
const { version } = JSON.parse(readFileSync('./package.json', 'utf-8'));
console.log(`Version: ${version}`);
const nextConfig = { const nextConfig = {
reactStrictMode: false, reactStrictMode: false,
output: 'standalone', output: 'standalone',
images: { images: {
unoptimized: true, unoptimized: true,
} },
env: {
VERSION: version,
},
}; };
export default nextConfig; export default nextConfig;
+5 -2
View File
@@ -8,7 +8,7 @@ import { useToast } from "../ui/use-toast";
export default function ProfileInfo() { export default function ProfileInfo() {
const { updateContext, ...user } = useCurrentUser() const { updateContext, ...user } = useCurrentUser()
const { immichURL, exImmichUrl } = useConfig(); const { immichURL, exImmichUrl, version } = useConfig();
const toast = useToast(); const toast = useToast();
const handleLogout = () => logoutUser() const handleLogout = () => logoutUser()
@@ -44,7 +44,7 @@ export default function ProfileInfo() {
</> </>
)} )}
</div> </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> <p>
Made with <span className="text-red-500">&hearts;</span> by{" "} Made with <span className="text-red-500">&hearts;</span> by{" "}
<Link <Link
@@ -55,6 +55,9 @@ export default function ProfileInfo() {
@zathvarun @zathvarun
</Link> </Link>
</p> </p>
<Link target="_blank" href={`https://github.com/varun-raj/immich-power-tools/releases/tag/v${version}`}>
v{version}
</Link>
</div> </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}`), 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, JWT_SECRET: process.env.JWT_SECRET as string,
SECURE_COOKIE: process.env.SECURE_COOKIE === 'true', 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 { interface ConfigContextType {
immichURL: string; immichURL: string;
exImmichUrl: string; exImmichUrl: string;
version?: string;
} }
const ConfigContext = createContext<ConfigContextType>({ const ConfigContext = createContext<ConfigContextType>({
immichURL: "", immichURL: "",
exImmichUrl: "", exImmichUrl: "",
version: "",
}); });
export default ConfigContext; export default ConfigContext;
+4 -4
View File
@@ -4,14 +4,12 @@ import type { AppProps } from "next/app";
import { ThemeProvider } from "next-themes"; import { ThemeProvider } from "next-themes";
import { ENV } from "@/config/environment"; import { ENV } from "@/config/environment";
import ConfigContext from "@/contexts/ConfigContext"; import ConfigContext from "@/contexts/ConfigContext";
import { useEffect, useRef, useState } from "react"; import { useRef } from "react";
import { getMe } from "@/handlers/api/user.handler";
import { db } from "@/config/db";
interface AppPropsWithProps extends AppProps { interface AppPropsWithProps extends AppProps {
props: { props: {
immichURL: string; immichURL: string;
exImmichUrl: string; exImmichUrl: string;
version?: string;
}; };
} }
const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => { const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
@@ -29,10 +27,12 @@ const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
}; };
App.getInitialProps = async () => { App.getInitialProps = async () => {
return { return {
props: { props: {
exImmichUrl: ENV.EXTERNAL_IMMICH_URL, exImmichUrl: ENV.EXTERNAL_IMMICH_URL,
immichURL: ENV.IMMICH_URL, immichURL: ENV.IMMICH_URL,
version: ENV.VERSION
}, },
}; };
}; };