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(turso): simplify connection form to URL + token
t8y27c5021fa91e5
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vueindex cad99a3de9..b404966af8 100644--- a/apps/desktop/src/components/connection/ConnectionDialog.vue+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue@@ -2559,6 +2559,34 @@ function openExternalUrl(url: string) {</template></template>+ <!-- Turso: simplified form (URL + Token) -->+ <template v-else-if="form.db_type === 'turso'">+ <div class="grid grid-cols-4 items-center gap-4">+ <Label class="text-right">{{ t("connection.host") }}</Label>+ <Input v-model="form.host" class="col-span-3" placeholder="your-database.turso.io 或 libsql://your-database.turso.io" />+ </div>++ <div class="grid grid-cols-4 items-start gap-4">+ <span />+ <p class="col-span-3 text-xs text-muted-foreground">支持 libsql:// 或 https:// 协议,也可以只填主机名(自动使用 HTTPS)</p>+ </div>++ <div class="grid grid-cols-4 items-center gap-4">+ <Label class="text-right">Auth Token</Label>+ <Input v-model="form.password" type="password" class="col-span-3" placeholder="eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9..." />+ </div>++ <div class="grid grid-cols-4 items-start gap-4">+ <span />+ <p class="col-span-3 text-xs text-muted-foreground">使用 <code class="px-1 py-0.5 rounded bg-muted text-xs">turso db tokens create <database-name></code> 创建 token</p>+ </div>++ <div class="grid grid-cols-4 items-center gap-4">+ <Label class="text-right">{{ t("connection.urlParams") }}</Label>+ <Input v-model="form.url_params" class="col-span-3" placeholder="authToken=xxx(可选,优先使用上面的 Token 字段)" />+ </div>+ </template>+<!-- MySQL / PostgreSQL: host, port, user, password, database --><template v-else><div class="grid grid-cols-4 items-center gap-4">diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rsindex 23997f38ad..93189a53fb 100644--- a/crates/dbx-core/src/models/connection.rs+++ b/crates/dbx-core/src/models/connection.rs@@ -1179,14 +1179,25 @@ fn rqlite_http_url(config: &ConnectionConfig, host: &str, port: u16) -> String {fn turso_http_url(config: &ConnectionConfig, host: &str, port: u16) -> String {let trimmed = host.trim();- if let Some(rest) = trimmed.strip_prefix("https://").or_else(|| trimmed.strip_prefix("libsql://")) {++ // Handle libsql:// protocol (Turso native)+ if let Some(rest) = trimmed.strip_prefix("libsql://") {+ return format!("https://{}", trim_http_host_port(rest, port));+ }++ // Handle explicit https://+ if let Some(rest) = trimmed.strip_prefix("https://") {return format!("https://{}", trim_http_host_port(rest, port));}++ // Handle explicit http:// (respect ssl config)if let Some(rest) = trimmed.strip_prefix("http://") {let scheme = if config.ssl { "https" } else { "http" };return format!("{scheme}://{}", trim_http_host_port(rest, port));}- let scheme = if config.ssl { "https" } else { "http" };++ // Default: bare hostname -> prefer HTTPS for Turso (default port 443)+ let scheme = if port == 443 || config.ssl { "https" } else { "http" };format!("{scheme}://{}:{port}", bracket_ipv6(trimmed))}