2026-02-27 04:29:51 +00:00
|
|
|
mod commands;
|
|
|
|
|
mod docker;
|
2026-03-01 01:45:59 +00:00
|
|
|
mod logging;
|
2026-02-27 04:29:51 +00:00
|
|
|
mod models;
|
|
|
|
|
mod storage;
|
|
|
|
|
|
|
|
|
|
use docker::exec::ExecSessionManager;
|
|
|
|
|
use storage::projects_store::ProjectsStore;
|
2026-02-27 15:22:49 +00:00
|
|
|
use storage::settings_store::SettingsStore;
|
2026-02-28 20:42:55 +00:00
|
|
|
use tauri::Manager;
|
2026-02-27 04:29:51 +00:00
|
|
|
|
|
|
|
|
pub struct AppState {
|
|
|
|
|
pub projects_store: ProjectsStore,
|
2026-02-27 15:22:49 +00:00
|
|
|
pub settings_store: SettingsStore,
|
2026-02-27 04:29:51 +00:00
|
|
|
pub exec_manager: ExecSessionManager,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn run() {
|
2026-03-01 01:45:59 +00:00
|
|
|
logging::init();
|
|
|
|
|
|
|
|
|
|
let projects_store = match ProjectsStore::new() {
|
|
|
|
|
Ok(s) => s,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
log::error!("Failed to initialize projects store: {}", e);
|
|
|
|
|
panic!("Failed to initialize projects store: {}", e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
let settings_store = match SettingsStore::new() {
|
|
|
|
|
Ok(s) => s,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
log::error!("Failed to initialize settings store: {}", e);
|
|
|
|
|
panic!("Failed to initialize settings store: {}", e);
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-02-27 04:29:51 +00:00
|
|
|
|
|
|
|
|
tauri::Builder::default()
|
|
|
|
|
.plugin(tauri_plugin_store::Builder::default().build())
|
|
|
|
|
.plugin(tauri_plugin_dialog::init())
|
|
|
|
|
.plugin(tauri_plugin_opener::init())
|
|
|
|
|
.manage(AppState {
|
2026-03-01 01:45:59 +00:00
|
|
|
projects_store,
|
|
|
|
|
settings_store,
|
2026-02-27 04:29:51 +00:00
|
|
|
exec_manager: ExecSessionManager::new(),
|
|
|
|
|
})
|
2026-03-01 00:49:08 +00:00
|
|
|
.setup(|app| {
|
2026-03-01 03:10:57 +00:00
|
|
|
match tauri::image::Image::from_bytes(include_bytes!("../icons/icon.png")) {
|
2026-03-01 01:45:59 +00:00
|
|
|
Ok(icon) => {
|
|
|
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
|
|
|
let _ = window.set_icon(icon);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Err(e) => {
|
|
|
|
|
log::error!("Failed to load window icon: {}", e);
|
|
|
|
|
}
|
2026-03-01 00:49:08 +00:00
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
})
|
2026-02-28 20:42:55 +00:00
|
|
|
.on_window_event(|window, event| {
|
|
|
|
|
if let tauri::WindowEvent::CloseRequested { .. } = event {
|
|
|
|
|
let state = window.state::<AppState>();
|
|
|
|
|
tauri::async_runtime::block_on(async {
|
|
|
|
|
state.exec_manager.close_all_sessions().await;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-02-27 04:29:51 +00:00
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
|
|
|
// Docker
|
|
|
|
|
commands::docker_commands::check_docker,
|
|
|
|
|
commands::docker_commands::check_image_exists,
|
|
|
|
|
commands::docker_commands::build_image,
|
|
|
|
|
commands::docker_commands::get_container_info,
|
|
|
|
|
commands::docker_commands::list_sibling_containers,
|
|
|
|
|
// Projects
|
|
|
|
|
commands::project_commands::list_projects,
|
|
|
|
|
commands::project_commands::add_project,
|
|
|
|
|
commands::project_commands::remove_project,
|
|
|
|
|
commands::project_commands::update_project,
|
|
|
|
|
commands::project_commands::start_project_container,
|
|
|
|
|
commands::project_commands::stop_project_container,
|
|
|
|
|
commands::project_commands::rebuild_project_container,
|
|
|
|
|
// Settings
|
2026-02-27 15:22:49 +00:00
|
|
|
commands::settings_commands::get_settings,
|
|
|
|
|
commands::settings_commands::update_settings,
|
|
|
|
|
commands::settings_commands::pull_image,
|
|
|
|
|
commands::settings_commands::detect_aws_config,
|
|
|
|
|
commands::settings_commands::list_aws_profiles,
|
2026-03-01 15:57:22 +00:00
|
|
|
commands::settings_commands::detect_host_timezone,
|
2026-02-27 04:29:51 +00:00
|
|
|
// Terminal
|
|
|
|
|
commands::terminal_commands::open_terminal_session,
|
|
|
|
|
commands::terminal_commands::terminal_input,
|
|
|
|
|
commands::terminal_commands::terminal_resize,
|
|
|
|
|
commands::terminal_commands::close_terminal_session,
|
2026-03-01 10:52:08 -08:00
|
|
|
commands::terminal_commands::paste_image_to_terminal,
|
2026-02-28 21:18:33 +00:00
|
|
|
// Updates
|
|
|
|
|
commands::update_commands::get_app_version,
|
|
|
|
|
commands::update_commands::check_for_updates,
|
2026-02-27 04:29:51 +00:00
|
|
|
])
|
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
|
}
|