2026-01-04 05:19:47 +05:00
|
|
|
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
|
2026-01-07 23:29:46 +05:00
|
|
|
use jarvis_core::{config, db, i18n, voices, APP_CONFIG_DIR, APP_LOG_DIR, DB};
|
2026-01-04 05:19:47 +05:00
|
|
|
|
2026-01-04 09:00:51 +05:00
|
|
|
use parking_lot::RwLock;
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
2026-01-04 05:19:47 +05:00
|
|
|
#[macro_use]
|
|
|
|
|
extern crate simple_log;
|
|
|
|
|
|
|
|
|
|
mod events;
|
|
|
|
|
|
2026-01-04 09:00:51 +05:00
|
|
|
mod tauri_commands;
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct AppState {
|
|
|
|
|
pub db: Arc<RwLock<db::structs::Settings>>,
|
|
|
|
|
}
|
2026-01-04 05:19:47 +05:00
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
config::init_dirs().expect("Failed to init dirs");
|
|
|
|
|
|
|
|
|
|
// basic logging setup (simpler for GUI)
|
|
|
|
|
simple_log::quick!("info");
|
|
|
|
|
|
2026-01-04 09:00:51 +05:00
|
|
|
// init db
|
|
|
|
|
let settings = db::init_settings();
|
2026-01-07 05:04:04 +05:00
|
|
|
|
|
|
|
|
// init i18n
|
|
|
|
|
i18n::init(&settings.language);
|
|
|
|
|
|
2026-01-07 23:29:46 +05:00
|
|
|
// init voices
|
|
|
|
|
if let Err(e) = voices::init(&settings.voice) {
|
|
|
|
|
eprintln!("Failed to init voices: {}", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// init audio backend
|
|
|
|
|
if let Err(e) = jarvis_core::audio::init() {
|
|
|
|
|
eprintln!("Failed to init audio: {:?}", e);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-07 05:04:04 +05:00
|
|
|
// set db
|
2026-01-04 09:00:51 +05:00
|
|
|
DB.set(Arc::new(RwLock::new(settings)))
|
|
|
|
|
.expect("DB already initialized");
|
|
|
|
|
let db_arc = DB.get().unwrap().clone();
|
2026-01-04 05:19:47 +05:00
|
|
|
|
|
|
|
|
tauri::Builder::default()
|
2026-01-04 09:00:51 +05:00
|
|
|
.manage(AppState { db: db_arc })
|
2026-01-04 05:19:47 +05:00
|
|
|
.plugin(tauri_plugin_shell::init())
|
|
|
|
|
.plugin(tauri_plugin_dialog::init())
|
|
|
|
|
.plugin(tauri_plugin_fs::init())
|
|
|
|
|
.invoke_handler(tauri::generate_handler![
|
2026-01-04 09:00:51 +05:00
|
|
|
// audio
|
|
|
|
|
tauri_commands::pv_get_audio_devices,
|
|
|
|
|
tauri_commands::pv_get_audio_device_name,
|
|
|
|
|
tauri_commands::play_sound,
|
|
|
|
|
|
|
|
|
|
// db
|
|
|
|
|
tauri_commands::db_read,
|
|
|
|
|
tauri_commands::db_write,
|
|
|
|
|
|
|
|
|
|
// etc
|
|
|
|
|
tauri_commands::get_app_version,
|
|
|
|
|
tauri_commands::get_author_name,
|
|
|
|
|
tauri_commands::get_repository_link,
|
|
|
|
|
tauri_commands::get_tg_official_link,
|
2026-01-07 23:29:46 +05:00
|
|
|
tauri_commands::get_boosty_link,
|
|
|
|
|
tauri_commands::get_patreon_link,
|
2026-01-04 09:00:51 +05:00
|
|
|
tauri_commands::get_feedback_link,
|
|
|
|
|
|
|
|
|
|
// fs
|
|
|
|
|
tauri_commands::get_log_file_path,
|
|
|
|
|
tauri_commands::show_in_folder,
|
|
|
|
|
|
|
|
|
|
// sys
|
|
|
|
|
tauri_commands::get_current_ram_usage,
|
|
|
|
|
tauri_commands::get_peak_ram_usage,
|
|
|
|
|
tauri_commands::get_cpu_temp,
|
|
|
|
|
tauri_commands::get_cpu_usage,
|
2026-01-06 23:32:58 +05:00
|
|
|
tauri_commands::get_jarvis_app_stats,
|
|
|
|
|
tauri_commands::is_jarvis_app_running,
|
|
|
|
|
tauri_commands::run_jarvis_app,
|
2026-01-05 03:38:04 +05:00
|
|
|
|
|
|
|
|
// vosk
|
|
|
|
|
tauri_commands::list_vosk_models,
|
2026-01-07 05:04:04 +05:00
|
|
|
|
2026-02-11 07:21:50 +05:00
|
|
|
// gliner
|
|
|
|
|
tauri_commands::list_gliner_models,
|
|
|
|
|
|
2026-01-07 05:04:04 +05:00
|
|
|
// i18n
|
|
|
|
|
tauri_commands::get_translations,
|
|
|
|
|
tauri_commands::translate,
|
|
|
|
|
tauri_commands::get_current_language,
|
|
|
|
|
tauri_commands::set_language,
|
|
|
|
|
tauri_commands::get_supported_languages,
|
2026-01-07 23:29:46 +05:00
|
|
|
|
|
|
|
|
// commands
|
|
|
|
|
tauri_commands::get_commands_count,
|
|
|
|
|
tauri_commands::get_commands_list,
|
|
|
|
|
|
|
|
|
|
// voices
|
|
|
|
|
tauri_commands::list_voices,
|
|
|
|
|
tauri_commands::get_voice,
|
|
|
|
|
tauri_commands::preview_voice,
|
2026-01-04 05:19:47 +05:00
|
|
|
])
|
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
|
}
|