From 5194647dd19df25f77336df4c236864a378f463d Mon Sep 17 00:00:00 2001 From: Pauline Date: Mon, 19 Aug 2024 21:42:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pauline --- Cargo.lock | 31 +- apps/frontend/src/bindings.ts | 1365 +++++++++++++++------------- packages/core/src/store/package.rs | 4 +- 3 files changed, 742 insertions(+), 658 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8cbef63e..c5453f41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2273,9 +2273,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -2962,9 +2962,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.157" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374af5f94e54fa97cf75e945cce8a6b201e88a1a07e688b47dfd2a59c66dbd86" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libflate" @@ -4378,9 +4378,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", @@ -4433,9 +4433,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "b6f6ddd79dc661ade721873783d159ec87d91d556ce92933e342bae8b87c48c0" dependencies = [ "async-compression", "base64 0.22.1", @@ -4478,7 +4478,7 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg", + "windows-registry", ] [[package]] @@ -5335,6 +5335,9 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "sys-info" @@ -5363,20 +5366,20 @@ dependencies = [ [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation 0.9.4", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", diff --git a/apps/frontend/src/bindings.ts b/apps/frontend/src/bindings.ts index eb5e867b..056b6dab 100644 --- a/apps/frontend/src/bindings.ts +++ b/apps/frontend/src/bindings.ts @@ -1,843 +1,924 @@ - // This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. -/** user-defined commands **/ +/** user-defined commands */ +/** tauri-specta globals */ + +import { + invoke as TAURI_INVOKE, +} from '@tauri-apps/api/core'; +import * as TAURI_API_EVENT from '@tauri-apps/api/event'; +import type { WebviewWindow as __WebviewWindow__ } from '@tauri-apps/api/webviewWindow'; export const commands = { -async authLogin() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("auth_login") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getUsers() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_users") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getUser(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_user", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getDefaultUser(fallback: boolean | null) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_default_user", { fallback }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async setDefaultUser(uuid: string | null) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("set_default_user", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async removeUser(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("remove_user", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async createCluster(props: CreateCluster) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("create_cluster", { props }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -/** - * Updates the cluster with the given UUID. The cluster only updates game setting fields - */ -async editGameSettings(uuid: string, newCluster: Cluster) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("edit_game_settings", { uuid, newCluster }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async editClusterMeta(uuid: string, name: string | null, iconPath: string | null) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("edit_cluster_meta", { uuid, name, iconPath }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async removeCluster(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("remove_cluster", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getCluster(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_cluster", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getClusters() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_clusters") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getClustersGrouped() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_clusters_grouped") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async runCluster(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("run_cluster", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getClusterLogs(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_cluster_logs", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getClusterLog(uuid: string, logName: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_cluster_log", { uuid, logName }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async uploadLog(uuid: string, logName: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("upload_log", { uuid, logName }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getScreenshots(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_screenshots", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getWorlds(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_worlds", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getRunningClusters() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_running_clusters") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getProcessesByPath(path: ClusterPath) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_processes_by_path", { path }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async killProcess(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("kill_process", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async isClusterRunning(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("is_cluster_running", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getPidByUuid(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_pid_by_uuid", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getUserByProcess(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_user_by_process", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getProcessStartedAt(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_process_started_at", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getProcessesDetailedByPath(path: ClusterPath) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_processes_detailed_by_path", { path }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getProcessDetailedById(uuid: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_process_detailed_by_id", { uuid }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getSettings() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_settings") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async setSettings(settings: Settings) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("set_settings", { settings }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getMinecraftVersions() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_minecraft_versions") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async randomMods() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("random_mods") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async getMod(projectId: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("get_mod", { projectId }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async downloadMod(clusterId: string, versionId: string) : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("download_mod", { clusterId, versionId }) }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async checkForUpdate() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("check_for_update") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -}, -async installUpdate() : Promise> { - try { - return { status: "ok", data: await TAURI_INVOKE("install_update") }; -} catch (e) { - if(e instanceof Error) throw e; - else return { status: "error", error: e as any }; -} -} -} - -/** user-defined events **/ + async authLogin(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('auth_login') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getUsers(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_users') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getUser(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_user', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getDefaultUser(fallback: boolean | null): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_default_user', { fallback }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async setDefaultUser(uuid: string | null): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('set_default_user', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async removeUser(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('remove_user', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async createCluster(props: CreateCluster): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('create_cluster', { props }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + /** + * Updates the cluster with the given UUID. The cluster only updates game setting fields + */ + async editGameSettings(uuid: string, newCluster: Cluster): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('edit_game_settings', { uuid, newCluster }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async editClusterMeta(uuid: string, name: string | null, iconPath: string | null): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('edit_cluster_meta', { uuid, name, iconPath }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async removeCluster(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('remove_cluster', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getCluster(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_cluster', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getClusters(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_clusters') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getClustersGrouped(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_clusters_grouped') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async runCluster(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('run_cluster', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getClusterLogs(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_cluster_logs', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getClusterLog(uuid: string, logName: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_cluster_log', { uuid, logName }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async uploadLog(uuid: string, logName: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('upload_log', { uuid, logName }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getScreenshots(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_screenshots', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getWorlds(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_worlds', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getRunningClusters(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_running_clusters') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getProcessesByPath(path: ClusterPath): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_processes_by_path', { path }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async killProcess(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('kill_process', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async isClusterRunning(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('is_cluster_running', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getPidByUuid(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_pid_by_uuid', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getUserByProcess(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_user_by_process', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getProcessStartedAt(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_process_started_at', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getProcessesDetailedByPath(path: ClusterPath): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_processes_detailed_by_path', { path }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getProcessDetailedById(uuid: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_process_detailed_by_id', { uuid }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getSettings(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_settings') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async setSettings(settings: Settings): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('set_settings', { settings }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getMinecraftVersions(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_minecraft_versions') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async randomMods(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('random_mods') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async getMod(projectId: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('get_mod', { projectId }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async downloadMod(clusterId: string, versionId: string): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('download_mod', { clusterId, versionId }) }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async checkForUpdate(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('check_for_update') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, + async installUpdate(): Promise> { + try { + return { status: 'ok', data: await TAURI_INVOKE('install_update') }; + } + catch (e) { + if (e instanceof Error) + throw e; + else return { status: 'error', error: e as any }; + } + }, +}; +/** user-defined events */ export const events = __makeEvents__<{ -clusterPayload: ClusterPayload, -ingressPayload: IngressPayload, -internetPayload: InternetPayload, -messagePayload: MessagePayload, -offlinePayload: OfflinePayload, -processPayload: ProcessPayload + clusterPayload: ClusterPayload; + ingressPayload: IngressPayload; + internetPayload: InternetPayload; + messagePayload: MessagePayload; + offlinePayload: OfflinePayload; + processPayload: ProcessPayload; }>({ -clusterPayload: "cluster-payload", -ingressPayload: "ingress-payload", -internetPayload: "internet-payload", -messagePayload: "message-payload", -offlinePayload: "offline-payload", -processPayload: "process-payload" -}) + clusterPayload: 'cluster-payload', + ingressPayload: 'ingress-payload', + internetPayload: 'internet-payload', + messagePayload: 'message-payload', + offlinePayload: 'offline-payload', + processPayload: 'process-payload', +}); -/** user-defined constants **/ +/** user-defined constants */ -export const PROGRAM_INFO = {"arch":"64","dev_build":true,"launcher_version":"1.0.0-alpha.1","platform":"linux","tauri_version":"2.0.0-rc.3","webview_version":"2.44.2"} as const; +export const PROGRAM_INFO = { arch: '64', dev_build: true, launcher_version: '1.0.0-alpha.1', platform: 'linux', tauri_version: '2.0.0-rc.3', webview_version: '2.44.2' } as const; -/** user-defined types **/ +/** user-defined types */ /** * Represents a single Instance and installation of Minecraft * Contains settings and identifiers on a per-Cluster basis, falling back to default settings for Options<> */ -export type Cluster = { +export interface Cluster { /** * The Uuid of a specific cluster. */ -uuid: string; -/** - * The download stage that of a cluster. - */ -stage?: ClusterStage; -/** - * The core path of the cluster. - */ -path?: string; -/** - * The associated cluster metadata. - */ -meta: ClusterMeta; -/** - * The per-cluster JVM memory allocation options. - */ -memory?: Memory | null; -/** - * The per-cluster JVM options. - */ -java?: JavaOptions | null; -/** - * The per-cluster Minecraft window default resolution. - */ -resolution?: Resolution | null; -/** - * The per-cluster Minecraft window fullscreen status. - */ -force_fullscreen: boolean | null; init_hooks?: InitHooks | null; packages: { [key in PackagePath]: Package }; update?: string | null } + uuid: string; + /** + * The download stage that of a cluster. + */ + stage?: ClusterStage; + /** + * The core path of the cluster. + */ + path?: string; + /** + * The associated cluster metadata. + */ + meta: ClusterMeta; + /** + * The per-cluster JVM memory allocation options. + */ + memory?: Memory | null; + /** + * The per-cluster JVM options. + */ + java?: JavaOptions | null; + /** + * The per-cluster Minecraft window default resolution. + */ + resolution?: Resolution | null; + /** + * The per-cluster Minecraft window fullscreen status. + */ + force_fullscreen: boolean | null; + init_hooks?: InitHooks | null; + packages: { [key in PackagePath]: Package }; + update?: string | null; +}; /** * Represents core Cluster metadata ([`Cluster#meta`]). */ -export type ClusterMeta = { +export interface ClusterMeta { /** * The user-facing name of the cluster stored as a string. */ -name: string; -/** - * The user-facing group of the cluster stored as a string. - */ -group?: string | null; -/** - * The associated Minecraft version of the cluster as last updated. - */ -mc_version: string; -/** - * The associated mod [`Loader`] as specified in the cluster. - */ -loader?: Loader; -/** - * The associated mod [`LoaderVersion`] if available. - */ -loader_version?: LoaderVersion | null; -/** - * The time that the cluster was created in [`DateTime`]. - */ -created_at?: string; -/** - * The time the cluster was last modified in [`DateTime`]. - */ -modified_at?: string; -/** - * The last time the cluster was played in [`DateTime`]. - * (Defaults to None if the cluster has never been played) - */ -played_at?: string | null; -/** - * The overall time played in seconds stored as a [`u64`]. - */ -overall_played?: bigint; -/** - * The recent time played stored as a [`u64`]. - */ -recently_played?: bigint; -/** - * The associated [`PackageData`] and modpack data for the cluster. - */ -package_data?: PackageData | null; -/** - * The user-facing cluster icon as a [`PathBuf`]. - */ -icon?: string | null; -/** - * The user-facing cluster icon as a URL string. - */ -icon_url?: string | null } + name: string; + /** + * The user-facing group of the cluster stored as a string. + */ + group?: string | null; + /** + * The associated Minecraft version of the cluster as last updated. + */ + mc_version: string; + /** + * The associated mod [`Loader`] as specified in the cluster. + */ + loader?: Loader; + /** + * The associated mod [`LoaderVersion`] if available. + */ + loader_version?: LoaderVersion | null; + /** + * The time that the cluster was created in [`DateTime`]. + */ + created_at?: string; + /** + * The time the cluster was last modified in [`DateTime`]. + */ + modified_at?: string; + /** + * The last time the cluster was played in [`DateTime`]. + * (Defaults to None if the cluster has never been played) + */ + played_at?: string | null; + /** + * The overall time played in seconds stored as a [`u64`]. + */ + overall_played?: bigint; + /** + * The recent time played stored as a [`u64`]. + */ + recently_played?: bigint; + /** + * The associated [`PackageData`] and modpack data for the cluster. + */ + package_data?: PackageData | null; + /** + * The user-facing cluster icon as a [`PathBuf`]. + */ + icon?: string | null; + /** + * The user-facing cluster icon as a URL string. + */ + icon_url?: string | null; +}; /** * Relative Path wrapper to be used as an identifer for a cluster path. */ -export type ClusterPath = string -export type ClusterPayload = { uuid: string; cluster_path: ClusterPath; path: string; name: string; event: ClusterPayloadType } -export type ClusterPayloadType = "created" | "inserted" | "synced" | "edited" | "deleted" +export type ClusterPath = string; +export interface ClusterPayload { uuid: string; cluster_path: ClusterPath; path: string; name: string; event: ClusterPayloadType }; +export type ClusterPayloadType = 'created' | 'inserted' | 'synced' | 'edited' | 'deleted'; /** * Core Cluster stages used in package logic. */ -export type ClusterStage = +export type ClusterStage = /** * Installed with no downloads left. */ -"installed" | + 'installed' | /** * Downloading any sort of core metadata or mod file. */ -"downloading" | + 'downloading' | /** * Downloading a full pack file, which is granted lower priority due to the high network demand. */ -"pack_downloading" | + 'pack_downloading' | /** * Not installed at all. */ -"not_installed" -export type CreateCluster = { name: string; mc_version: string; mod_loader: Loader; loader_version: string | null; icon: string | null; icon_url: string | null; package_data: PackageData | null; skip: boolean | null; skip_watch: boolean | null } -export type DetailedProcess = { uuid: string; user: string | null; started_at: string; pid: number } -export type IngressPayload = { event: IngressType; ingress_uuid: string; fraction: number | null; message: string } -export type IngressType = { type: "initialize" } | { type: "download_java"; version: number } | { type: "download_loader"; cluster_path: string; cluster_name: string } | { type: "sync_cluster"; cluster_path: string; cluster_name: string } | { type: "copy_cluster"; import: string; cluster_name: string } | { type: "sync_config"; new_path: string } | { type: "archival"; cluster_path: string; cluster_name: string } | { type: "download_package"; cluster_path: string; package_name: string; icon: string | null; package_id: string | null; package_version: string | null } | { type: "download_pack"; cluster_path: string; package_name: string; icon: string | null; package_version: string } + 'not_installed'; +export interface CreateCluster { name: string; mc_version: string; mod_loader: Loader; loader_version: string | null; icon: string | null; icon_url: string | null; package_data: PackageData | null; skip: boolean | null; skip_watch: boolean | null }; +export interface DetailedProcess { uuid: string; user: string | null; started_at: string; pid: number }; +export interface IngressPayload { event: IngressType; ingress_uuid: string; fraction: number | null; message: string }; +export type IngressType = { type: 'initialize' } | { type: 'download_java'; version: number } | { type: 'download_loader'; cluster_path: string; cluster_name: string } | { type: 'sync_cluster'; cluster_path: string; cluster_name: string } | { type: 'copy_cluster'; import: string; cluster_name: string } | { type: 'sync_config'; new_path: string } | { type: 'archival'; cluster_path: string; cluster_name: string } | { type: 'download_package'; cluster_path: string; package_name: string; icon: string | null; package_id: string | null; package_version: string | null } | { type: 'download_pack'; cluster_path: string; package_name: string; icon: string | null; package_version: string }; /** * Global initialization hooks for all Minecraft clusters. */ -export type InitHooks = { +export interface InitHooks { /** * Pre-launch hook. */ -pre?: string | null; -/** - * Wrapper hook for the runtime of the game instance. - */ -wrapper?: string | null; -/** - * Post-launch hook. - */ -post?: string | null } -export type InternetPayload = { event: "InstallPackage"; id: string } | { event: "InstallPack"; id: string } | { event: "InstallPath"; path: string } + pre?: string | null; + /** + * Wrapper hook for the runtime of the game instance. + */ + wrapper?: string | null; + /** + * Post-launch hook. + */ + post?: string | null; +}; +export type InternetPayload = { event: 'InstallPackage'; id: string } | { event: 'InstallPack'; id: string } | { event: 'InstallPath'; path: string }; /** * Custom Java arguments on a per-cluster basis. */ -export type JavaOptions = { +export interface JavaOptions { /** * A custom java version from the global java store, if specified. */ -custom_version?: JavaVersion | null; -/** - * Custom runtime arguments when running the cluster. - */ -custom_arguments?: string[] | null; -/** - * Custom environment variables when running the cluster. - */ -custom_env_arguments?: ([string, string])[] | null } + custom_version?: JavaVersion | null; + /** + * Custom runtime arguments when running the cluster. + */ + custom_arguments?: string[] | null; + /** + * Custom environment variables when running the cluster. + */ + custom_env_arguments?: ([string, string])[] | null; +}; /** * A struct representing a single version of the Java Runtime Environment. * Use [`locate_java`] to get an array of all located java instances on the machine. - * + * * common java paths from https://github.com/PrismLauncher/PrismLauncher/blob/develop/launcher/java/JavaUtils.cpp under GPL 3.0 - * + * * java check functionality from https://github.com/modrinth/theseus/blob/master/theseus/src/util/jre.rs under MIT */ -export type JavaVersion = { version: string; arch: string; path: string } +export interface JavaVersion { version: string; arch: string; path: string }; /** * A HashMap of all located and installed available Java versions */ -export type JavaVersions = { [key in string]: JavaVersion } +export type JavaVersions = { [key in string]: JavaVersion }; /** * Available mod loaders to be used for a cluster. */ -export type Loader = +export type Loader = /** * The default vanilla loader, no modding supported. */ -"vanilla" | + 'vanilla' | /** * The MinecraftForge Minecraft mod loader. */ -"forge" | + 'forge' | /** * The FabircMC Minecraft mod loader. */ -"fabric" | + 'fabric' | /** * The NeoForge Minecraft mod loader. */ -"neoforge" | + 'neoforge' | /** * The Quilt Minecraft mod loader. */ -"quilt" | + 'quilt' | /** * The Legacy Fabric port mod loader. */ -"legacyfabric" + 'legacyfabric'; /** * A version of a Minecraft mod loader */ -export type LoaderVersion = { +export interface LoaderVersion { /** * The version ID of the loader */ -id: string; -/** - * The URL of the version's manifest - */ -url: string; -/** - * Whether the loader is stable or not - */ -stable: boolean } + id: string; + /** + * The URL of the version's manifest + */ + url: string; + /** + * Whether the loader is stable or not + */ + stable: boolean; +}; /** * Universal interface for managed package dependencies. */ -export type ManagedDependency = { version_id: string | null; package_id: string | null; file_name: string | null; dependency_type: PackageDependency } +export interface ManagedDependency { version_id: string | null; package_id: string | null; file_name: string | null; dependency_type: PackageDependency }; /** * Universal metadata for any managed package from a Mod distribution platform. */ -export type ManagedPackage = { id: string; uid: string | null; package_type: PackageType; title: string; description: string; main: string; versions: string[]; game_versions: string[]; loaders: string[]; icon_url: string | null; created: string; updated: string; client: PackageSide; server: PackageSide; downloads: number; followers: number; categories: string[]; optional_categories: string[] | null } +export interface ManagedPackage { id: string; uid: string | null; package_type: PackageType; title: string; description: string; main: string; versions: string[]; game_versions: string[]; loaders: string[]; icon_url: string | null; created: string; updated: string; client: PackageSide; server: PackageSide; downloads: number; followers: number; categories: string[]; optional_categories: string[] | null }; /** * Universal interface for managed package authors and users. */ -export type ManagedUser = { id: string; role: string; username: string; name: string | null; avatar: string | null; description: string | null; created: string } +export interface ManagedUser { id: string; role: string; username: string; name: string | null; avatar: string | null; description: string | null; created: string }; /** * Universal managed package version of a package. */ -export type ManagedVersion = { id: string; package_id: string; author: string; name: string; featured: boolean; version_id: string; changelog: string; changelog_url: string | null; published: string; downloads: number; version_type: string; files: ManagedVersionFile[]; deps: ManagedDependency[]; game_versions: string[]; loaders: string[] } +export interface ManagedVersion { id: string; package_id: string; author: string; name: string; featured: boolean; version_id: string; changelog: string; changelog_url: string | null; published: string; downloads: number; version_type: string; files: ManagedVersionFile[]; deps: ManagedDependency[]; game_versions: string[]; loaders: string[] }; /** * Universal interface for managed package files. */ -export type ManagedVersionFile = { url: string; file_name: string; primary: boolean; size: number; file_type: PackageFile | null; hashes: { [key in string]: string } } +export interface ManagedVersionFile { url: string; file_name: string; primary: boolean; size: number; file_type: PackageFile | null; hashes: { [key in string]: string } }; /** * Global memory settings across all clusters. */ -export type Memory = { +export interface Memory { /** * Maximum amount of Java memory available globally. */ -maximum: number; -/** - * Minimum amount of Java memory available globally. - */ -minimum: number } -export type MessagePayload = { message: string } + maximum: number; + /** + * Minimum amount of Java memory available globally. + */ + minimum: number; +}; +export interface MessagePayload { message: string }; /** * A structure of all needed Minecraft credentials for logging in and account management. */ -export type MinecraftCredentials = { +export interface MinecraftCredentials { /** * The uuid of the credentials. */ -id: string; -/** - * The username of the Minecraft account. - */ -username: string; -/** - * The access token as a String. - */ -access_token: string; -/** - * The refresh token as a string for [`MinecraftState#refresh`]. - */ -refresh_token: string; -/** - * The time that the access token expires as a [`DateTime`]. - */ -expires: string } -export type OfflinePayload = { offline: boolean } + id: string; + /** + * The username of the Minecraft account. + */ + username: string; + /** + * The access token as a String. + */ + access_token: string; + /** + * The refresh token as a string for [`MinecraftState#refresh`]. + */ + refresh_token: string; + /** + * The time that the access token expires as a [`DateTime`]. + */ + expires: string; +}; +export interface OfflinePayload { offline: boolean }; /** * A struct that represents a Package. */ -export type Package = { sha512: string; meta: PackageMetadata; file_name: string; disabled: boolean } +export interface Package { sha512: string; meta: PackageMetadata; file_name: string; disabled: boolean }; /** * Optional data used to link a specific cluster to a package project. */ -export type PackageData = { +export interface PackageData { /** * The package ID as a String. */ -package_id: string | null; -/** - * The version of the package as a String. - */ -version_id: string | null; -/** - * Whether or not the current package is locked (for legacy modpack support). - */ -locked?: boolean | null } + package_id: string | null; + /** + * The version of the package as a String. + */ + version_id: string | null; + /** + * Whether or not the current package is locked (for legacy modpack support). + */ + locked?: boolean | null; +}; /** * The type of a [`ManagedDependency`]. */ -export type PackageDependency = "Required" | "Optional" | "Incompatible" | "Embedded" +export type PackageDependency = 'Required' | 'Optional' | 'Incompatible' | 'Embedded'; /** * The file type of a [`Package`]. */ -export type PackageFile = "required_pack" | "optional_pack" | "unknown" +export type PackageFile = 'required_pack' | 'optional_pack' | 'unknown'; /** * Metadata that represents a [`Package`]. */ -export type PackageMetadata = { type: "managed"; package: ManagedPackage; version: ManagedVersion; users: ManagedUser; update: ManagedVersion | null; incompatible: boolean } | { type: "mapped"; title: string | null; description: string | null; authors: string[]; version: string | null; icon: string | null; package_type: string | null } | { type: "unknown" } +export type PackageMetadata = { type: 'managed'; package: ManagedPackage; version: ManagedVersion; users: ManagedUser; update: ManagedVersion | null; incompatible: boolean } | { type: 'mapped'; title: string | null; description: string | null; authors: string[]; version: string | null; icon: string | null; package_type: string | null } | { type: 'unknown' }; /** * Relative [`PathBuf`] for a specific [`Package`] of a [`Cluster`]. */ -export type PackagePath = string +export type PackagePath = string; /** * The Client/Server side type of a [`Package`]. */ -export type PackageSide = "required" | "optional" | "unsupported" | "unknown" +export type PackageSide = 'required' | 'optional' | 'unsupported' | 'unknown'; /** * Represents types of packages handled by the launcher. */ -export type PackageType = +export type PackageType = /** * represents a mod jarfile */ -"mod" | + 'mod' | /** * represents a datapack file */ -"datapack" | + 'datapack' | /** * represents a resourcepack file */ -"resource" | + 'resource' | /** * represents a shaderpack file */ -"shader" -export type ProcessPayload = { uuid: string; pid: number; event: ProcessPayloadType; message: string } -export type ProcessPayloadType = "started" | "modified" | "finished" | "logging" + 'shader'; +export interface ProcessPayload { uuid: string; pid: number; event: ProcessPayloadType; message: string }; +export type ProcessPayloadType = 'started' | 'modified' | 'finished' | 'logging'; /** * Global Minecraft resolution. */ -export type Resolution = [number, number] +export type Resolution = [number, number]; /** * A global settings state for the launcher. */ -export type Settings = { +export interface Settings { /** * A OneLauncher [`Theme`] managed by the core GUI. */ -theme: Theme; -/** - * Does not ask for confirmation when closing the OneLauncher GUI - */ -hide_close_prompt?: boolean; -/** - * Disables animations in the OneLauncher GUI - */ -disable_animations?: boolean; -/** - * A global fullscreen Minecraft state. - */ -force_fullscreen?: boolean; -/** - * Whether to allow launching the same cluster under the same account. - */ -allow_parallel_running_clusters?: boolean; -/** - * Whether to launch Feral Gamemode on Linux systems. - */ -enable_gamemode?: boolean; -/** - * A global default [`Resolution`] for Minecraft. - */ -resolution: Resolution; -/** - * A global [`JavaVersions`] list and default version. - */ -java_versions: JavaVersions; -/** - * A global [`Memory`] settings store for Java memory settings. - */ -memory: Memory; -/** - * Global and default initialization hooks . - */ -init_hooks: InitHooks; -/** - * Global and default custom Java arguments. - */ -custom_java_args: string[]; -/** - * Global and default custom environment variables. - */ -custom_env_args: ([string, string])[]; -/** - * Global and default maximum [`Semaphore`] I/O operations. - */ -max_async_io_operations: bigint; -/** - * Global and default maximum [`Semaphore`] HTTP operations. - */ -max_async_fetches: bigint; -/** - * The [`CURRENT_FORMAT_VERSION`] of this settings file. - */ -version: number; -/** - * Whether or not to disable Discord IPC. - */ -disable_discord?: boolean; -/** - * Whether or not to enable a debug mode in the launcher. - */ -debug_mode?: boolean; -/** - * Whether or not to disable Plausible and Sentry analytics. - */ -disable_analytics?: boolean; -/** - * The core global config directory stored as a [`PathBuf`]. - */ -config_dir?: string | null; -/** - * Whether or not to minimize the launcher upon a game launch. - */ -hide_on_launch?: boolean; -/** - * Enable/disable advanced rendering and window decorations. - */ -rendering?: boolean } + theme: Theme; + /** + * Does not ask for confirmation when closing the OneLauncher GUI + */ + hide_close_prompt?: boolean; + /** + * Disables animations in the OneLauncher GUI + */ + disable_animations?: boolean; + /** + * A global fullscreen Minecraft state. + */ + force_fullscreen?: boolean; + /** + * Whether to allow launching the same cluster under the same account. + */ + allow_parallel_running_clusters?: boolean; + /** + * Whether to launch Feral Gamemode on Linux systems. + */ + enable_gamemode?: boolean; + /** + * A global default [`Resolution`] for Minecraft. + */ + resolution: Resolution; + /** + * A global [`JavaVersions`] list and default version. + */ + java_versions: JavaVersions; + /** + * A global [`Memory`] settings store for Java memory settings. + */ + memory: Memory; + /** + * Global and default initialization hooks . + */ + init_hooks: InitHooks; + /** + * Global and default custom Java arguments. + */ + custom_java_args: string[]; + /** + * Global and default custom environment variables. + */ + custom_env_args: ([string, string])[]; + /** + * Global and default maximum [`Semaphore`] I/O operations. + */ + max_async_io_operations: bigint; + /** + * Global and default maximum [`Semaphore`] HTTP operations. + */ + max_async_fetches: bigint; + /** + * The [`CURRENT_FORMAT_VERSION`] of this settings file. + */ + version: number; + /** + * Whether or not to disable Discord IPC. + */ + disable_discord?: boolean; + /** + * Whether or not to enable a debug mode in the launcher. + */ + debug_mode?: boolean; + /** + * Whether or not to disable Plausible and Sentry analytics. + */ + disable_analytics?: boolean; + /** + * The core global config directory stored as a [`PathBuf`]. + */ + config_dir?: string | null; + /** + * Whether or not to minimize the launcher upon a game launch. + */ + hide_on_launch?: boolean; + /** + * Enable/disable advanced rendering and window decorations. + */ + rendering?: boolean; +}; /** * A OneLauncher theme managed by the GUI. */ -export type Theme = +export type Theme = /** * A default Dark theme. */ -"dark" | + 'dark' | /** * A default Light theme. */ -"light" | + 'light' | /** * OLED Dark Theme. */ -"contrast" | + 'contrast' | /** * Cute and colorful theme. */ -"cat" -export type Update = { version: string } + 'cat'; +export interface Update { version: string }; /** * A game version of Minecraft */ -export type Version = { +export interface Version { /** * A unique identifier of the version */ -id: string; -/** - * The release type of the version - */ -type: VersionType; -/** - * A link to additional information about the version - */ -url: string; -/** - * The latest time a file in this version was updated - */ -time: string; -/** - * The time this version was released - */ -releaseTime: string; -/** - * The SHA1 hash of the additional information about the version - */ -sha1: string; -/** - * Whether the version supports the latest player safety features - */ -complianceLevel: number; -/** - * The SHA1 hash of the original unmodified Minecraft version's JSON - * This is only available when using the Pulseflow mirror - */ -originalSha1?: string | null } + id: string; + /** + * The release type of the version + */ + type: VersionType; + /** + * A link to additional information about the version + */ + url: string; + /** + * The latest time a file in this version was updated + */ + time: string; + /** + * The time this version was released + */ + releaseTime: string; + /** + * The SHA1 hash of the additional information about the version + */ + sha1: string; + /** + * Whether the version supports the latest player safety features + */ + complianceLevel: number; + /** + * The SHA1 hash of the original unmodified Minecraft version's JSON + * This is only available when using the Pulseflow mirror + */ + originalSha1?: string | null; +}; /** * The version type */ -export type VersionType = +export type VersionType = /** * A major version, which is stable for all players to use */ -"release" | + 'release' | /** * An experimental version, which is unstable and used for feature previews and beta testing */ -"snapshot" | + 'snapshot' | /** * The oldest versions before the game was released */ -"old_alpha" | + 'old_alpha' | /** * Early versions of the game */ -"old_beta" + 'old_beta'; -/** tauri-specta globals **/ - -import { - invoke as TAURI_INVOKE, - Channel as TAURI_CHANNEL, -} from "@tauri-apps/api/core"; -import * as TAURI_API_EVENT from "@tauri-apps/api/event"; -import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow"; - -type __EventObj__ = { +interface __EventObj__ { listen: ( cb: TAURI_API_EVENT.EventCallback, ) => ReturnType>; @@ -847,11 +928,11 @@ type __EventObj__ = { emit: T extends null ? (payload?: T) => ReturnType : (payload: T) => ReturnType; -}; +} export type Result = - | { status: "ok"; data: T } - | { status: "error"; error: E }; + | { status: 'ok'; data: T } + | { status: 'error'; error: E }; function __makeEvents__>( mappings: Record, @@ -874,11 +955,11 @@ function __makeEvents__>( }), get: (_, command: keyof __EventObj__) => { switch (command) { - case "listen": + case 'listen': return (arg: any) => TAURI_API_EVENT.listen(name, arg); - case "once": + case 'once': return (arg: any) => TAURI_API_EVENT.once(name, arg); - case "emit": + case 'emit': return (arg: any) => TAURI_API_EVENT.emit(name, arg); } }, diff --git a/packages/core/src/store/package.rs b/packages/core/src/store/package.rs index e4b3e3f7..878cb25c 100644 --- a/packages/core/src/store/package.rs +++ b/packages/core/src/store/package.rs @@ -1,12 +1,12 @@ //! Handlers for Mod metadata that can be displayed in a GUI mod list or exported as a mod pack +use crate::utils::http::{self, write_icon, FetchSemaphore, IoSemaphore}; +use crate::State; use async_zip::tokio::read::fs::ZipFileReader; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::{Path, PathBuf}; -use crate::utils::http::{self, write_icon, FetchSemaphore, IoSemaphore}; -use crate::State; use super::{Cluster, PackagePath};