chore: Implement redirection to external Immich URL if set
This commit is contained in:
1 parent
bcc62f37d8
commit
cc1c1ff6d5
4 files changed
+7
-2
No files matched your search
@@ -18,7 +18,7 @@ interface IProps {
|
||||
onRemove: (person: IPerson) => void;
|
||||
}
|
||||
export default function PersonItem({ person, onRemove }: IProps) {
|
||||
const { immichURL } = useConfig();
|
||||
const { exImmichUrl } = useConfig();
|
||||
const { toast } = useToast();
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -98,7 +98,7 @@ export default function PersonItem({ person, onRemove }: IProps) {
|
||||
<div className="absolute top-2 left-2 group-hover:block hidden">
|
||||
<Link
|
||||
className="bg-green-300 block rounded-lg px-2 py-1 text-sm dark:text-gray-900"
|
||||
href={`${immichURL}/people/${person.id}`}
|
||||
href={`${exImmichUrl}/people/${person.id}`}
|
||||
target="_blank"
|
||||
>
|
||||
<ArrowUpRight size={16} />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const ENV = {
|
||||
IMMICH_URL: (process.env.IMMICH_URL || 'http://immich_server:3001') as string,
|
||||
EXTERNAL_IMMICH_URL: (process.env.EXTERNAL_IMMICH_URL || process.env.IMMICH_URL) as string,
|
||||
IMMICH_API_KEY: process.env.IMMICH_API_KEY as string,
|
||||
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}`),
|
||||
};
|
||||
|
||||
@@ -2,10 +2,12 @@ import { createContext, useContext } from "react";
|
||||
|
||||
interface ConfigContextType {
|
||||
immichURL: string;
|
||||
exImmichUrl: string;
|
||||
}
|
||||
|
||||
const ConfigContext = createContext<ConfigContextType>({
|
||||
immichURL: "",
|
||||
exImmichUrl: "",
|
||||
});
|
||||
|
||||
export default ConfigContext;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getMe } from "@/handlers/api/user.handler";
|
||||
interface AppPropsWithProps extends AppProps {
|
||||
props: {
|
||||
immichURL: string;
|
||||
exImmichUrl: string;
|
||||
};
|
||||
}
|
||||
const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
|
||||
@@ -29,6 +30,7 @@ const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
|
||||
App.getInitialProps = async () => {
|
||||
return {
|
||||
props: {
|
||||
exImmichUrl: ENV.EXTERNAL_IMMICH_URL,
|
||||
immichURL: ENV.IMMICH_URL,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user