chore: Remove packageManager requirement
This commit is contained in:
parent
bda3b8b7f6
commit
471f5e8097
3 changed files with 29 additions and 6 deletions
|
|
@ -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() {
|
|||
<BrowserContent>
|
||||
<div class="flex flex-col gap-8">
|
||||
<Show when={browser.popularPackages() !== undefined && browser.featuredPackage() !== undefined}>
|
||||
<Featured package={browser.featuredPackage()!} />
|
||||
<Featured package={browser.featuredPackage()! as unknown as FeaturedProps['package']} />
|
||||
|
||||
<For each={Object.entries(browser.popularPackages()!)}>
|
||||
{([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) {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -24,9 +24,27 @@ pub async fn filter_java_version(java_version: Option<u32>) -> crate::Result<Vec
|
|||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JavaPackage {
|
||||
pub struct JavaZuluPackage {
|
||||
pub download_url: String,
|
||||
pub name: PathBuf,
|
||||
pub java_version: Vec<u32>,
|
||||
}
|
||||
|
||||
pub async fn fetch_zulu() -> crate::Result<Vec<JavaZuluPackage>> {
|
||||
let state = State::get().await?;
|
||||
|
||||
fetch_json::<Vec<JavaZuluPackage>>(
|
||||
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<PathBuf> {
|
|||
.await?;
|
||||
|
||||
send_ingress(&ingress, 0.0, Some("fetching java api")).await?;
|
||||
let packages = fetch_json::<Vec<JavaPackage>>(Method::GET, &format!(
|
||||
let packages = fetch_json::<Vec<JavaZuluPackage>>(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?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue