Enable devtools in release builds + add frontend logging
- Enable Tauri devtools feature so right-click Inspect works in release - Open devtools automatically on launch for debugging - Add log_frontend command: frontend can write to ~/.voicetonotes/frontend.log - Sidecar logs go to %LOCALAPPDATA%/com.voicetonotes.app/sidecar.log - Frontend logs go to %USERPROFILE%/.voicetonotes/frontend.log Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,3 +60,18 @@ pub fn llama_list_models() -> Value {
|
||||
pub fn get_data_dir() -> String {
|
||||
LlamaManager::data_dir().to_string_lossy().to_string()
|
||||
}
|
||||
|
||||
/// Log a message from the frontend to a file for debugging.
|
||||
#[tauri::command]
|
||||
pub fn log_frontend(level: String, message: String) {
|
||||
use std::io::Write;
|
||||
let log_path = LlamaManager::data_dir().join("frontend.log");
|
||||
if let Ok(mut file) = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(&log_path)
|
||||
{
|
||||
let timestamp = chrono::Local::now().format("%Y-%m-%d %H:%M:%S");
|
||||
let _ = writeln!(file, "[{timestamp}] [{level}] {message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ use commands::project::{
|
||||
};
|
||||
use commands::settings::{load_settings, save_settings};
|
||||
use commands::sidecar::{check_sidecar, check_sidecar_update, download_sidecar};
|
||||
use commands::system::{get_data_dir, llama_list_models, llama_start, llama_status, llama_stop};
|
||||
use commands::system::{
|
||||
get_data_dir, llama_list_models, llama_start, llama_status, llama_stop, log_frontend,
|
||||
};
|
||||
use commands::transcribe::{download_diarize_model, run_pipeline, transcribe_file};
|
||||
use state::AppState;
|
||||
|
||||
@@ -39,6 +41,8 @@ pub fn run() {
|
||||
// Set the webview background to match the app's dark theme
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.set_background_color(Some(Color(10, 10, 35, 255)));
|
||||
// Enable right-click → Inspect (requires "devtools" feature in Cargo.toml)
|
||||
window.open_devtools();
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
@@ -69,6 +73,7 @@ pub fn run() {
|
||||
check_sidecar,
|
||||
download_sidecar,
|
||||
check_sidecar_update,
|
||||
log_frontend,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user