fix tauri compile

This commit is contained in:
Peter Steinberger 2025-06-23 09:39:11 +02:00
parent 4a3f7d4722
commit 806b931980
5 changed files with 20 additions and 16 deletions

View file

@ -341,19 +341,22 @@ impl NodeJsServer {
}; };
// Try multiple locations for the vibetunnel executable // Try multiple locations for the vibetunnel executable
let current_exe = std::env::current_exe().ok();
let possible_paths = vec![ let possible_paths = vec![
// Next to the Tauri executable
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|p| p.join(exe_name))),
// In resources directory (common for packaged apps) // In resources directory (common for packaged apps)
std::env::current_exe() current_exe.as_ref()
.ok()
.and_then(|p| p.parent().map(|p| p.join("resources").join(exe_name))), .and_then(|p| p.parent().map(|p| p.join("resources").join(exe_name))),
// Development path // Development path relative to src-tauri
PathBuf::from("../web/native").join(exe_name).canonicalize().ok(), Some(PathBuf::from("../../web/native").join(exe_name)),
// Another development path // Development path with canonicalize
PathBuf::from("../../web/native").join(exe_name).canonicalize().ok(), PathBuf::from("../../web/native").join(exe_name).canonicalize().ok(),
// Next to the Tauri executable (but check it's not the Tauri binary itself)
current_exe.as_ref()
.and_then(|p| p.parent().map(|p| p.join(exe_name)))
.filter(|path| {
// Make sure this isn't the Tauri executable itself
current_exe.as_ref().map_or(true, |exe| path != exe)
}),
]; ];
for path_opt in possible_paths { for path_opt in possible_paths {
@ -369,6 +372,7 @@ impl NodeJsServer {
let _ = std::fs::set_permissions(&path, perms); let _ = std::fs::set_permissions(&path, perms);
} }
} }
info!("Using vibetunnel executable at: {:?}", path);
return Ok(path); return Ok(path);
} }
} }

View file

@ -252,7 +252,7 @@ pub async fn stop_server(state: State<'_, AppState>, app: tauri::AppHandle) -> R
let _ = state.ngrok_manager.stop_tunnel().await; let _ = state.ngrok_manager.stop_tunnel().await;
// Update menu bar server status // Update menu bar server status
crate::tray_menu::TrayMenuManager::update_server_status(&app, 4020, false).await; crate::tray_menu::TrayMenuManager::update_server_status(&app, 4022, false).await;
Ok(()) Ok(())
} }
@ -1805,7 +1805,7 @@ pub async fn update_setting(section: String, key: String, value: String) -> Resu
}, },
"dashboard" => match key.as_str() { "dashboard" => match key.as_str() {
"server_port" => { "server_port" => {
settings.dashboard.server_port = json_value.as_u64().unwrap_or(4020) as u16 settings.dashboard.server_port = json_value.as_u64().unwrap_or(4022) as u16
} }
"enable_password" => { "enable_password" => {
settings.dashboard.enable_password = json_value.as_bool().unwrap_or(false) settings.dashboard.enable_password = json_value.as_bool().unwrap_or(false)
@ -2038,7 +2038,7 @@ pub async fn get_server_logs(limit: usize) -> Result<Vec<ServerLog>, String> {
ServerLog { ServerLog {
timestamp: chrono::Utc::now().to_rfc3339(), timestamp: chrono::Utc::now().to_rfc3339(),
level: "info".to_string(), level: "info".to_string(),
message: "Server started on port 4020".to_string(), message: "Server started on port 4022".to_string(),
}, },
ServerLog { ServerLog {
timestamp: chrono::Utc::now().to_rfc3339(), timestamp: chrono::Utc::now().to_rfc3339(),

View file

@ -205,7 +205,7 @@ impl Default for Settings {
prompt_move_to_applications: None, prompt_move_to_applications: None,
}, },
dashboard: DashboardSettings { dashboard: DashboardSettings {
server_port: 4020, server_port: 4022,
enable_password: false, enable_password: false,
password: String::new(), password: String::new(),
access_mode: "localhost".to_string(), access_mode: "localhost".to_string(),

View file

@ -111,7 +111,7 @@ impl TerminalSpawnService {
// If no command specified, create a VibeTunnel session command // If no command specified, create a VibeTunnel session command
if launch_options.command.is_none() { if launch_options.command.is_none() {
// Get server status to build the correct URL // Get server status to build the correct URL
let port = 4020; // Default port, should get from settings let port = 4022; // Default port for Tauri development
launch_options.command = Some(format!( launch_options.command = Some(format!(
"vt connect localhost:{}/{}", "vt connect localhost:{}/{}",
port, request.session_id port, request.session_id

View file

@ -7,7 +7,7 @@ pub struct TrayMenuManager;
impl TrayMenuManager { impl TrayMenuManager {
pub fn create_menu(app: &AppHandle) -> Result<Menu<tauri::Wry>, tauri::Error> { pub fn create_menu(app: &AppHandle) -> Result<Menu<tauri::Wry>, tauri::Error> {
Self::create_menu_with_state(app, false, 4020, 0, None) Self::create_menu_with_state(app, false, 4022, 0, None)
} }
pub fn create_menu_with_state( pub fn create_menu_with_state(
@ -229,7 +229,7 @@ impl TrayMenuManager {
let port = if running { let port = if running {
settings.dashboard.server_port settings.dashboard.server_port
} else { } else {
4020 4022
}; };
// Get monitored sessions for detailed info // Get monitored sessions for detailed info