diff options
| author | 2026-02-25 02:06:07 +0800 | |
|---|---|---|
| committer | 2026-02-25 02:06:07 +0800 | |
| commit | 78ac61904d78d558d092eff08c9f261cbdb187e8 (patch) | |
| tree | 96f68d1f1554ee3a0532793afaaa52b0c73dcbec /src-tauri/src/core/java/provider.rs | |
| parent | 8ff3af6cb908fd824b512379dd21ed4f595ab6bb (diff) | |
| parent | 329734b23957b84cde2af459fa61c7385fb5b5f1 (diff) | |
| download | DropOut-78ac61904d78d558d092eff08c9f261cbdb187e8.tar.gz DropOut-78ac61904d78d558d092eff08c9f261cbdb187e8.zip | |
feat(ui): partial react rewrite (#77)
## Summary by Sourcery
Export backend data structures to TypeScript for the new React-based UI
and update CI to build additional targets.
New Features:
- Generate TypeScript definitions for core backend structs and enums
used by the UI.
- Now use our own Azure app(_DropOut_) to finish the authorize process.
Enhancements:
- Annotate existing Rust models with ts-rs metadata to control exported
TypeScript shapes, including tagged enums and opaque JSON fields.
Build:
- Add ts-rs as a dependency for generating TypeScript bindings from Rust
types.
CI:
- Extend the Semifold CI workflow to run on the dev branch and build
additional Linux musl and Windows GNU targets using cross where needed.
Diffstat (limited to 'src-tauri/src/core/java/provider.rs')
| -rw-r--r-- | src-tauri/src/core/java/provider.rs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src-tauri/src/core/java/provider.rs b/src-tauri/src/core/java/provider.rs new file mode 100644 index 0000000..8aa0a0d --- /dev/null +++ b/src-tauri/src/core/java/provider.rs @@ -0,0 +1,58 @@ +use crate::core::java::{ImageType, JavaCatalog, JavaDownloadInfo, JavaError}; +use tauri::AppHandle; + +/// Trait for Java distribution providers (e.g., Adoptium, Corretto) +/// +/// Implementations handle fetching Java catalogs and release information +/// from different distribution providers. +pub trait JavaProvider: Send + Sync { + /// Fetch the Java catalog (all available versions for this provider) + /// + /// # Arguments + /// * `app_handle` - The Tauri app handle for cache access + /// * `force_refresh` - If true, bypass cache and fetch fresh data + /// + /// # Returns + /// * `Ok(JavaCatalog)` with available versions + /// * `Err(JavaError)` if fetch or parsing fails + async fn fetch_catalog( + &self, + app_handle: &AppHandle, + force_refresh: bool, + ) -> Result<JavaCatalog, JavaError>; + + /// Fetch a specific Java release + /// + /// # Arguments + /// * `major_version` - The major version number (e.g., 17, 21) + /// * `image_type` - Whether to fetch JRE or JDK + /// + /// # Returns + /// * `Ok(JavaDownloadInfo)` with download details + /// * `Err(JavaError)` if fetch or parsing fails + async fn fetch_release( + &self, + major_version: u32, + image_type: ImageType, + ) -> Result<JavaDownloadInfo, JavaError>; + + /// Get list of available major versions + /// + /// # Returns + /// * `Ok(Vec<u32>)` with available major versions + /// * `Err(JavaError)` if fetch fails + async fn available_versions(&self) -> Result<Vec<u32>, JavaError>; + + /// Get provider name (e.g., "adoptium", "corretto") + #[allow(dead_code)] + fn provider_name(&self) -> &'static str; + + /// Get OS name for this provider's API + fn os_name(&self) -> &'static str; + + /// Get architecture name for this provider's API + fn arch_name(&self) -> &'static str; + + /// Get installation directory prefix (e.g., "temurin", "corretto") + fn install_prefix(&self) -> &'static str; +} |