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:
@@ -14,7 +14,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||||||
tauri-build = { version = "2", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "2", features = ["protocol-asset"] }
|
tauri = { version = "2", features = ["protocol-asset", "devtools"] }
|
||||||
tauri-plugin-opener = "2"
|
tauri-plugin-opener = "2"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|||||||
@@ -60,3 +60,18 @@ pub fn llama_list_models() -> Value {
|
|||||||
pub fn get_data_dir() -> String {
|
pub fn get_data_dir() -> String {
|
||||||
LlamaManager::data_dir().to_string_lossy().to_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::settings::{load_settings, save_settings};
|
||||||
use commands::sidecar::{check_sidecar, check_sidecar_update, download_sidecar};
|
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 commands::transcribe::{download_diarize_model, run_pipeline, transcribe_file};
|
||||||
use state::AppState;
|
use state::AppState;
|
||||||
|
|
||||||
@@ -39,6 +41,8 @@ pub fn run() {
|
|||||||
// Set the webview background to match the app's dark theme
|
// Set the webview background to match the app's dark theme
|
||||||
if let Some(window) = app.get_webview_window("main") {
|
if let Some(window) = app.get_webview_window("main") {
|
||||||
let _ = window.set_background_color(Some(Color(10, 10, 35, 255)));
|
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(())
|
Ok(())
|
||||||
})
|
})
|
||||||
@@ -69,6 +73,7 @@ pub fn run() {
|
|||||||
check_sidecar,
|
check_sidecar,
|
||||||
download_sidecar,
|
download_sidecar,
|
||||||
check_sidecar_update,
|
check_sidecar_update,
|
||||||
|
log_frontend,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|||||||
Reference in New Issue
Block a user