From b51189a5384c56cd6d8cc819c10f3377c6970c70 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 18 Jun 2026 14:45:04 +0800 Subject: [PATCH 01/35] =?UTF-8?q?chore(release):=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E5=8D=87=E8=87=B3=2026.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 37b63fe1..d985da4b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "codeforge", "private": true, - "version": "26.2.0", + "version": "26.3.0", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 5fda3dfc..247ed67b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "CodeForge" -version = "26.2.0" +version = "26.3.0" dependencies = [ "async-trait", "chrono", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 6bd79286..f0eac932 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "CodeForge" -version = "26.2.0" +version = "26.3.0" description = "CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发者、学生和编程爱好者设计。" authors = ["devlive-community"] edition = "2024" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 11ab8f66..eb07e4d7 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "CodeForge", - "version": "26.2.0", + "version": "26.3.0", "identifier": "org.devlive.codeforge", "build": { "beforeDevCommand": "pnpm dev", From 0e9563ba2330f8b94aa700622f933013e3450d31 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 18 Jun 2026 14:50:58 +0800 Subject: [PATCH 02/35] =?UTF-8?q?feat(git):=20=E6=96=B0=E5=A2=9E=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=20GPG=20=E7=AD=BE=E5=90=8D=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端 git_get_signing / git_set_signing,读写本仓库 commit.gpgsign 与 user.signingkey - GitConfig 弹层拓展为「仓库 Git 配置」,新增签名开关与签名密钥;身份与签名一并保存 - 补充 git.config/signing* 文案 --- src-tauri/src/filesystem.rs | 45 +++++++++++++++++++++++++++ src-tauri/src/main.rs | 24 ++++++++------- src/components/GitConfig.vue | 59 ++++++++++++++++++++++++++---------- src/components/GitPanel.vue | 2 +- src/i18n/locales/en.json | 8 ++++- src/i18n/locales/zh-CN.json | 8 ++++- 6 files changed, 116 insertions(+), 30 deletions(-) diff --git a/src-tauri/src/filesystem.rs b/src-tauri/src/filesystem.rs index a99fa323..9b33a97d 100644 --- a/src-tauri/src/filesystem.rs +++ b/src-tauri/src/filesystem.rs @@ -1615,6 +1615,51 @@ pub async fn git_set_identity(root: String, name: String, email: String) -> Resu .map_err(|e| format!("git 任务失败: {}", e))? } +/// 读取仓库本地签名配置,返回 [gpgsign("true"/""), signingkey]。 +#[tauri::command] +pub async fn git_get_signing(root: String) -> Result, String> { + tokio::task::spawn_blocking(move || { + let sign = run_git(&root, &["config", "--local", "commit.gpgsign"]) + .unwrap_or_default() + .trim() + .to_string(); + let key = run_git(&root, &["config", "--local", "user.signingkey"]) + .unwrap_or_default() + .trim() + .to_string(); + let enabled = if sign == "true" { + "true".to_string() + } else { + String::new() + }; + Ok(vec![enabled, key]) + }) + .await + .map_err(|e| format!("git 任务失败: {}", e))? +} + +/// 设置仓库本地签名配置:commit.gpgsign 开关;key 非空则设 user.signingkey。 +#[tauri::command] +pub async fn git_set_signing(root: String, enabled: bool, key: String) -> Result { + tokio::task::spawn_blocking(move || { + run_git( + &root, + &[ + "config", + "--local", + "commit.gpgsign", + if enabled { "true" } else { "false" }, + ], + )?; + if !key.trim().is_empty() { + run_git(&root, &["config", "--local", "user.signingkey", key.trim()])?; + } + Ok(String::new()) + }) + .await + .map_err(|e| format!("git 任务失败: {}", e))? +} + /// 创建标签。hash 为空则打在 HEAD;message 非空则创建附注标签(-a -m)。 #[tauri::command] pub async fn git_tag_create( diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 527c5b67..7b194c90 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -62,17 +62,17 @@ use crate::filesystem::{ git_bisect_state, git_blame, git_branch_create, git_branch_delete, git_branch_rename, git_branches, git_checkout, git_checkout_track, git_cherry_pick, git_clean, git_clean_preview, git_clone, git_commit, git_compare, git_delete_remote_branch, git_diff, git_discard, git_fetch, - git_file_diff, git_file_head, git_get_identity, git_graph, git_ignore_add, git_init, git_log, - git_log_file, git_merge, git_op_abort, git_op_continue, git_op_skip, git_op_state, git_pull, - git_pull_rebase, git_push, git_push_force, git_push_tags, git_rebase_interactive, git_reflog, - git_remote_add, git_remote_branches, git_remote_remove, git_remotes, git_reset, - git_restore_file, git_revert, git_set_identity, git_set_upstream, git_show, git_stage, - git_stash_apply, git_stash_drop, git_stash_list, git_stash_pop, git_stash_push, git_stash_show, - git_status, git_submodule_sync, git_submodule_update, git_submodules, git_tag_create, - git_tag_delete, git_tags, git_unstage, git_worktree_add, git_worktree_prune, - git_worktree_remove, git_worktrees, list_files, read_directory_tree, read_file_lines, - read_file_text, rename_path, replace_in_files, reveal_path, search_in_files, watch_directory, - write_file_text, + git_file_diff, git_file_head, git_get_identity, git_get_signing, git_graph, git_ignore_add, + git_init, git_log, git_log_file, git_merge, git_op_abort, git_op_continue, git_op_skip, + git_op_state, git_pull, git_pull_rebase, git_push, git_push_force, git_push_tags, + git_rebase_interactive, git_reflog, git_remote_add, git_remote_branches, git_remote_remove, + git_remotes, git_reset, git_restore_file, git_revert, git_set_identity, git_set_signing, + git_set_upstream, git_show, git_stage, git_stash_apply, git_stash_drop, git_stash_list, + git_stash_pop, git_stash_push, git_stash_show, git_status, git_submodule_sync, + git_submodule_update, git_submodules, git_tag_create, git_tag_delete, git_tags, git_unstage, + git_worktree_add, git_worktree_prune, git_worktree_remove, git_worktrees, list_files, + read_directory_tree, read_file_lines, read_file_text, rename_path, replace_in_files, + reveal_path, search_in_files, watch_directory, write_file_text, }; use crate::kv::{KvStore, kv_delete, kv_get_all, kv_set}; use crate::lsp::{ @@ -262,6 +262,8 @@ fn main() { git_tag_delete, git_get_identity, git_set_identity, + git_get_signing, + git_set_signing, git_remotes, git_remote_add, git_remote_remove, diff --git a/src/components/GitConfig.vue b/src/components/GitConfig.vue index 1c52d2ea..ce2f1b53 100644 --- a/src/components/GitConfig.vue +++ b/src/components/GitConfig.vue @@ -5,30 +5,51 @@
- {{ t('git.identityTitle') }} + {{ t('git.configTitle') }}
-
-

{{ t('git.identityHint') }}

- - +
+ +
+
{{ t('git.identitySection') }}
+

{{ t('git.identityHint') }}

+ + +
+ + +
+
{{ t('git.signingSection') }}
+

{{ t('git.signingHint') }}

+ + +
+
- +
@@ -50,6 +71,8 @@ const toast = useToast() const {t} = useI18n() const name = ref('') const email = ref('') +const gpgsign = ref(false) +const signingKey = ref('') const busy = ref(false) const load = async () => { @@ -57,6 +80,9 @@ const load = async () => { const [n, e] = await invoke('git_get_identity', {root: props.rootDir}) name.value = n || '' email.value = e || '' + const [sign, key] = await invoke('git_get_signing', {root: props.rootDir}) + gpgsign.value = sign === 'true' + signingKey.value = key || '' } catch (error) { toast.error(t('git.identityFailed') + ': ' + error) @@ -67,6 +93,7 @@ const save = async () => { busy.value = true try { await invoke('git_set_identity', {root: props.rootDir, name: name.value.trim(), email: email.value.trim()}) + await invoke('git_set_signing', {root: props.rootDir, enabled: gpgsign.value, key: signingKey.value.trim()}) toast.success(t('git.identitySaved')) emit('close') } diff --git a/src/components/GitPanel.vue b/src/components/GitPanel.vue index d83515ac..5611f754 100644 --- a/src/components/GitPanel.vue +++ b/src/components/GitPanel.vue @@ -70,7 +70,7 @@ -