Merge branch 'dev' into chore/i18n

# Conflicts:
#	src/locales/de.json
#	src/locales/en.json
#	src/locales/es.json
#	src/locales/jp.json
#	src/locales/ko.json
#	src/locales/tr.json
#	src/locales/zh.json
#	src/locales/zhtw.json
#	src/pages/_layout/notificationHandlers.ts
This commit is contained in:
Slinetrac
2025-11-02 20:21:46 +08:00
Unverified
17 changed files with 23 additions and 24 deletions

View File

@@ -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<String> {
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<CleanupResult> {
let profiles_dir = dirs::app_profiles_dir()?;

View File

@@ -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>,

View File

@@ -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)
}

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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プロキシを使用してプロファイルのインポートに成功しました。",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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ı",

View File

@@ -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",

View File

@@ -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 代理导入订阅成功",

View File

@@ -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 代理匯入訂閱成功",

View File

@@ -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),