fix: enforce only one instance of the app
All checks were successful
FanslySync Build & Test / FanslySync Test Runner (push) Successful in 11m51s
All checks were successful
FanslySync Build & Test / FanslySync Test Runner (push) Successful in 11m51s
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user