This commit is contained in:
cc
2026-05-08 19:33:37 +08:00
parent b126f7a1db
commit 810a8e9761

View File

@@ -1,10 +1,23 @@
import { join } from 'path' import { join } from 'path'
import { existsSync, readdirSync, statSync } from 'fs' import { existsSync, readdirSync, statSync } from 'fs'
import { app, safeStorage } from 'electron'
import crypto from 'crypto' import crypto from 'crypto'
import Store from 'electron-store' import Store from 'electron-store'
import { expandHomePath } from '../utils/pathUtils' import { expandHomePath } from '../utils/pathUtils'
// 条件导入 electronWorker 环境中不可用)
let app: any = null
let safeStorage: any = null
const isWorkerThread = process.env.WEFLOW_WORKER === '1'
if (!isWorkerThread) {
try {
const electron = require('electron')
app = electron.app
safeStorage = electron.safeStorage
} catch {
// Worker 环境中 electron 不可用
}
}
// 加密前缀标记 // 加密前缀标记
const SAFE_PREFIX = 'safe:' // safeStorage 加密(普通模式) const SAFE_PREFIX = 'safe:' // safeStorage 加密(普通模式)
const isSafeStorageAvailable = (): boolean => { const isSafeStorageAvailable = (): boolean => {