53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
|
|
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");
|
||
|
|
},
|
||
|
|
};
|