25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat: add tauri-plugin-shell and update permissions for shell access
t8y220546d6c7123
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex fcd568ce1f..cd88a6ad9d 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -1059,6 +1059,7 @@ dependencies = ["tauri-plugin-dialog","tauri-plugin-fs","tauri-plugin-log",+ "tauri-plugin-shell","tiberius","tokio","tokio-util",@@ -2520,6 +2521,25 @@ dependencies = ["serde",]+[[package]]+name = "is-docker"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"+dependencies = [+ "once_cell",+]++[[package]]+name = "is-wsl"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"+dependencies = [+ "is-docker",+ "once_cell",+]+[[package]]name = "itoa"version = "1.0.18"@@ -3423,6 +3443,18 @@ dependencies = ["portable-atomic",]+[[package]]+name = "open"+version = "5.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f3bab717c29a857abf75fcef718d441ec7cb2725f937343c734740a985d37fd"+dependencies = [+ "dunce",+ "is-wsl",+ "libc",+ "pathdiff",+]+[[package]]name = "openssl"version = "0.10.78"@@ -3473,6 +3505,16 @@ version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"+[[package]]+name = "os_pipe"+version = "1.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]+[[package]]name = "pango"version = "0.18.3"@@ -3527,6 +3569,12 @@ dependencies = ["windows-link 0.2.1",]+[[package]]+name = "pathdiff"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"+[[package]]name = "pbkdf2"version = "0.12.2"@@ -4926,12 +4974,44 @@ dependencies = ["digest",]+[[package]]+name = "shared_child"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7"+dependencies = [+ "libc",+ "sigchld",+ "windows-sys 0.60.2",+]+[[package]]name = "shlex"version = "1.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"+[[package]]+name = "sigchld"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1"+dependencies = [+ "libc",+ "os_pipe",+ "signal-hook",+]++[[package]]+name = "signal-hook"+version = "0.3.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"+dependencies = [+ "libc",+ "signal-hook-registry",+]+[[package]]name = "signal-hook-registry"version = "1.4.8"@@ -5730,6 +5810,27 @@ dependencies = ["time",]+[[package]]+name = "tauri-plugin-shell"+version = "2.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8457dbf9e2bab1edd8df22bb2c20857a59a9868e79cb3eac5ed639eec4d0c73b"+dependencies = [+ "encoding_rs",+ "log",+ "open",+ "os_pipe",+ "regex",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "shared_child",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.18",+ "tokio",+]+[[package]]name = "tauri-runtime"version = "2.10.1"diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex aaf3ae124d..527f0f4644 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -34,6 +34,7 @@ anyhow = "1"chrono = { version = "0.4", features = ["serde"] }tauri-plugin-dialog = "2.7.0"tauri-plugin-fs = "2.5.0"+tauri-plugin-shell = "2"redis = { version = "0.32.2", features = ["tokio-comp"] }portpicker = "0.1.1"duckdb = { version = "1.3.2", features = ["bundled"] }diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex 17611090df..e433d8888c 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -15,6 +15,7 @@"dialog:allow-open","fs:default","fs:allow-write-text-file",- "fs:allow-read-text-file"+ "fs:allow-read-text-file",+ "shell:allow-open"]}diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 092454c7e8..4b409fa3e2 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -12,6 +12,7 @@ pub fn run() {tauri::Builder::default().plugin(tauri_plugin_dialog::init()).plugin(tauri_plugin_fs::init())+ .plugin(tauri_plugin_shell::init()).manage(state).setup(|app| {if cfg!(debug_assertions) {diff --git a/src/App.vue b/src/App.vueindex 02541ec978..21ce3cb168 100644--- a/src/App.vue+++ b/src/App.vue@@ -22,6 +22,7 @@ import AiAssistant from "@/components/editor/AiAssistant.vue";import MongoDocBrowser from "@/components/mongo/MongoDocBrowser.vue";import QueryHistory from "@/components/editor/QueryHistory.vue";import DangerConfirmDialog from "@/components/editor/DangerConfirmDialog.vue";+import type { ConnectionConfig } from "@/types/database";import { useConnectionStore } from "@/stores/connectionStore";import { useQueryStore } from "@/stores/queryStore";import { useHistoryStore } from "@/stores/historyStore";@@ -29,6 +30,7 @@ import { useSettingsStore } from "@/stores/settingsStore";import { useToast } from "@/composables/useToast";import { setLocale, currentLocale, type Locale } from "@/i18n";import { getCurrentWindow, type Theme } from "@tauri-apps/api/window";+import { getCurrentWebview } from "@tauri-apps/api/webview";import * as api from "@/lib/tauri";const { t } = useI18n();@@ -332,6 +334,12 @@ function toggleTheme() {applyTheme();}+import { open } from "@tauri-apps/plugin-shell";++function openGitHub() {+ open("https://github.com/t8y2/dbx");+}+function handleKeydown(e: KeyboardEvent) {if (e.metaKey && e.key === "w") {e.preventDefault();@@ -346,11 +354,45 @@ onMounted(() => {connectionStore.initFromDisk();settingsStore.initAiConfig();window.addEventListener("keydown", handleKeydown);+ setupFileDrop();});onUnmounted(() => {window.removeEventListener("keydown", handleKeydown);});++const DB_EXTENSIONS = [".db", ".sqlite", ".sqlite3", ".duckdb"];++function getDbType(path: string): "sqlite" | "duckdb" | null {+ const lower = path.toLowerCase();+ if (lower.endsWith(".duckdb")) return "duckdb";+ if (DB_EXTENSIONS.some((ext) => lower.endsWith(ext))) return "sqlite";+ return null;+}++async function setupFileDrop() {+ const webview = getCurrentWebview();+ await webview.onDragDropEvent((event) => {+ if (event.payload.type !== "drop") return;+ for (const path of event.payload.paths) {+ const dbType = getDbType(path);+ if (!dbType) continue;+ const name = path.split("/").pop()?.split("\\").pop() || path;+ const config: ConnectionConfig = {+ id: crypto.randomUUID(),+ name,+ db_type: dbType,+ host: path,+ port: 0,+ username: "",+ password: "",+ };+ connectionStore.addConnection(config);+ connectionStore.connect(config);+ toast(t("welcome.fileOpened", { name }));+ }+ });+}</script><template>@@ -422,7 +464,14 @@ onUnmounted(() => {<TooltipContent>{{ t('common.language') }}</TooltipContent></Tooltip>- <span class="text-xs text-muted-foreground mr-2">DBX</span>+ <Tooltip>+ <TooltipTrigger as-child>+ <Button variant="ghost" size="icon" class="h-7 w-7" @click="openGitHub">+ <svg class="h-4 w-4" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.387.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61-.546-1.387-1.333-1.756-1.333-1.756-1.09-.745.083-.729.083-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 21.795 24 17.295 24 12 24 5.37 18.627 0 12 0z"/></svg>+ </Button>+ </TooltipTrigger>+ <TooltipContent>GitHub</TooltipContent>+ </Tooltip></div><!-- Main Content -->diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.tsindex 2e79ab259f..c682068acc 100644--- a/src/i18n/locales/en.ts+++ b/src/i18n/locales/en.ts@@ -83,6 +83,7 @@ export default {tip: "You can also expand connections on the left and right-click databases or tables for more actions.",tipSidebar: "Click a table on the left to view data",tipExecute: "to execute query",+ fileOpened: "Opened {name}",},common: {language: "Language",diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.tsindex 4642252a2f..0649e67c32 100644--- a/src/i18n/locales/zh-CN.ts+++ b/src/i18n/locales/zh-CN.ts@@ -81,6 +81,7 @@ export default {shortcuts: "常用操作",shortcutsHint: "从这里开始你的下一步。",tip: "也可以在左侧展开连接,右键数据库或表查看更多操作。",+ fileOpened: "已打开 {name}",},common: {language: "语言",