diff --git a/src-tauri/src/config/profiles.rs b/src-tauri/src/config/profiles.rs index 98886afc..f25e5990 100644 --- a/src-tauri/src/config/profiles.rs +++ b/src-tauri/src/config/profiles.rs @@ -435,8 +435,8 @@ impl IProfiles { } /// 判断profile是否是current指向的 - pub fn is_current_profile_index(&self, index: String) -> bool { - self.current == Some(index) + pub fn is_current_profile_index(&self, index: &String) -> bool { + self.current.as_ref() == Some(index) } /// 获取所有的profiles(uid,名称) @@ -455,6 +455,18 @@ impl IProfiles { }) } + /// 通过 uid 获取名称 + pub fn get_name_by_uid(&self, uid: &String) -> Option { + if let Some(items) = &self.items { + for item in items { + if item.uid.as_ref() == Some(uid) { + return item.name.clone(); + } + } + } + None + } + /// 以 app 中的 profile 列表为准,删除不再需要的文件 pub async fn cleanup_orphaned_files(&self) -> Result { let profiles_dir = dirs::app_profiles_dir()?; diff --git a/src-tauri/src/core/tray/mod.rs b/src-tauri/src/core/tray/mod.rs index 8261c98a..474b0202 100644 --- a/src-tauri/src/core/tray/mod.rs +++ b/src-tauri/src/core/tray/mod.rs @@ -673,17 +673,15 @@ async fn create_profile_menu_item( .iter() .map(|(profile_uid, profile_name)| { let app_handle = app_handle.clone(); - let profile_uid = profile_uid.clone(); - let profile_name = profile_name.clone(); async move { let is_current_profile = Config::profiles() .await .latest_ref() - .is_current_profile_index(profile_uid.clone()); + .is_current_profile_index(profile_uid); CheckMenuItem::with_id( &app_handle, format!("profiles_{profile_uid}"), - t(&profile_name).await, + t(profile_name).await, true, is_current_profile, None::<&str>, diff --git a/src-tauri/src/feat/profile.rs b/src-tauri/src/feat/profile.rs index 273022a5..5cee61d2 100644 --- a/src-tauri/src/feat/profile.rs +++ b/src-tauri/src/feat/profile.rs @@ -107,7 +107,6 @@ async fn perform_profile_update( Type::Config, "Warning: [订阅更新] 正常更新失败: {err},尝试使用Clash代理更新" ); - handle::Handle::notice_message("update_retry_with_clash", uid.clone()); let original_with_proxy = merged_opt.as_ref().and_then(|o| o.with_proxy); let original_self_proxy = merged_opt.as_ref().and_then(|o| o.self_proxy); @@ -140,14 +139,19 @@ async fn perform_profile_update( Ok(is_current) } Err(retry_err) => { + let failed_profile_name = Config::profiles() + .await + .latest_ref() + .get_name_by_uid(uid) + .unwrap_or_default(); logging!( error, Type::Config, - "[订阅更新] 使用Clash代理更新仍然失败: {retry_err}" + "[订阅更新] 使用Clash代理更新仍然失败: {failed_profile_name} - {retry_err}" ); handle::Handle::notice_message( "update_failed_even_with_clash", - format!("{retry_err}"), + format!("{failed_profile_name} - {retry_err}"), ); Err(retry_err) } diff --git a/src/locales/ar.json b/src/locales/ar.json index cdadf42d..bedea1ad 100644 --- a/src/locales/ar.json +++ b/src/locales/ar.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/de.json b/src/locales/de.json index 75e02a8f..0fefbe37 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -388,7 +388,6 @@ "Last Check Update": "Letzte Aktualitätsprüfung", "Click to import subscription": "Klicken Sie hier, um ein Abonnement zu importieren.", "Unknown": "Unbekannt", - "Update failed, retrying with Clash proxy...": "Abonnement-Aktualisierung fehlgeschlagen. Versuche es mit dem Clash-Proxy erneut...", "Update with Clash proxy successfully": "Aktualisierung mit Clash-Proxy erfolgreich", "Update failed even with Clash proxy": "Aktualisierung auch mit Clash-Proxy fehlgeschlagen", "Profile Imported with Clash proxy": "Abonnement mit Clash-Proxy importiert", diff --git a/src/locales/en.json b/src/locales/en.json index 877939de..958d95c1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/es.json b/src/locales/es.json index 2924475c..0f76886a 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -388,7 +388,6 @@ "Last Check Update": "Última comprobación de actualizaciones", "Click to import subscription": "Haga clic para importar una suscripción", "Unknown": "Desconocido", - "Update failed, retrying with Clash proxy...": "Error al actualizar la suscripción. Intentando con el proxy de Clash...", "Update with Clash proxy successfully": "Actualización con el proxy de Clash exitosa", "Update failed even with Clash proxy": "Error al actualizar incluso con el proxy de Clash", "Profile Imported with Clash proxy": "Suscripción importada con el proxy de Clash", diff --git a/src/locales/fa.json b/src/locales/fa.json index 13eb11a5..856f5e25 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/id.json b/src/locales/id.json index 17524161..97254ef5 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/jp.json b/src/locales/jp.json index aed3f4a4..46c34a63 100644 --- a/src/locales/jp.json +++ b/src/locales/jp.json @@ -388,7 +388,6 @@ "Last Check Update": "最後の更新チェック", "Click to import subscription": "クリックしてサブスクリプションをインポート", "Unknown": "不明", - "Update failed, retrying with Clash proxy...": "サブスクリプションの更新に失敗しました。Clashプロキシを使用して再試行します...", "Update with Clash proxy successfully": "Clashプロキシを使用して更新に成功しました。", "Update failed even with Clash proxy": "Clashプロキシを使用しても更新に失敗しました。", "Profile Imported with Clash proxy": "Clashプロキシを使用してプロファイルのインポートに成功しました。", diff --git a/src/locales/ko.json b/src/locales/ko.json index 69b3138b..2efea39f 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "업데이트 실패, Clash 프록시로 재시도 중...", "Update with Clash proxy successfully": "Clash 프록시로 업데이트 성공", "Update failed even with Clash proxy": "Clash 프록시로도 업데이트 실패", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/ru.json b/src/locales/ru.json index b017d735..1ed66eef 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -388,7 +388,6 @@ "Last Check Update": "Последняя проверка обновлений", "Click to import subscription": "Нажмите, чтобы импортировать подписку", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/tr.json b/src/locales/tr.json index d8f38273..b4a110b2 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -388,7 +388,6 @@ "Last Check Update": "Son Güncelleme Kontrolü", "Click to import subscription": "Abonelik içe aktarmak için tıklayın", "Unknown": "Bilinmiyor", - "Update failed, retrying with Clash proxy...": "Güncelleme başarısız oldu, Clash vekil ile yeniden deneniyor...", "Update with Clash proxy successfully": "Clash vekil ile güncelleme başarılı", "Update failed even with Clash proxy": "Clash vekil ile bile güncelleme başarısız oldu", "Profile Imported with Clash proxy": "Profil Clash vekil ile içe aktarıldı", diff --git a/src/locales/tt.json b/src/locales/tt.json index e2e9992a..498a8fb9 100644 --- a/src/locales/tt.json +++ b/src/locales/tt.json @@ -388,7 +388,6 @@ "Last Check Update": "Last Check Update", "Click to import subscription": "Click to import subscription", "Unknown": "Unknown", - "Update failed, retrying with Clash proxy...": "Update failed, retrying with Clash proxy...", "Update with Clash proxy successfully": "Update with Clash proxy successfully", "Update failed even with Clash proxy": "Update failed even with Clash proxy", "Profile Imported with Clash proxy": "Profile Imported with Clash proxy", diff --git a/src/locales/zh.json b/src/locales/zh.json index a9359273..e3d4d5ea 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -388,7 +388,6 @@ "Last Check Update": "最后检查更新", "Click to import subscription": "点击导入订阅", "Unknown": "未知", - "Update failed, retrying with Clash proxy...": "订阅更新失败,尝试使用 Clash 代理更新", "Update with Clash proxy successfully": "使用 Clash 代理更新成功", "Update failed even with Clash proxy": "使用 Clash 代理更新也失败", "Profile Imported with Clash proxy": "使用 Clash 代理导入订阅成功", diff --git a/src/locales/zhtw.json b/src/locales/zhtw.json index b3cf931e..a3f71aa9 100644 --- a/src/locales/zhtw.json +++ b/src/locales/zhtw.json @@ -388,7 +388,6 @@ "Last Check Update": "最後檢查更新", "Click to import subscription": "點擊匯入訂閱", "Unknown": "未知", - "Update failed, retrying with Clash proxy...": "訂閱更新失敗,嘗試使用 Clash 代理更新", "Update with Clash proxy successfully": "使用 Clash 代理更新成功", "Update failed even with Clash proxy": "使用 Clash 代理更新也失敗", "Profile Imported with Clash proxy": "使用 Clash 代理匯入訂閱成功", diff --git a/src/pages/_layout/notificationHandlers.ts b/src/pages/_layout/notificationHandlers.ts index 82ae6b29..ec473386 100644 --- a/src/pages/_layout/notificationHandlers.ts +++ b/src/pages/_layout/notificationHandlers.ts @@ -21,8 +21,6 @@ export const handleNoticeMessage = ( "set_config::error": () => showNotice.error(msg), update_with_clash_proxy: () => showNotice.success("Update with Clash proxy successfully", msg), - update_retry_with_clash: () => - showNotice.info("Update failed, retrying with Clash proxy..."), update_failed_even_with_clash: () => showNotice.error("Update failed even with Clash proxy", msg), update_failed: () => showNotice.error(msg),