fix: enforce only one instance of the app
All checks were successful
FanslySync Build & Test / FanslySync Test Runner (push) Successful in 11m51s

This commit is contained in:
Sticks
2025-04-23 20:20:39 -04:00
parent f4565ab580
commit d4d9d2ebce
5 changed files with 28 additions and 2 deletions

View File

@ -20,6 +20,8 @@ use tauri::tray::TrayIconBuilder;
use tauri::AppHandle;
use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher;
use tauri_plugin_dialog::DialogExt;
use tauri_plugin_dialog::MessageDialogKind;
use tauri_plugin_log::{Target, TargetKind};
fn get_log_path() -> io::Result<String> {
@ -108,6 +110,14 @@ async fn main() {
.max_file_size(1024 * 1024 * 5)
.build(),
)
.plugin(tauri_plugin_single_instance::init(|app,_args,_cwd| {
// Show a dialog if the app is already running
app.dialog()
.message("FanslySync is already running in the background. Please left click the tray icon -> Show Window to open the app.")
.title("FanslySync")
.kind(MessageDialogKind::Warning)
.blocking_show();
}))
.invoke_handler(tauri::generate_handler![
init_config,
get_config,