mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-25 03:25:56 +00:00
feat(ipc): expose public module catalogue Tauri command and API client
This commit is contained in:
1 parent
6bbdef1989
commit
c53fc64d8b
2 files changed
+56
No files matched your search
@@ -2820,6 +2820,18 @@ async fn analyze_github_module(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn get_public_module_catalog(
|
||||||
|
force_refresh: Option<bool>,
|
||||||
|
) -> std::result::Result<coa_core::catalogue::PublicCatalogueResponse, UiError> {
|
||||||
|
let cache_dir = data_dir().join("catalogue");
|
||||||
|
let force = force_refresh.unwrap_or(false);
|
||||||
|
blocking(move || {
|
||||||
|
coa_core::catalogue::fetch_or_load_catalogue(&cache_dir, force)
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn preview_toolchain_status() -> coa_core::build_engine::ToolchainStatus {
|
fn preview_toolchain_status() -> coa_core::build_engine::ToolchainStatus {
|
||||||
coa_core::build_engine::detect_toolchain()
|
coa_core::build_engine::detect_toolchain()
|
||||||
@@ -3212,6 +3224,7 @@ pub fn run() {
|
|||||||
realmlist_activate,
|
realmlist_activate,
|
||||||
modules_list,
|
modules_list,
|
||||||
analyze_github_module,
|
analyze_github_module,
|
||||||
|
get_public_module_catalog,
|
||||||
realm_profiles,
|
realm_profiles,
|
||||||
realm_select,
|
realm_select,
|
||||||
realm_simultaneous,
|
realm_simultaneous,
|
||||||
|
|||||||
@@ -264,6 +264,47 @@ export interface VerificationStatus {
|
|||||||
l6_teardown: string;
|
l6_teardown: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CoaCompatibilityStatus =
|
||||||
|
| 'Recommended'
|
||||||
|
| 'Verified'
|
||||||
|
| 'RequiresAdapter'
|
||||||
|
| 'Unverified'
|
||||||
|
| 'Incompatible'
|
||||||
|
| 'Blocked';
|
||||||
|
|
||||||
|
export interface PublicCatalogueItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
owner: string;
|
||||||
|
repo: string;
|
||||||
|
description: string;
|
||||||
|
html_url: string;
|
||||||
|
default_branch: string;
|
||||||
|
stars: number;
|
||||||
|
forks: number;
|
||||||
|
open_issues: number;
|
||||||
|
pushed_at?: string | null;
|
||||||
|
created_at?: string | null;
|
||||||
|
updated_at?: string | null;
|
||||||
|
topics: string[];
|
||||||
|
category: string;
|
||||||
|
author_name?: string | null;
|
||||||
|
license_spdx?: string | null;
|
||||||
|
coa_status: CoaCompatibilityStatus;
|
||||||
|
coa_notes?: string | null;
|
||||||
|
conflict_reason?: string | null;
|
||||||
|
is_curated_coa: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicCatalogueResponse {
|
||||||
|
items: PublicCatalogueItem[];
|
||||||
|
cached_at: string;
|
||||||
|
is_offline: boolean;
|
||||||
|
etag?: string | null;
|
||||||
|
total_count: number;
|
||||||
|
recommended_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CompatibilityReport {
|
export interface CompatibilityReport {
|
||||||
repository_path: string;
|
repository_path: string;
|
||||||
repository_name: string;
|
repository_name: string;
|
||||||
@@ -729,6 +770,8 @@ export const api = {
|
|||||||
realmlistDelete: (id: string, profileId: string) => invoke<void>("realmlist_delete", { id, profileId }),
|
realmlistDelete: (id: string, profileId: string) => invoke<void>("realmlist_delete", { id, profileId }),
|
||||||
realmlistActivate: (id: string, profileId: string) => invoke<string[]>("realmlist_activate", { id, profileId }),
|
realmlistActivate: (id: string, profileId: string) => invoke<string[]>("realmlist_activate", { id, profileId }),
|
||||||
modulesList: (id: string) => invoke<ModuleView[]>("modules_list", { id }),
|
modulesList: (id: string) => invoke<ModuleView[]>("modules_list", { id }),
|
||||||
|
getPublicModuleCatalog: (forceRefresh = false) =>
|
||||||
|
invoke<PublicCatalogueResponse>("get_public_module_catalog", { forceRefresh }),
|
||||||
analyzeGithubModule: (url: string, realmId: string) =>
|
analyzeGithubModule: (url: string, realmId: string) =>
|
||||||
invoke<CompatibilityReport>("analyze_github_module", { url, realmId }),
|
invoke<CompatibilityReport>("analyze_github_module", { url, realmId }),
|
||||||
moduleSetEnabled: (id: string, module: string, enabled: boolean) => invoke<void>("module_set_enabled", { id, module, enabled }),
|
moduleSetEnabled: (id: string, module: string, enabled: boolean) => invoke<void>("module_set_enabled", { id, module, enabled }),
|
||||||
|
|||||||
Reference in new issue
Block a user