app: add native rune client for record-daemon
Replaces the Vue/Tauri front end with a rune app that speaks the daemon's existing IPC protocol: settings (general, recording, audio), match history and game review with a scrubber, event markers and ffmpeg highlight export. Includes tray icon, launch at login, single instance, toasts, a headless snapshot path for checking screens, and a cargo-packager NSIS config. Rune is pinned to 4ddf696b0f and its three patched crates are vendored under app/vendor, since a dependency's [patch.crates-io] does not apply to the app. The daemon's OBS bootstrap never reached its IPC server on this machine, so the live check is a `--probe` command; the wire format is covered by tests.
This commit is contained in:
1 parent
d712c4ea85
commit
0377141e4f
349 files changed
+142819
No files matched your search
+106
@@ -0,0 +1,106 @@
|
||||
//! League Recorder: a native desktop app for the record-daemon.
|
||||
//!
|
||||
//! Replaces `tauri-app`. The daemon keeps its IPC protocol; this app is a client of it.
|
||||
//! `cargo run` opens the window; `cargo run -- --snap out.png` renders it headless.
|
||||
|
||||
mod app;
|
||||
mod daemon;
|
||||
mod export;
|
||||
mod format;
|
||||
mod highlight;
|
||||
mod history;
|
||||
mod ipc;
|
||||
mod os;
|
||||
mod screens;
|
||||
mod settings;
|
||||
mod ui;
|
||||
|
||||
use rune::AppSpec;
|
||||
|
||||
fn main() {
|
||||
if std::env::args().any(|arg| arg == "--probe") {
|
||||
probe();
|
||||
return;
|
||||
}
|
||||
// A second launch hands its arguments to the first and exits.
|
||||
if !rune::single_instance(os::APP_ID) {
|
||||
return;
|
||||
}
|
||||
os::register_notifications();
|
||||
rune_notify::on_click(|_| rune_notify::bring_to_front());
|
||||
|
||||
let mut hidden = false;
|
||||
let args: Vec<String> = std::env::args()
|
||||
.filter(|arg| {
|
||||
if arg == "--hidden" {
|
||||
hidden = true;
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
rune::App::new(AppSpec {
|
||||
scenes: &[
|
||||
("history", |_app: &mut app::App| {}),
|
||||
("settings", |app| app.screen = app::Screen::Settings),
|
||||
("recording", |app| {
|
||||
app.screen = app::Screen::Settings;
|
||||
app.settings_tab = app::SettingsTab::Recording;
|
||||
}),
|
||||
("audio", |app| {
|
||||
app.screen = app::Screen::Settings;
|
||||
app.settings_tab = app::SettingsTab::Audio;
|
||||
}),
|
||||
("daemon", |app| {
|
||||
app.screen = app::Screen::Settings;
|
||||
app.settings_tab = app::SettingsTab::Daemon;
|
||||
}),
|
||||
("review", |app| app::demo_review(app)),
|
||||
],
|
||||
setup: Some(app::setup),
|
||||
poll: Some(app::poll),
|
||||
on_key: Some(app::on_key),
|
||||
..AppSpec::new("League Recorder", (1200.0, 800.0), app::App::new, app::view)
|
||||
})
|
||||
.args(args)
|
||||
.keep_running()
|
||||
.on_ready(move |handle| {
|
||||
app::remember_window(handle);
|
||||
if hidden {
|
||||
handle.hide();
|
||||
}
|
||||
})
|
||||
.run();
|
||||
}
|
||||
|
||||
/// `--probe`: bring the daemon up and print what it answers, then exit. A quick check that the
|
||||
/// IPC client and the daemon agree without opening a window.
|
||||
fn probe() {
|
||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("async runtime");
|
||||
runtime.block_on(async {
|
||||
match daemon::ensure_running().await {
|
||||
Ok(()) => println!("daemon: ready"),
|
||||
Err(e) => {
|
||||
println!("daemon: {e}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
let client = ipc::Client::new();
|
||||
for (name, command) in [
|
||||
("status", ipc::Command::GetStatus),
|
||||
("settings", ipc::Command::GetSettings),
|
||||
("encoders", ipc::Command::GetEncoders),
|
||||
("audioDevices", ipc::Command::GetAudioDevices),
|
||||
] {
|
||||
match client.call(command, None).await {
|
||||
Ok(data) => println!("{name}: {data}"),
|
||||
Err(e) => println!("{name}: error: {e}"),
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user