From 471f5e8097bf55e3e11e693bcf97dbaa3cf52a15 Mon Sep 17 00:00:00 2001 From: LynithDev <61880709+LynithDev@users.noreply.github.com> Date: Sun, 1 Dec 2024 12:46:15 +0100 Subject: [PATCH] chore: Remove packageManager requirement --- .../src/ui/pages/browser/BrowserMain.tsx | 12 +++++++--- package.json | 1 - packages/core/src/api/java.rs | 22 +++++++++++++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/apps/frontend/src/ui/pages/browser/BrowserMain.tsx b/apps/frontend/src/ui/pages/browser/BrowserMain.tsx index 59710e6..9f51de2 100644 --- a/apps/frontend/src/ui/pages/browser/BrowserMain.tsx +++ b/apps/frontend/src/ui/pages/browser/BrowserMain.tsx @@ -1,4 +1,4 @@ -import type { ManagedPackage, Providers } from '@onelauncher/client/bindings'; +import type { Providers } from '@onelauncher/client/bindings'; import { ChevronRightIcon } from '@untitled-theme/icons-solid'; import OneConfigLogo from '~assets/logos/oneconfig.svg?component-solid'; import Button from '~ui/components/base/Button'; @@ -21,7 +21,7 @@ function BrowserMain() {
- + {([provider, results]) => ( @@ -40,7 +40,13 @@ function BrowserMain() { } interface FeaturedProps { - package: ManagedPackage; + package: { + title: string; + description: string; + id: string; + provider: Providers; + oneconfig: boolean; + }; } function Featured(props: FeaturedProps) { diff --git a/package.json b/package.json index 7647526..482a043 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "version": "1.0.0-alpha.1", "private": true, "engineStrict": true, - "packageManager": "pnpm@9.12.2", "description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost", "license": "GPL-3.0-only", "homepage": "https://polyfrost.org", diff --git a/packages/core/src/api/java.rs b/packages/core/src/api/java.rs index 43041cd..04511dd 100644 --- a/packages/core/src/api/java.rs +++ b/packages/core/src/api/java.rs @@ -24,9 +24,27 @@ pub async fn filter_java_version(java_version: Option) -> crate::Result, +} + +pub async fn fetch_zulu() -> crate::Result> { + let state = State::get().await?; + + fetch_json::>( + Method::GET, + &format!( + "https://api.azul.com/metadata/v1/zulu/packages/?os={}&arch={}&archive_type=zip&java_package_type=jre&javafx_bundled=false&latest=true&release_status=ga&availability_types=CA&certifications=tck&page=1&page_size=100", + std::env::consts::OS, + std::env::consts::ARCH, + ), + None, + None, + &state.fetch_semaphore, + ) + .await } // TODO: support more than just zulu ? @@ -44,7 +62,7 @@ pub async fn install_java(java_version: u32) -> crate::Result { .await?; send_ingress(&ingress, 0.0, Some("fetching java api")).await?; - let packages = fetch_json::>(Method::GET, &format!( + let packages = fetch_json::>(Method::GET, &format!( "https://api.azul.com/metadata/v1/zulu/packages?arch={}&java_version={}&os={}&archive_type=zip&javafx_bundled=false&java_package_type=jre&page_size=1", std::env::consts::ARCH, java_version, std::env::consts::OS, ), None, None, &state.fetch_semaphore).await?;