feat: complete stage 1 infrastructure

This commit is contained in:
Jason
2025-10-16 10:00:22 +08:00
parent 95e2d84655
commit cc0b7053aa
31 changed files with 2350 additions and 9 deletions

52
src/lib/api/settings.ts Normal file
View File

@@ -0,0 +1,52 @@
import { invoke } from "@tauri-apps/api/core";
import type { Settings } from "@/types";
import type { AppType } from "./types";
export const settingsApi = {
async get(): Promise<Settings> {
return await invoke("get_settings");
},
async save(settings: Settings): Promise<boolean> {
return await invoke("save_settings", { settings });
},
async restart(): Promise<boolean> {
return await invoke("restart_app");
},
async checkUpdates(): Promise<void> {
await invoke("check_for_updates");
},
async isPortable(): Promise<boolean> {
return await invoke("is_portable_mode");
},
async getConfigDir(appType: AppType): Promise<string> {
return await invoke("get_config_dir", {
app_type: appType,
app: appType,
});
},
async openConfigFolder(appType: AppType): Promise<void> {
await invoke("open_config_folder", { app_type: appType, app: appType });
},
async selectConfigDirectory(defaultPath?: string): Promise<string | null> {
return await invoke("pick_directory", { default_path: defaultPath });
},
async getClaudeCodeConfigPath(): Promise<string> {
return await invoke("get_claude_code_config_path");
},
async getAppConfigPath(): Promise<string> {
return await invoke("get_app_config_path");
},
async openAppConfigFolder(): Promise<void> {
await invoke("open_app_config_folder");
},
};