From c461a0a459f6a670b307c8739e4d64c0380b495d Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Sat, 14 Feb 2026 23:31:58 -0700 Subject: [PATCH] Disable flags like reloading --- src-tauri/Cargo.toml | 1 + src-tauri/src/lib.rs | 25 +++++++++++++++++++------ src/app/layout.tsx | 7 ------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d424eeb..21c23ae 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -29,6 +29,7 @@ tauri-plugin-notification = "2.3.3" sysinfo = "0.38.1" sha2 = "0.10.9" tauri-plugin-clipboard-manager = "2.3.2" +tauri-plugin-prevent-default = "4.0.3" [target.'cfg(target_os = "linux")'.dependencies] shlex = "1.3.0" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 486f0dc..f6f4a47 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -13,6 +13,7 @@ use std::{ use sysinfo::System; use tauri::{AppHandle, Emitter, Manager}; use tauri_plugin_os::platform; +use tauri_plugin_prevent_default::Flags; use tokio::io::AsyncReadExt; use tokio::{io::AsyncWriteExt, time::timeout}; use zip::ZipArchive; @@ -278,8 +279,8 @@ fn launch_game( //if already running on macos, it'll auto take the user to that proccess #[cfg(any(target_os = "windows", target_os = "linux"))] { - use tauri_plugin_dialog::MessageDialogKind; use tauri_plugin_dialog::DialogExt; + use tauri_plugin_dialog::MessageDialogKind; if !use_wine && is_running_by_path(&exe_path) { app.dialog() @@ -329,6 +330,22 @@ fn launch_game( pub fn run() { #[allow(unused_variables)] tauri::Builder::default() + .plugin( + tauri_plugin_prevent_default::Builder::new() + .with_flags( + Flags::FIND + | Flags::CARET_BROWSING + | Flags::DEV_TOOLS + | Flags::DOWNLOADS + | Flags::FOCUS_MOVE + | Flags::RELOAD + | Flags::SOURCE + | Flags::OPEN + | Flags::PRINT + | Flags::CONTEXT_MENU, + ) + .build(), + ) .plugin(tauri_plugin_window_state::Builder::new().build()) .plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_notification::init()) @@ -343,11 +360,7 @@ pub fn run() { .plugin(tauri_plugin_decorum::init()) .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_opener::init()) - .invoke_handler(tauri::generate_handler![ - download, - launch_game, - folder_size - ]) + .invoke_handler(tauri::generate_handler![download, launch_game, folder_size]) .setup(|app| { #[cfg(target_os = "windows")] { diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 9f1d0a5..3830a8e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -270,13 +270,6 @@ export default function RootLayout ({ })() }, []) - useEffect(() => { - if (process.env.NODE_ENV !== 'production') return - const handler = (e: MouseEvent) => e.preventDefault() - document.addEventListener('contextmenu', handler) - return () => document.removeEventListener('contextmenu', handler) - }, []) - const downloadVersions = useCallback( async (list: string[]): Promise => { if (list.length === 0) return