mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
chore(brand): surface ccswitch.io as the sole official website
Add an "Only Official Website" header to the three READMEs, an About panel button, and a tray menu entry — all pointing to ccswitch.io. Consolidates brand and SEO signals on the canonical domain across docs, GUI, and system tray.
This commit is contained in:
+23
-2
@@ -5,6 +5,7 @@
|
||||
use once_cell::sync::Lazy;
|
||||
use tauri::menu::{CheckMenuItem, Menu, MenuBuilder, MenuItem, Submenu, SubmenuBuilder};
|
||||
use tauri::{Emitter, Manager};
|
||||
use tauri_plugin_opener::OpenerExt;
|
||||
|
||||
use crate::app_config::AppType;
|
||||
use crate::error::AppError;
|
||||
@@ -20,6 +21,7 @@ static TRAY_SECTION_SUBMENUS: Lazy<
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct TrayTexts {
|
||||
pub show_main: &'static str,
|
||||
pub open_website: &'static str,
|
||||
pub no_providers_label: &'static str,
|
||||
pub lightweight_mode: &'static str,
|
||||
pub quit: &'static str,
|
||||
@@ -31,6 +33,7 @@ impl TrayTexts {
|
||||
match language {
|
||||
"en" => Self {
|
||||
show_main: "Open main window",
|
||||
open_website: "Open Official Website",
|
||||
no_providers_label: "(no providers)",
|
||||
lightweight_mode: "Lightweight Mode",
|
||||
quit: "Quit",
|
||||
@@ -38,6 +41,7 @@ impl TrayTexts {
|
||||
},
|
||||
"ja" => Self {
|
||||
show_main: "メインウィンドウを開く",
|
||||
open_website: "公式サイトを開く",
|
||||
no_providers_label: "(プロバイダーなし)",
|
||||
lightweight_mode: "軽量モード",
|
||||
quit: "終了",
|
||||
@@ -45,6 +49,7 @@ impl TrayTexts {
|
||||
},
|
||||
_ => Self {
|
||||
show_main: "打开主界面",
|
||||
open_website: "打开官方网站",
|
||||
no_providers_label: "(无供应商)",
|
||||
lightweight_mode: "轻量模式",
|
||||
quit: "退出",
|
||||
@@ -473,11 +478,22 @@ pub fn create_tray_menu(
|
||||
let mut section_handles: std::collections::HashMap<AppType, Submenu<tauri::Wry>> =
|
||||
std::collections::HashMap::new();
|
||||
|
||||
// 顶部:打开主界面
|
||||
// 顶部:打开主界面 / 打开官方网站
|
||||
let show_main_item =
|
||||
MenuItem::with_id(app, "show_main", tray_texts.show_main, true, None::<&str>)
|
||||
.map_err(|e| AppError::Message(format!("创建打开主界面菜单失败: {e}")))?;
|
||||
menu_builder = menu_builder.item(&show_main_item).separator();
|
||||
let open_website_item = MenuItem::with_id(
|
||||
app,
|
||||
"open_website",
|
||||
tray_texts.open_website,
|
||||
true,
|
||||
None::<&str>,
|
||||
)
|
||||
.map_err(|e| AppError::Message(format!("创建打开官方网站菜单失败: {e}")))?;
|
||||
menu_builder = menu_builder
|
||||
.item(&show_main_item)
|
||||
.item(&open_website_item)
|
||||
.separator();
|
||||
|
||||
// Pre-compute proxy running state (used to disable official providers in tray menu)
|
||||
let is_proxy_running = futures::executor::block_on(app_state.proxy_service.is_running());
|
||||
@@ -686,6 +702,11 @@ pub fn handle_tray_menu_event(app: &tauri::AppHandle, event_id: &str) {
|
||||
}
|
||||
}
|
||||
}
|
||||
"open_website" => {
|
||||
if let Err(e) = app.opener().open_url("https://ccswitch.io", None::<String>) {
|
||||
log::error!("打开官方网站失败: {e}");
|
||||
}
|
||||
}
|
||||
"lightweight_mode" => {
|
||||
if crate::lightweight::is_lightweight_mode() {
|
||||
if let Err(e) = crate::lightweight::exit_lightweight_mode(app) {
|
||||
|
||||
Reference in New Issue
Block a user