feat: Added web notification of successful subscription import

This commit is contained in:
huzibaca 2024-09-13 11:24:49 +08:00
parent 3963c60fc1
commit dbc3723bdc
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302
6 changed files with 16 additions and 4 deletions

View File

@ -279,6 +279,7 @@ pub async fn resolve_scheme(param: String) -> Result<()> {
.body("Import profile success")
.show()
.unwrap();
handle::Handle::notice_message("import_sub_url::ok", "ok");
}
Err(e) => {
app_handle
@ -288,6 +289,7 @@ pub async fn resolve_scheme(param: String) -> Result<()> {
.body(format!("Import profile failed: {e}"))
.show()
.unwrap();
handle::Handle::notice_message("import_sub_url::error", e.clone());
bail!("Import profile failed: {e}");
}
}

View File

@ -367,5 +367,6 @@
"Clash Core Restarted": "Clash Core Restarted",
"Switched to _clash Core": "Switched to {{core}} Core",
"GeoData Updated": "GeoData Updated",
"Currently on the Latest Version": "Currently on the Latest Version"
"Currently on the Latest Version": "Currently on the Latest Version",
"Import Subscription Successful": "Import subscription successful"
}

View File

@ -365,5 +365,6 @@
"Clash Core Restarted": "هسته Clash مجدداً راه‌اندازی شد",
"Switched to _clash Core": "تغییر به هسته {{core}}",
"GeoData Updated": "GeoData به‌روزرسانی شد",
"Currently on the Latest Version": "در حال حاضر در آخرین نسخه"
"Currently on the Latest Version": "در حال حاضر در آخرین نسخه",
"Import Subscription Successfully": "عضویت با موفقیت وارد شد"
}

View File

@ -365,5 +365,6 @@
"Clash Core Restarted": "Clash ядра перезапущено",
"Switched to _clash Core": "Переключено на ядра {{core}}",
"GeoData Updated": "GeoData Обновлена",
"Currently on the Latest Version": "В настоящее время используется последняя версия"
"Currently on the Latest Version": "В настоящее время используется последняя версия",
"Import subscription successful": "Импорт подписки успешно"
}

View File

@ -367,5 +367,6 @@
"Clash Core Restarted": "已重启 Clash 内核",
"Switched to _clash Core": "已切换至 {{core}} 内核",
"GeoData Updated": "已更新 GeoData",
"Currently on the Latest Version": "当前已是最新版本"
"Currently on the Latest Version": "当前已是最新版本",
"Import Subscription Successful": "导入订阅成功"
}

View File

@ -72,6 +72,12 @@ const Layout = () => {
listen("verge://notice-message", ({ payload }) => {
const [status, msg] = payload as [string, string];
switch (status) {
case "import_sub_url::ok":
Notice.success(t("Import Subscription Successful"));
break;
case "import_sub_url::error":
Notice.error(msg);
break;
case "set_config::ok":
Notice.success(t("Clash Config Updated"));
break;