mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 07:07:39 +00:00
refactor: replace crypto.randomUUID with ulid where security is not needed
This commit is contained in:
@@ -248,6 +248,7 @@
|
||||
"sonner": "2.0.7",
|
||||
"tailwind-merge": "2.6.1",
|
||||
"tailwindcss-animate": "1.0.7",
|
||||
"ulid": "3.0.2",
|
||||
"use-image": "1.1.4",
|
||||
"vaul": "1.1.2",
|
||||
"video.js": "8.23.7",
|
||||
@@ -280,6 +281,7 @@
|
||||
"@temporalio/client": "1.17.2",
|
||||
"@temporalio/worker": "1.17.2",
|
||||
"@temporalio/workflow": "1.17.2",
|
||||
"ulid": "3.0.2",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
|
||||
@@ -82,7 +82,8 @@
|
||||
"zod": "4.4.3",
|
||||
"date-fns": "4.4.0",
|
||||
"hono": "4.12.23",
|
||||
"@shumai/dtos": "workspace:*"
|
||||
"@shumai/dtos": "workspace:*",
|
||||
"ulid": "3.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "4.3.0",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"@shumai/core": "workspace:*",
|
||||
"@temporalio/client": "1.17.2",
|
||||
"@temporalio/workflow": "1.17.2",
|
||||
"@temporalio/worker": "1.17.2"
|
||||
"@temporalio/worker": "1.17.2",
|
||||
"ulid": "3.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { prisma, registerWorkflowTrigger, WorkflowTask } from '@shumai/db'
|
||||
import path from 'path'
|
||||
import { ulid } from 'ulid'
|
||||
import * as taskActivities from './activities/task'
|
||||
import { Executor } from './executor'
|
||||
import { LocalExecutor } from './local-executor'
|
||||
@@ -73,8 +74,7 @@ export class WorkflowService {
|
||||
const activities = (globalThis as any).__localActivities
|
||||
|
||||
// For agent_queue and transcode_queue, use worker-specific unique queues
|
||||
const crypto = await import('crypto')
|
||||
const workerId = crypto.randomUUID()
|
||||
const workerId = ulid()
|
||||
const workerSpecificQueue = `${queue}-${workerId}`
|
||||
|
||||
console.log(`Starting Temporal workers for domain: ${queue}`)
|
||||
|
||||
Reference in New Issue
Block a user