Feature 1 - Update Detection: Query Gitea releases API on startup (3s
delay) and every 24h, compare patch versions by platform, show pulsing
"Update" button in TopBar with dialog for release notes/downloads.
Settings: auto-check toggle, manual check, dismiss per-version.
Feature 2 - Multi-Folder Projects: Replace single `path` with
`paths: Vec<ProjectPath>` (host_path + mount_name). Each folder mounts
to `/workspace/{mount_name}`. Auto-migrate old single-path JSON on load.
Container recreation via paths-fingerprint label. AddProjectDialog and
ProjectCard support add/remove/edit of multiple folders.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
2.7 KiB
TypeScript
57 lines
2.7 KiB
TypeScript
import { invoke } from "@tauri-apps/api/core";
|
|
import type { Project, ProjectPath, ContainerInfo, SiblingContainer, AppSettings, UpdateInfo } from "./types";
|
|
|
|
// Docker
|
|
export const checkDocker = () => invoke<boolean>("check_docker");
|
|
export const checkImageExists = () => invoke<boolean>("check_image_exists");
|
|
export const buildImage = () => invoke<void>("build_image");
|
|
export const getContainerInfo = (projectId: string) =>
|
|
invoke<ContainerInfo | null>("get_container_info", { projectId });
|
|
export const listSiblingContainers = () =>
|
|
invoke<SiblingContainer[]>("list_sibling_containers");
|
|
|
|
// Projects
|
|
export const listProjects = () => invoke<Project[]>("list_projects");
|
|
export const addProject = (name: string, paths: ProjectPath[]) =>
|
|
invoke<Project>("add_project", { name, paths });
|
|
export const removeProject = (projectId: string) =>
|
|
invoke<void>("remove_project", { projectId });
|
|
export const updateProject = (project: Project) =>
|
|
invoke<Project>("update_project", { project });
|
|
export const startProjectContainer = (projectId: string) =>
|
|
invoke<Project>("start_project_container", { projectId });
|
|
export const stopProjectContainer = (projectId: string) =>
|
|
invoke<void>("stop_project_container", { projectId });
|
|
export const rebuildProjectContainer = (projectId: string) =>
|
|
invoke<Project>("rebuild_project_container", { projectId });
|
|
|
|
// Settings
|
|
export const setApiKey = (key: string) =>
|
|
invoke<void>("set_api_key", { key });
|
|
export const hasApiKey = () => invoke<boolean>("has_api_key");
|
|
export const deleteApiKey = () => invoke<void>("delete_api_key");
|
|
export const getSettings = () => invoke<AppSettings>("get_settings");
|
|
export const updateSettings = (settings: AppSettings) =>
|
|
invoke<AppSettings>("update_settings", { settings });
|
|
export const pullImage = (imageName: string) =>
|
|
invoke<void>("pull_image", { imageName });
|
|
export const detectAwsConfig = () =>
|
|
invoke<string | null>("detect_aws_config");
|
|
export const listAwsProfiles = () =>
|
|
invoke<string[]>("list_aws_profiles");
|
|
|
|
// Terminal
|
|
export const openTerminalSession = (projectId: string, sessionId: string) =>
|
|
invoke<void>("open_terminal_session", { projectId, sessionId });
|
|
export const terminalInput = (sessionId: string, data: number[]) =>
|
|
invoke<void>("terminal_input", { sessionId, data });
|
|
export const terminalResize = (sessionId: string, cols: number, rows: number) =>
|
|
invoke<void>("terminal_resize", { sessionId, cols, rows });
|
|
export const closeTerminalSession = (sessionId: string) =>
|
|
invoke<void>("close_terminal_session", { sessionId });
|
|
|
|
// Updates
|
|
export const getAppVersion = () => invoke<string>("get_app_version");
|
|
export const checkForUpdates = () =>
|
|
invoke<UpdateInfo | null>("check_for_updates");
|