mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-12 08:25:47 +01:00
🚑 Fix UUID by using crypto
This commit is contained in:
@@ -122,7 +122,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
id: props.id ?? Date.now(),
|
||||
id: props.id ?? crypto.randomUUID(),
|
||||
type: props.type ?? 'Other',
|
||||
name: props.name ?? '',
|
||||
icon: props.icon ?? '/favicon.svg',
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useRouter } from 'next/router';
|
||||
import { setCookies } from 'cookies-next';
|
||||
import { useConfig } from '../../tools/state';
|
||||
import { Config } from '../../tools/types';
|
||||
import { migrateToIdConfig } from '../../tools/migrate';
|
||||
|
||||
function getIconColor(status: DropzoneStatus, theme: MantineTheme) {
|
||||
return status.accepted
|
||||
@@ -84,7 +85,8 @@ export default function LoadConfigComponent(props: any) {
|
||||
message: undefined,
|
||||
});
|
||||
setCookies('config-name', newConfig.name, { maxAge: 60 * 60 * 24 * 30 });
|
||||
setConfig(newConfig);
|
||||
const migratedConfig = migrateToIdConfig(newConfig);
|
||||
setConfig(migratedConfig);
|
||||
});
|
||||
}}
|
||||
accept={['application/json']}
|
||||
|
||||
Reference in New Issue
Block a user