mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 04:44:28 +00:00
refactor: replace crypto.randomUUID with ulid where security is not needed
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
type FieldInfo as MetadataFieldInfo,
|
||||
type SelectOption,
|
||||
} from '@shumai/dtos'
|
||||
import { ulid } from 'ulid'
|
||||
import { client } from '@/ui/api/client'
|
||||
import { useFieldStore } from '@/ui/stores/fields'
|
||||
import { DragDropProvider, KeyboardSensor, PointerSensor, type DragEndEvent } from '@dnd-kit/react'
|
||||
@@ -328,7 +329,7 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag
|
||||
className="h-8 px-2"
|
||||
onClick={() => {
|
||||
const newOption: SelectOption = {
|
||||
id: crypto.randomUUID(),
|
||||
id: ulid(),
|
||||
displayName: 'New Option',
|
||||
color: '#808080',
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { SearchCondition, SearchSort } from '@shumai/dtos'
|
||||
import type { ShareLinkInfo } from '@shumai/dtos'
|
||||
import type { CreateUploadTaskRequest } from '@shumai/dtos'
|
||||
import { formatSize } from '@/ui/lib/format'
|
||||
import { ulid } from 'ulid'
|
||||
import { usePermissions } from '@/ui/hooks/use-permissions'
|
||||
import { useFieldStore } from '@/ui/stores/fields'
|
||||
import { useUploadStore } from '@/ui/stores/upload'
|
||||
@@ -692,7 +693,7 @@ export function FileBrowser({
|
||||
const parentDir = {
|
||||
name: dir,
|
||||
type: 'folder' as const,
|
||||
id: crypto.randomUUID(),
|
||||
id: ulid(),
|
||||
children: newDir,
|
||||
size: 0,
|
||||
}
|
||||
@@ -703,7 +704,7 @@ export function FileBrowser({
|
||||
currentLevel = directories.get(currentPath)!
|
||||
}
|
||||
}
|
||||
const fileWithId = { file, id: crypto.randomUUID() }
|
||||
const fileWithId = { file, id: ulid() }
|
||||
fileWithIds.push(fileWithId)
|
||||
currentLevel.push({
|
||||
name: fileName,
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
FieldType,
|
||||
type SelectOption,
|
||||
} from '@shumai/dtos'
|
||||
import { ulid } from 'ulid'
|
||||
import { client } from '@/ui/api/client'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { InferRequestType, InferResponseType } from 'hono/client'
|
||||
@@ -445,7 +446,7 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
||||
onClick={() => {
|
||||
// Logic to add option
|
||||
const newOption = {
|
||||
id: crypto.randomUUID(),
|
||||
id: ulid(),
|
||||
displayName: 'New Option',
|
||||
color: '#808080',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user