Files
JRedisDesktop/electron/store.ts
T
2026-07-10 23:05:10 +08:00

62 lines
1.1 KiB
TypeScript

// src/main/store.ts
import Store from 'electron-store'
interface ConnectionConfig {
id: string
name: string
host: string
port: number
auth: string
username: string
tls: boolean
tlsCaPath: string
tlsCertPath: string
tlsKeyPath: string
tlsRejectUnauthorized: boolean
sshEnabled: boolean
sshHost: string
sshPort: number
sshUsername: string
sshPassword: string
sshPrivateKeyPath: string
sshPassphrase: string
cluster: boolean
sentinelEnabled: boolean
sentinelHost: string
sentinelPort: number
sentinelMasterName: string
sentinelNodePassword: string
separator: string
order: number
createdAt: number
color?: string
}
interface AppSettings {
theme: 'system' | 'dark' | 'light'
locale: string
fontSize: number
scanCount: number
}
interface AppStorage {
connections: ConnectionConfig[]
settings: AppSettings
}
const store = new Store<AppStorage>({
name: 'jrdm-config',
defaults: {
connections: [],
settings: {
theme: 'system',
locale: 'en',
fontSize: 13,
scanCount: 500,
},
},
})
export default store
export type { ConnectionConfig, AppSettings }