From 3609eddfc42147b4d2c748845f95bb48ae09d0f7 Mon Sep 17 00:00:00 2001 From: LilDosto Date: Fri, 6 Nov 2026 05:08:34 +0300 Subject: [PATCH] feat: professional settings header, export, folder and reset --- src-tauri/src/lib.rs | 22 ++++++++++++ src/App.jsx | 85 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0aca7d0..5daf14e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1439,6 +1439,27 @@ fn open_download_page() -> Result<(), String> { updater::open_download_page() } +#[tauri::command] +fn open_data_folder() -> Result<(), String> { + let path = engine::app_data_dir(); + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + let mut command = std::process::Command::new("explorer.exe"); + command.arg(path).stdin(std::process::Stdio::null()); + command.creation_flags(0x0800_0000); + command + .spawn() + .map_err(|e| format!("Ayar klasörü açılamadı: {e}"))?; + Ok(()) + } + #[cfg(not(target_os = "windows"))] + { + let _ = path; + Err("Bu platformda desteklenmiyor.".to_string()) + } +} + #[tauri::command] fn prepare_for_update(state: State<'_, AppState>) -> Result<(), String> { // The updater installer replaces files under Program Files. Stop the @@ -2449,6 +2470,7 @@ pub fn run() { connect_eduroam_wifi, open_wifi_settings, open_download_page, + open_data_folder, prepare_for_update, restart_app, connect_without_login, diff --git a/src/App.jsx b/src/App.jsx index e8ca9be..6b2865b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -31,6 +31,7 @@ import { Languages, Sparkles, Server, + FolderOpen, } from "lucide-react"; import { QRCodeSVG } from "qrcode.react"; import { TEXT } from "./i18n"; @@ -146,6 +147,7 @@ export default function App() { const [ports, setPorts] = useState({ proxyPort: 18080, pacPort: 18081 }); const [lanWarn, setLanWarn] = useState(false); const [autostartNote, setAutostartNote] = useState(false); + const [resetArmed, setResetArmed] = useState(false); const [eduroam, setEduroam] = useState(null); const [captive, setCaptive] = useState(null); const [autoBypass, setAutoBypass] = useState(null); @@ -584,6 +586,35 @@ export default function App() { else handleConnect(); }; + const handleResetSettings = async () => { + if (!resetArmed) { + setResetArmed(true); + return; + } + setResetArmed(false); + const defaults = { + autoStart: true, + autoConnect: false, + minimizeToTray: true, + lanSharing: false, + captiveAssistant: true, + autoOptimize: true, + connectionMode: "normal", + bypassMode: 1, + chunkSize: 4, + dohProvider: "auto", + quicBlock: false, + proxyPort: 18080, + pacPort: 18081, + }; + try { + await saveConfig(defaults, Boolean(status.isConnected)); + pushLog("INFO", lang === "tr" ? "Ayarlar varsayılana döndürüldü." : "Settings reset to defaults."); + } catch (error) { + setLastError(String(error)); + } + }; + const handleLan = async (enabled) => { if (!config) return; setBusy("lan"); @@ -1154,6 +1185,60 @@ export default function App() { {view === "settings" && ( <>
+
+
+
+
+ + {lang === "tr" ? "Ayarlar" : "Settings"} + + v{appVersion} + +
+

+ {lang === "tr" + ? "Değişiklikler otomatik kaydedilir. Bağlantı açıksa gerekli ayarlar yeniden uygulanır." + : "Changes save automatically. Active connections are reconfigured when required."} +

+
+
+
+ + + +
+ {resetArmed && ( +
+ {lang === "tr" + ? "Bu işlem otomatik başlatma, DPI, DNS ve port ayarlarını varsayılana döndürür." + : "This resets startup, DPI, DNS and port preferences."} +
+ )} +
{vpn?.connected && (
VPN açık. DPI ayarları kilitli; değiştirmek için önce VPN sekmesinden bağlantıyı kesin.