fix: 修复文件层级重构后的架构问题
- 恢复 IPC 类型声明 (src/electron-api.d.ts),修复 31 个 TS2339 错误 - 修复构建断裂:vite.config.ts 改回 electron.vite.config.ts - 修复 2 个 verbatimModuleSyntax type-import 报错 - 修正 .gitignore 构建产物路径 (electron-dist/ -> dist-electron/ + release/) - 清理 55+ 处过时路径注释 - 更新 AGENTS.md 架构文档与 IPC 通道表 - 修正 docs/ROADMAP.md 过时引用
This commit is contained in:
+2
-2
@@ -1,5 +1,6 @@
|
||||
node_modules/
|
||||
electron-dist/
|
||||
dist-electron/
|
||||
release/
|
||||
dist/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
@@ -19,4 +20,3 @@ legacy/
|
||||
|
||||
# Brainstorming artifacts
|
||||
.superpowers/
|
||||
electron-dist/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# AGENTS.md — JRedisDesktop v2
|
||||
# AGENTS.md - JRedisDesktop v2
|
||||
|
||||
## Project identity
|
||||
|
||||
@@ -6,10 +6,10 @@ Fork of [AnotherRedisDesktopManager](https://github.com/qishibo/AnotherRedisDesk
|
||||
|
||||
## Stack
|
||||
|
||||
- **Shell:** Electron 43 (`electron/main/index.ts`)
|
||||
- **Preload:** `electron/preload/index.ts` (contextBridge, typed API)
|
||||
- **Shell:** Electron 43 (`electron/main.ts`)
|
||||
- **Preload:** `electron/preload.ts` (contextBridge, typed API)
|
||||
- **Renderer:** Vue 3 + Pinia + Element Plus + Vue Router (`src/`)
|
||||
- **Shared:** `electron/shared/types.ts` (cross-process types)
|
||||
- **IPC types:** `src/electron-api.d.ts` (ElectronAPI interface, global Window augmentation)
|
||||
- **Build:** electron-vite + Vite 6 + TypeScript 5
|
||||
- **Redis client:** ioredis 5 (main process only)
|
||||
- **Persistence:** electron-store + safeStorage (credentials)
|
||||
@@ -18,46 +18,46 @@ Fork of [AnotherRedisDesktopManager](https://github.com/qishibo/AnotherRedisDesk
|
||||
|
||||
```bash
|
||||
npm run dev # electron-vite dev (HMR, renderer on :5173)
|
||||
npm run build # production build → electron-dist/
|
||||
npm run build # production build -> dist-electron/
|
||||
npm start # preview built app
|
||||
npm run build:unpack # build + electron-builder --dir
|
||||
npm run build:win # build + electron-builder --win
|
||||
npm run build:mac # build + electron-builder --mac
|
||||
npm run build:linux # build + electron-builder --linux
|
||||
npm run lint # eslint --fix
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Electron main (electron/main/)
|
||||
├── index.ts # Window creation, app lifecycle
|
||||
├── redis/ # Redis service modules
|
||||
│ ├── index.ts # Unified export
|
||||
│ ├── connection.ts # connect, disconnect, isClientConnected
|
||||
│ ├── keys.ts # scan, delete, rename, ttl, batchDelete
|
||||
│ ├── string.ts # get, set
|
||||
│ ├── hash.ts # hscan, hset, hdel
|
||||
│ ├── list.ts # range, push, set, remove
|
||||
│ ├── set.ts # members, add, remove
|
||||
│ ├── zset.ts # range, add, remove
|
||||
│ ├── stream.ts # info, range, add, trim
|
||||
│ ├── server.ts # info, select, ping, slowlog
|
||||
│ ├── pubsub.ts # SUBSCRIBE/UNSUBSCRIBE
|
||||
│ ├── commandLogger.ts # command execution log
|
||||
│ └── format.ts # value decode/format detection
|
||||
Electron main (electron/)
|
||||
├── main.ts # Window creation, app lifecycle
|
||||
├── preload.ts # contextBridge.exposeInMainWorld
|
||||
├── ipc-handlers.ts # all IPC channel handlers
|
||||
├── store.ts # electron-store (connections, settings)
|
||||
├── credential.ts # safeStorage encrypt/decrypt
|
||||
├── win-state.ts # window position persistence
|
||||
├── updater.ts # electron-updater (check/download/install)
|
||||
└── ipc-handlers.ts # all IPC channel handlers
|
||||
|
||||
Preload (electron/preload/)
|
||||
├── index.ts # contextBridge.exposeInMainWorld
|
||||
└── index.d.ts # ElectronAPI type declarations
|
||||
└── redis/ # Redis service modules
|
||||
├── index.ts # Unified export
|
||||
├── connection.ts # connect, disconnect, isClientConnected
|
||||
├── keys.ts # scan, delete, rename, ttl, batchDelete
|
||||
├── string.ts # get, set
|
||||
├── hash.ts # hscan, hset, hdel
|
||||
├── list.ts # range, push, set, remove
|
||||
├── set.ts # members, add, remove
|
||||
├── zset.ts # range, add, remove
|
||||
├── stream.ts # info, range, add, trim
|
||||
├── server.ts # info, select, ping, slowlog
|
||||
├── pubsub.ts # SUBSCRIBE/UNSUBSCRIBE
|
||||
├── commandLogger.ts # command execution log
|
||||
└── format.ts # value decode/format detection
|
||||
|
||||
Renderer (src/)
|
||||
├── main.ts # Vue 3 bootstrap (Pinia, Element Plus)
|
||||
├── App.vue # Shell layout (TitleBar + Sidebar + MainArea + StatusBar)
|
||||
├── env.d.ts # Vite client + *.vue / *.css module declarations
|
||||
├── electron-api.d.ts # ElectronAPI interface + global Window augmentation
|
||||
├── stores/
|
||||
│ ├── app.ts # theme, fontSize, scanCount
|
||||
│ ├── connection.ts # connections CRUD, connect/disconnect, health check
|
||||
@@ -91,7 +91,10 @@ Renderer (src/)
|
||||
│ ├── index.ts # useI18n composable
|
||||
│ └── locales/
|
||||
│ ├── en.ts # English
|
||||
│ └── zh-CN.ts # 中文
|
||||
│ ├── zh-CN.ts # 中文
|
||||
│ ├── ja.ts # 日本語
|
||||
│ ├── ko.ts # 한국어
|
||||
│ └── de.ts # Deutsch
|
||||
├── composables/
|
||||
│ └── useKeyboard.ts # keyboard shortcut handler
|
||||
├── styles/
|
||||
@@ -110,57 +113,82 @@ Renderer (src/)
|
||||
| `redis:connect` | invoke | Create Redis connection |
|
||||
| `redis:disconnect` | invoke | Close connection |
|
||||
| `redis:execute` | invoke | Execute arbitrary command |
|
||||
| `redis:getInfo` | invoke | INFO server info |
|
||||
| `redis:ping` | invoke | Health check ping |
|
||||
| `redis:isConnected` | invoke | Check connection status |
|
||||
| `redis:scanKeys` | invoke | SCAN with pattern |
|
||||
| `redis:getKeyType` | invoke | TYPE of a key |
|
||||
| `redis:getKeyTTL` | invoke | TTL of a key |
|
||||
| `redis:deleteKey` | invoke | DEL a single key |
|
||||
| `redis:existsKey` | invoke | EXISTS check |
|
||||
| `redis:getString` | invoke | GET string value |
|
||||
| `redis:setString` | invoke | SET string value |
|
||||
| `redis:hashScan` | invoke | HSCAN fields |
|
||||
| `redis:hashSet` | invoke | HSET field |
|
||||
| `redis:hashDel` | invoke | HDEL field |
|
||||
| `redis:listRange` | invoke | LRANGE elements |
|
||||
| `redis:listLength` | invoke | LLEN |
|
||||
| `redis:listPush` | invoke | RPUSH elements |
|
||||
| `redis:listSet` | invoke | LSET element |
|
||||
| `redis:listRemove` | invoke | LREM elements |
|
||||
| `redis:setMembers` | invoke | SMEMBERS |
|
||||
| `redis:setSize` | invoke | SCARD |
|
||||
| `redis:setAdd` | invoke | SADD members |
|
||||
| `redis:setRemove` | invoke | SREM members |
|
||||
| `redis:zsetRange` | invoke | ZRANGE with scores |
|
||||
| `redis:zsetSize` | invoke | ZCARD |
|
||||
| `redis:zsetAdd` | invoke | ZADD member |
|
||||
| `redis:zsetRemove` | invoke | ZREM members |
|
||||
| `redis:streamInfo` | invoke | XINFO STREAM |
|
||||
| `redis:streamRange` | invoke | XRANGE entries |
|
||||
| `redis:streamAdd` | invoke | XADD entry |
|
||||
| `redis:streamTrim` | invoke | XTRIM |
|
||||
| `redis:streamDel` | invoke | XDEL entries |
|
||||
| `redis:streamGroups` | invoke | XINFO GROUPS |
|
||||
| `redis:streamConsumers` | invoke | XINFO CONSUMERS |
|
||||
| `redis:streamGroupCreate` | invoke | XGROUP CREATE |
|
||||
| `redis:streamGroupDestroy` | invoke | XGROUP DESTROY |
|
||||
| `redis:streamAck` | invoke | XACK messages |
|
||||
| `redis:batchDelete` | invoke | Pipeline DEL multiple keys |
|
||||
| `redis:renameKey` | invoke | RENAME key |
|
||||
| `redis:setTTL` | invoke | EXPIRE/PERSIST |
|
||||
| `redis:selectDb` | invoke | SELECT database |
|
||||
| `redis:dbSize` | invoke | DBSIZE |
|
||||
| `redis:slowLogGet` | invoke | SLOWLOG GET |
|
||||
| `redis:slowLogLen` | invoke | SLOWLOG LEN |
|
||||
| `redis:memoryUsage` | invoke | MEMORY USAGE |
|
||||
| `redis:subscribe` | invoke | SUBSCRIBE to channels |
|
||||
| `redis:unsubscribe` | invoke | UNSUBSCRIBE from channels |
|
||||
| `redis:subscribeMessage` | send | Push subscribed message to renderer |
|
||||
| `redis:monitor` | invoke | Start MONITOR stream |
|
||||
| `redis:monitorStop` | invoke | Stop MONITOR stream |
|
||||
| `redis:monitorMessage` | send | Push monitored command to renderer |
|
||||
| `redis:getCommandLog` | invoke | Get command execution log |
|
||||
| `redis:clearCommandLog` | invoke | Clear command log |
|
||||
| `redis:decodeValue` | invoke | Decode value by format |
|
||||
| `redis:detectFormat` | invoke | Auto-detect value format |
|
||||
| `redis:customFormat` | invoke | Custom external formatter |
|
||||
| `redis:streamGroups` | invoke | XINFO GROUPS |
|
||||
| `redis:streamConsumers` | invoke | XINFO CONSUMERS |
|
||||
| `redis:streamGroupCreate` | invoke | XGROUP CREATE |
|
||||
| `redis:streamGroupDestroy` | invoke | XGROUP DESTROY |
|
||||
| `redis:streamAck` | invoke | XACK messages |
|
||||
| `redis:rejsonGet` | invoke | JSON.GET value |
|
||||
| `redis:rejsonSet` | invoke | JSON.SET value |
|
||||
| `storage:getConnections` | invoke | Read connections |
|
||||
| `storage:saveConnection` | invoke | Save connection |
|
||||
| `storage:deleteConnection` | invoke | Delete connection |
|
||||
| `storage:reorderConnections` | invoke | Reorder connections |
|
||||
| `storage:getSettings` | invoke | Read settings |
|
||||
| `storage:saveSettings` | invoke | Save settings |
|
||||
| `credential:encrypt` | invoke | safeStorage encrypt |
|
||||
| `credential:decrypt` | invoke | safeStorage decrypt |
|
||||
| `dialog:openFile` | invoke | Open file picker |
|
||||
| `theme:get` | invoke | Get OS dark mode |
|
||||
| `theme:set` | send | Set theme source |
|
||||
| `theme:os-updated` | send | Push OS theme change to renderer |
|
||||
| `window:minimize` | send | Minimize window |
|
||||
| `window:maximize` | send | Toggle maximize |
|
||||
| `window:close` | send | Close window |
|
||||
| `updater:check` | invoke | Check for updates |
|
||||
| `updater:download` | invoke | Download update |
|
||||
| `updater:install` | invoke | Quit and install update |
|
||||
| `updater:status` | send | Push updater status to renderer |
|
||||
|
||||
## Keyboard Shortcuts
|
||||
|
||||
@@ -175,21 +203,25 @@ Renderer (src/)
|
||||
## Build config
|
||||
|
||||
- `electron.vite.config.ts` defines three build targets: main, preload, renderer
|
||||
- Main + preload output to `dist-electron/`; renderer to `dist-electron/renderer/`
|
||||
- electron-builder packages into `release/`
|
||||
- Renderer dev server runs on port 5173
|
||||
- Main/preload use `externalizeDepsPlugin()` to keep node_modules external
|
||||
- `@renderer` alias resolves to `src`
|
||||
|
||||
## TypeScript
|
||||
|
||||
- Root `tsconfig.json` references `tsconfig.node.json` (main + preload) and `tsconfig.web.json` (renderer)
|
||||
- Node target includes `src/main/**/*`, `src/preload/**/*`, `electron.vite.config.ts`
|
||||
- Web target includes `src/**/*`
|
||||
- `@renderer` alias resolves to `src`
|
||||
- Root `tsconfig.json` references `tsconfig.node.json` (main + preload) and `tsconfig.app.json` (renderer)
|
||||
- Node target (`tsconfig.node.json`) includes `electron/**/*` + `electron.vite.config.ts`
|
||||
- App target (`tsconfig.app.json`) includes `src/**/*`
|
||||
- Both use `verbatimModuleSyntax` (type-only imports required) and `moduleResolution: "bundler"`
|
||||
- `src/electron-api.d.ts` declares the `ElectronAPI` interface and augments global `Window`
|
||||
|
||||
## Security
|
||||
|
||||
- `contextIsolation: true` — renderer has zero Node.js access
|
||||
- `nodeIntegration: false` — no Node globals in renderer
|
||||
- `safeStorage` — OS-level encryption for credentials
|
||||
- `contextIsolation: true` - renderer has zero Node.js access
|
||||
- `nodeIntegration: false` - no Node globals in renderer
|
||||
- `safeStorage` - OS-level encryption for credentials
|
||||
- All Redis operations go through typed IPC to main process
|
||||
|
||||
## Legacy
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@
|
||||
## 技术债务
|
||||
|
||||
- [x] AGENTS.md 路径更新 — 文档写 `src/renderer/src/components/`,实际是 `src/components/`
|
||||
- [x] `electron/shared/types.ts` 残留字段 — SSH/Sentinel/Cluster/TLS 路径在类型中存在但从未在 UI 中实现
|
||||
- [x] `electron/shared/types.ts` 残留字段(文件已在层级重构中移除) — SSH/Sentinel/Cluster/TLS 路径在类型中存在但从未在 UI 中实现
|
||||
- [ ] 单元测试 — 当前无任何测试
|
||||
- [ ] E2E 测试 — 无端到端测试
|
||||
- [x] 构建产物清理 — `electron-dist/` 应加入 .gitignore(当前已加入)
|
||||
- [x] 构建产物清理 — `dist-electron/` 与 `release/` 已加入 .gitignore
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/credential.ts
|
||||
import { safeStorage } from 'electron'
|
||||
|
||||
export function encrypt(text: string): string {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// src/main/ipc-handlers.ts
|
||||
// IPC 通道处理器
|
||||
import { ipcMain, BrowserWindow, nativeTheme, dialog } from 'electron'
|
||||
import store, { ConnectionConfig } from './store'
|
||||
import store, { type ConnectionConfig } from './store'
|
||||
import { encrypt, decrypt } from './credential'
|
||||
import * as redis from './redis'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/index.ts
|
||||
import { app, BrowserWindow, nativeTheme, nativeImage } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { restoreAndTrack } from './win-state'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/preload/index.ts
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
|
||||
const electronAPI = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// electron/main/redis/commandLogger.ts
|
||||
// 命令日志记录器
|
||||
|
||||
export interface CommandEntry {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// electron/main/redis/connection.ts
|
||||
// Redis 连接管理(支持 SSH 隧道)
|
||||
import Redis, { RedisOptions } from 'ioredis'
|
||||
import Redis, { type RedisOptions } from 'ioredis'
|
||||
import { Client as SSHClient } from 'ssh2'
|
||||
import { createServer, type AddressInfo } from 'net'
|
||||
import { readFileSync } from 'fs'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// electron/main/redis/format.ts
|
||||
// 值格式转换(解压/编码/自定义)
|
||||
import { gunzipSync, inflateSync, brotliDecompressSync } from 'zlib'
|
||||
import { execFile } from 'child_process'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/hash.ts
|
||||
// Hash 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/index.ts
|
||||
// Redis 服务统一导出
|
||||
export * from './connection'
|
||||
export * from './keys'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/keys.ts
|
||||
// Key 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/list.ts
|
||||
// List 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// electron/main/redis/pubsub.ts
|
||||
// 发布订阅 + MONITOR 流式接口
|
||||
import Redis from 'ioredis'
|
||||
import { getClient } from './connection'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/server.ts
|
||||
// 服务器操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/set.ts
|
||||
// Set 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/stream.ts
|
||||
// Stream 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/string.ts
|
||||
// String + ReJson 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/redis/zset.ts
|
||||
// Sorted Set 操作
|
||||
import { getClient } from './connection'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/store.ts
|
||||
import Store from 'electron-store'
|
||||
|
||||
interface ConnectionConfig {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main/win-state.ts
|
||||
import { app, screen, BrowserWindow } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { readFileSync, writeFile } from 'fs'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/App.vue
|
||||
import { ref, onMounted } from 'vue'
|
||||
import TitleBar from './components/TitleBar.vue'
|
||||
import Sidebar from './components/Sidebar.vue'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/CliView.vue
|
||||
import { ref, computed, nextTick, watch, onMounted, onUnmounted } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/CommandLog.vue
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/ConnectionCard.vue
|
||||
import { computed, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { ConnectionConfig } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/ConnectionList.vue
|
||||
import { ref, computed } from 'vue'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import ConnectionCard from './ConnectionCard.vue'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/DbSelector.vue
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/HashEditor.vue
|
||||
import { ref, watch, computed, onMounted } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/KeyBrowser.vue
|
||||
import { watch } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/KeyDetail.vue
|
||||
import { computed, ref } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/KeyList.vue
|
||||
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useVirtualizer } from '@tanstack/vue-virtual'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/ListEditor.vue
|
||||
import { ref, watch } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/MainArea.vue
|
||||
import { ref, watch, computed, nextTick, onMounted, onUnmounted } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/MemoryAnalysis.vue
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/NewConnectionDialog.vue
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/ReJsonEditor.vue
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { VueMonacoEditor } from '@guolao/vue-monaco-editor'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/SetEditor.vue
|
||||
import { ref, watch } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/SettingsView.vue
|
||||
import { useAppStore } from '@renderer/stores/app'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
import { ref } from 'vue'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/Sidebar.vue
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import ConnectionList from './ConnectionList.vue'
|
||||
import NewConnectionDialog from './NewConnectionDialog.vue'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/SlowLogView.vue
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/StatusBar.vue
|
||||
import { computed } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/StatusView.vue
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/StreamEditor.vue
|
||||
import { ref, watch } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/StringEditor.vue
|
||||
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { VueMonacoEditor } from '@guolao/vue-monaco-editor'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/TitleBar.vue
|
||||
import { useAppStore } from '@renderer/stores/app'
|
||||
import { useI18n } from '@renderer/i18n'
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
// src/components/ZsetEditor.vue
|
||||
import { ref, watch } from 'vue'
|
||||
import { useKeyStore } from '@renderer/stores/key'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/composables/useKeyboard.ts
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
|
||||
interface ShortcutMap {
|
||||
|
||||
Vendored
+144
@@ -0,0 +1,144 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
/**
|
||||
* Electron preload bridge type declarations.
|
||||
*
|
||||
* Mirrors the API exposed via contextBridge in `electron/preload.ts`.
|
||||
* Keeps the renderer fully typed at the IPC boundary without any Node access.
|
||||
*/
|
||||
export interface ElectronAPI {
|
||||
window: {
|
||||
minimize: () => void
|
||||
maximize: () => void
|
||||
close: () => void
|
||||
}
|
||||
theme: {
|
||||
get: () => Promise<boolean>
|
||||
set: (theme: 'system' | 'dark' | 'light') => void
|
||||
onOsUpdated: (callback: (isDark: boolean) => void) => void
|
||||
}
|
||||
dialog: {
|
||||
openFile: (options: {
|
||||
title?: string
|
||||
filters?: { name: string; extensions: string[] }[]
|
||||
}) => Promise<any>
|
||||
}
|
||||
credential: {
|
||||
encrypt: (text: string) => Promise<string>
|
||||
decrypt: (encoded: string) => Promise<string>
|
||||
}
|
||||
storage: {
|
||||
getConnections: () => Promise<any[]>
|
||||
saveConnection: (conn: any) => Promise<any[]>
|
||||
deleteConnection: (id: string) => Promise<any[]>
|
||||
reorderConnections: (ids: string[]) => Promise<any[]>
|
||||
getSettings: () => Promise<any>
|
||||
saveSettings: (settings: any) => Promise<void>
|
||||
}
|
||||
redis: {
|
||||
// Connection
|
||||
connect: (id: string, opts: any) => Promise<any>
|
||||
disconnect: (id: string) => Promise<void>
|
||||
execute: (id: string, command: string, args: string[]) => Promise<any>
|
||||
getInfo: (id: string) => Promise<string>
|
||||
ping: (id: string) => Promise<string>
|
||||
isConnected: (id: string) => Promise<boolean>
|
||||
selectDb: (id: string, db: number) => Promise<void>
|
||||
dbSize: (id: string) => Promise<number>
|
||||
// Key operations
|
||||
scanKeys: (id: string, cursor: string, pattern: string, count: number) => Promise<any>
|
||||
getKeyType: (id: string, key: string) => Promise<string>
|
||||
getKeyTTL: (id: string, key: string) => Promise<number>
|
||||
deleteKey: (id: string, key: string) => Promise<void>
|
||||
renameKey: (id: string, oldKey: string, newKey: string) => Promise<void>
|
||||
existsKey: (id: string, key: string) => Promise<boolean>
|
||||
setTTL: (id: string, key: string, ttl: number) => Promise<void>
|
||||
batchDelete: (id: string, keys: string[]) => Promise<number>
|
||||
memoryUsage: (id: string, key: string) => Promise<number | null>
|
||||
// String
|
||||
getString: (id: string, key: string) => Promise<string | null>
|
||||
setString: (id: string, key: string, value: string) => Promise<void>
|
||||
// Hash
|
||||
hashScan: (id: string, key: string, cursor: string, count: number) => Promise<any>
|
||||
hashSet: (id: string, key: string, field: string, value: string) => Promise<void>
|
||||
hashDel: (id: string, key: string, field: string) => Promise<void>
|
||||
// List
|
||||
listRange: (id: string, key: string, start: number, stop: number) => Promise<string[]>
|
||||
listLength: (id: string, key: string) => Promise<number>
|
||||
listPush: (id: string, key: string, values: string[]) => Promise<number>
|
||||
listSet: (id: string, key: string, index: number, value: string) => Promise<void>
|
||||
listRemove: (id: string, key: string, count: number, value: string) => Promise<number>
|
||||
// Set
|
||||
setMembers: (id: string, key: string) => Promise<string[]>
|
||||
setSize: (id: string, key: string) => Promise<number>
|
||||
setAdd: (id: string, key: string, members: string[]) => Promise<number>
|
||||
setRemove: (id: string, key: string, members: string[]) => Promise<number>
|
||||
// Sorted set
|
||||
zsetRange: (
|
||||
id: string,
|
||||
key: string,
|
||||
start: number,
|
||||
stop: number,
|
||||
withScores: boolean,
|
||||
) => Promise<string[]>
|
||||
zsetSize: (id: string, key: string) => Promise<number>
|
||||
zsetAdd: (id: string, key: string, score: number, member: string) => Promise<number>
|
||||
zsetRemove: (id: string, key: string, members: string[]) => Promise<number>
|
||||
// Stream
|
||||
streamInfo: (id: string, key: string) => Promise<any>
|
||||
streamRange: (
|
||||
id: string,
|
||||
key: string,
|
||||
start: string,
|
||||
end: string,
|
||||
count: number,
|
||||
) => Promise<any[]>
|
||||
streamAdd: (id: string, key: string, streamId: string, fieldValues: string[]) => Promise<string>
|
||||
streamTrim: (id: string, key: string, maxLen: number) => Promise<number>
|
||||
streamDel: (id: string, key: string, ids: string[]) => Promise<number>
|
||||
streamGroups: (id: string, key: string) => Promise<any[]>
|
||||
streamConsumers: (id: string, key: string, group: string) => Promise<any[]>
|
||||
streamGroupCreate: (
|
||||
id: string,
|
||||
key: string,
|
||||
group: string,
|
||||
startId: string,
|
||||
mkstream: boolean,
|
||||
) => Promise<any>
|
||||
streamGroupDestroy: (id: string, key: string, group: string) => Promise<number>
|
||||
streamAck: (id: string, key: string, group: string, ids: string[]) => Promise<number>
|
||||
// ReJson
|
||||
rejsonGet: (id: string, key: string, path: string) => Promise<string>
|
||||
rejsonSet: (id: string, key: string, path: string, value: string) => Promise<void>
|
||||
// Slow log
|
||||
slowLogGet: (id: string, count: number) => Promise<any[]>
|
||||
slowLogLen: (id: string) => Promise<number>
|
||||
// Command log
|
||||
getCommandLog: () => Promise<any[]>
|
||||
clearCommandLog: () => Promise<void>
|
||||
// Format
|
||||
decodeValue: (value: string, format: string) => Promise<string>
|
||||
detectFormat: (value: string) => Promise<string>
|
||||
customFormat: (value: string, command: string, key: string) => Promise<string>
|
||||
// Pub/Sub
|
||||
subscribe: (id: string, channels: string[], isPattern: boolean) => Promise<any>
|
||||
unsubscribe: (id: string) => Promise<void>
|
||||
onSubscribeMessage: (callback: (msg: any) => void) => void
|
||||
// Monitor
|
||||
monitor: (id: string) => Promise<any>
|
||||
monitorStop: (id: string) => Promise<void>
|
||||
onMonitorMessage: (callback: (msg: any) => void) => void
|
||||
}
|
||||
updater: {
|
||||
check: () => Promise<any>
|
||||
download: () => Promise<any>
|
||||
install: () => Promise<any>
|
||||
onStatus: (callback: (status: any) => void) => void
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
electronAPI: ElectronAPI
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/i18n/index.ts
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import en from './locales/en'
|
||||
import zhCN from './locales/zh-CN'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/i18n/locales/de.ts
|
||||
export default {
|
||||
common: {
|
||||
ok: 'OK',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/i18n/locales/en.ts
|
||||
export default {
|
||||
common: {
|
||||
ok: 'OK',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/i18n/locales/ja.ts
|
||||
export default {
|
||||
common: {
|
||||
ok: 'OK',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/i18n/locales/ko.ts
|
||||
export default {
|
||||
common: {
|
||||
ok: '확인',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/i18n/locales/zh-CN.ts
|
||||
export default {
|
||||
common: {
|
||||
ok: '确定',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/main.ts
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/stores/app.ts
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/stores/connection.ts
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/renderer/src/stores/key.ts
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// src/utils/binary.ts
|
||||
export function isBinaryKey(key: string): boolean {
|
||||
// Check for non-printable characters (outside 0x20-0x7E, not standard whitespace)
|
||||
for (let i = 0; i < key.length; i++) {
|
||||
|
||||
+1
-1
@@ -19,5 +19,5 @@
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["vite.config.ts", "electron"]
|
||||
"include": ["electron.vite.config.ts", "electron"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user