mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-24 03:42:33 +02:00
refactor: show app version in settings
This commit is contained in:
@@ -85,7 +85,7 @@ use downloader::{cancel_download, download_browser};
|
|||||||
|
|
||||||
use settings_manager::{
|
use settings_manager::{
|
||||||
decline_launch_on_login, dismiss_window_resize_warning, enable_launch_on_login, get_app_settings,
|
decline_launch_on_login, dismiss_window_resize_warning, enable_launch_on_login, get_app_settings,
|
||||||
get_sync_settings, get_system_language, get_table_sorting_settings,
|
get_sync_settings, get_system_info, get_system_language, get_table_sorting_settings,
|
||||||
get_window_resize_warning_dismissed, save_app_settings, save_sync_settings,
|
get_window_resize_warning_dismissed, save_app_settings, save_sync_settings,
|
||||||
save_table_sorting_settings, should_show_launch_on_login_prompt,
|
save_table_sorting_settings, should_show_launch_on_login_prompt,
|
||||||
};
|
};
|
||||||
@@ -1816,6 +1816,7 @@ pub fn run() {
|
|||||||
get_table_sorting_settings,
|
get_table_sorting_settings,
|
||||||
save_table_sorting_settings,
|
save_table_sorting_settings,
|
||||||
get_system_language,
|
get_system_language,
|
||||||
|
get_system_info,
|
||||||
dismiss_window_resize_warning,
|
dismiss_window_resize_warning,
|
||||||
get_window_resize_warning_dismissed,
|
get_window_resize_warning_dismissed,
|
||||||
clear_all_version_cache_and_refetch,
|
clear_all_version_cache_and_refetch,
|
||||||
|
|||||||
@@ -945,6 +945,40 @@ pub fn get_system_language() -> String {
|
|||||||
.unwrap_or_else(|| "en".to_string())
|
.unwrap_or_else(|| "en".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Clone)]
|
||||||
|
pub struct SystemInfo {
|
||||||
|
pub app_version: String,
|
||||||
|
pub os: String,
|
||||||
|
pub arch: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn get_system_info() -> SystemInfo {
|
||||||
|
let os = if cfg!(target_os = "macos") {
|
||||||
|
"macOS"
|
||||||
|
} else if cfg!(target_os = "windows") {
|
||||||
|
"Windows"
|
||||||
|
} else if cfg!(target_os = "linux") {
|
||||||
|
"Linux"
|
||||||
|
} else {
|
||||||
|
"Unknown"
|
||||||
|
};
|
||||||
|
|
||||||
|
let arch = if cfg!(target_arch = "x86_64") {
|
||||||
|
"x86_64"
|
||||||
|
} else if cfg!(target_arch = "aarch64") {
|
||||||
|
"aarch64"
|
||||||
|
} else {
|
||||||
|
"unknown"
|
||||||
|
};
|
||||||
|
|
||||||
|
SystemInfo {
|
||||||
|
app_version: crate::app_auto_updater::AppAutoUpdater::get_current_version(),
|
||||||
|
os: os.to_string(),
|
||||||
|
arch: arch.to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Global singleton instance
|
// Global singleton instance
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref SETTINGS_MANAGER: SettingsManager = SettingsManager::new();
|
static ref SETTINGS_MANAGER: SettingsManager = SettingsManager::new();
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ export function SettingsDialog({
|
|||||||
const [e2ePasswordConfirm, setE2ePasswordConfirm] = useState("");
|
const [e2ePasswordConfirm, setE2ePasswordConfirm] = useState("");
|
||||||
const [e2eError, setE2eError] = useState("");
|
const [e2eError, setE2eError] = useState("");
|
||||||
const [isSavingE2e, setIsSavingE2e] = useState(false);
|
const [isSavingE2e, setIsSavingE2e] = useState(false);
|
||||||
|
const [systemInfo, setSystemInfo] = useState<{
|
||||||
|
app_version: string;
|
||||||
|
os: string;
|
||||||
|
arch: string;
|
||||||
|
} | null>(null);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { setTheme } = useTheme();
|
const { setTheme } = useTheme();
|
||||||
@@ -226,6 +231,17 @@ export function SettingsDialog({
|
|||||||
} catch {
|
} catch {
|
||||||
setHasE2ePassword(false);
|
setHasE2ePassword(false);
|
||||||
}
|
}
|
||||||
|
// Load system info
|
||||||
|
try {
|
||||||
|
const info = await invoke<{
|
||||||
|
app_version: string;
|
||||||
|
os: string;
|
||||||
|
arch: string;
|
||||||
|
}>("get_system_info");
|
||||||
|
setSystemInfo(info);
|
||||||
|
} catch {
|
||||||
|
setSystemInfo(null);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to load settings:", error);
|
console.error("Failed to load settings:", error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1088,6 +1104,15 @@ export function SettingsDialog({
|
|||||||
version information for all browsers.
|
version information for all browsers.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* System Info */}
|
||||||
|
{systemInfo && (
|
||||||
|
<div className="pt-2 border-t">
|
||||||
|
<p className="text-xs text-muted-foreground font-mono whitespace-pre-line select-all">
|
||||||
|
{`Donut Browser ${systemInfo.app_version}\n${systemInfo.os} ${systemInfo.arch}`}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogFooter className="shrink-0">
|
<DialogFooter className="shrink-0">
|
||||||
|
|||||||
Reference in New Issue
Block a user