J.A.R.V.I.S-rust/crates/jarvis-gui/src/main.rs

105 lines
3 KiB
Rust
Raw Normal View History

// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use jarvis_core::{config, db, i18n, voices, DB, SettingsManager};
2026-01-04 09:00:51 +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 settings: SettingsManager,
2026-01-04 09:00:51 +05:00
}
fn main() {
config::init_dirs().expect("Failed to init dirs");
// basic logging setup (simpler for GUI)
simple_log::quick!("info");
// init settings
let manager = db::init();
// init i18n
i18n::init(&manager.lock().language);
// init voices
if let Err(e) = voices::init(&manager.lock().voice, &manager.lock().language) {
eprintln!("Failed to init voices: {}", e);
}
// init audio backend
if let Err(e) = jarvis_core::audio::init() {
eprintln!("Failed to init audio: {:?}", e);
}
// set global DB (for core modules that read settings at init time)
DB.set(manager.arc().clone())
2026-01-04 09:00:51 +05:00
.expect("DB already initialized");
tauri::Builder::default()
.manage(AppState { settings: manager })
.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,
chore(gui): rebrand — strip TG/Boosty/Patreon/feedback-bot, keep CC BY-NC-SA attribution The previous feature/gui-rebrand-polish work only updated the appInfo store keys; Footer.svelte, settings, and the commands page were still rendering upstream's Telegram channel, Boosty/Patreon support links, feedback bot, and the original author byline. This finishes the job. Rust side (applies after `cargo build` — currently a no-op until MSVC Build Tools are reinstalled): - Cargo.toml: authors = ["Bossiara13"], repository = J.A.R.V.I.S-rust fork. Original attribution stays in LICENSE.txt per CC BY-NC-SA 4.0; the UI no longer renders an author byline. - config.rs: dropped TG_OFFICIAL_LINK / FEEDBACK_LINK / SUPPORT_BOOSTY_LINK / SUPPORT_PATREON_LINK. Added UPSTREAM_REPOSITORY_LINK (Priler/jarvis for the licence attribution), ISSUES_LINK (this fork's GH issues), and PYTHON_FORK_LINK. - tauri_commands/etc.rs: dropped get_tg_official_link/get_boosty_link/ get_patreon_link/get_feedback_link. Added get_upstream_link, get_issues_link, get_python_fork_link. Tidied up the Option<&str> -> String boilerplate with unwrap_or. - main.rs: invoke_handler updated to match. Frontend side (visible only after Rust rebuild — Tauri bundles the dist into the exe): - stores.ts: appInfo shape reduced to repositoryLink / upstreamLink / issuesLink / pythonForkLink / logFilePath. loadAppInfo() uses fetchOr() with hardcoded fallbacks so the UI still populates correctly when run against an un-rebuilt binary; fetchRepoOr() additionally overrides CARGO_PKG_REPOSITORY if it still resolves to upstream's Priler/jarvis. - Footer.svelte: rewritten — © year + "J.A.R.V.I.S." + repo link + issues link + small "fork of Priler/jarvis · CC BY-NC-SA 4.0" attribution line. No author byline (it's in LICENSE.txt). - routes/settings/index.svelte: feedback link now points to GitHub Issues. - routes/commands/index.svelte: TG-channel reference replaced with a link to the Python fork (where the command builder lives) plus a pointer to resources/commands/ in this repo. Bruh GIF removed. - locales/{ru,en,ua}.ftl: removed footer-author / footer-telegram / footer-support, added footer-issues / footer-fork-of, rewrote commands-wip-* strings, retargeted settings-beta-bot to "GitHub Issues". Bundle identifier (com.priler.jarvis) kept intact to avoid moving the app data directory.
2026-05-15 01:09:14 +03:00
tauri_commands::get_upstream_link,
tauri_commands::get_issues_link,
tauri_commands::get_python_fork_link,
2026-01-04 09:00:51 +05:00
// 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,
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,
// gliner
tauri_commands::list_gliner_models,
// i18n
tauri_commands::get_translations,
tauri_commands::translate,
tauri_commands::get_current_language,
tauri_commands::set_language,
tauri_commands::get_supported_languages,
// commands
tauri_commands::get_commands_count,
tauri_commands::get_commands_list,
// voices
tauri_commands::list_voices,
tauri_commands::get_voice,
tauri_commands::preview_voice,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}