Skip to content

Commit

Permalink
Revert "chore: Remove packageManager requirement"
Browse files Browse the repository at this point in the history
This reverts commit 471f5e8.
  • Loading branch information
LynithDev committed Dec 1, 2024
1 parent 291e937 commit b4100a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
12 changes: 3 additions & 9 deletions apps/frontend/src/ui/pages/browser/BrowserMain.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Providers } from '@onelauncher/client/bindings';
import type { ManagedPackage, 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';
Expand All @@ -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()! as unknown as FeaturedProps['package']} />
<Featured package={browser.featuredPackage()!} />

<For each={Object.entries(browser.popularPackages()!)}>
{([provider, results]) => (
Expand All @@ -40,13 +40,7 @@ function BrowserMain() {
}

interface FeaturedProps {
package: {
title: string;
description: string;
id: string;
provider: Providers;
oneconfig: boolean;
};
package: ManagedPackage;
}

function Featured(props: FeaturedProps) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0-alpha.1",
"private": true,
"engineStrict": true,
"packageManager": "[email protected]",
"description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost",
"license": "GPL-3.0-only",
"homepage": "https://polyfrost.org",
Expand Down
22 changes: 2 additions & 20 deletions packages/core/src/api/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,9 @@ pub async fn filter_java_version(java_version: Option<u32>) -> crate::Result<Vec
}

#[derive(Deserialize)]
pub struct JavaZuluPackage {
struct JavaPackage {
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 ?
Expand All @@ -62,7 +44,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<JavaZuluPackage>>(Method::GET, &format!(
let packages = fetch_json::<Vec<JavaPackage>>(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?;
Expand Down

0 comments on commit b4100a4

Please sign in to comment.