aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/core
Commit message (Collapse)AuthorAgeFilesLines
* fix(instance): InstanceManager -> InstanceStateHsiangNianian2026-03-182-7/+4
|
* fix(modpack): 将 CurseForge API Key 改为编译期可选常量 (#118)Begonia, HE2026-03-181-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # fix(modpack): 将 CurseForge API Key 改为编译期可选常量 修复 `env!()` 宏在开发者本地无 `CURSEFORGE_API_KEY` 时导致编译失败的问题,改用 `option_env!()` + build.rs 中的 `dotenvy` 读取 .env 文件,实现编译期嵌入、缺失时优雅降级。 ## 更改类型 - [x] Bug 修复(修复问题的非破坏性更改) - [ ] 新功能(添加功能的非破坏性更改) - [ ] 破坏性更改(会导致现有功能无法正常工作的修复或功能) - [ ] 文档更新 - [ ] UI/UX 改进 - [ ] 性能优化 - [ ] 代码重构(无功能性更改) - [x] 配置更改 - [ ] 测试添加或更新 ## LLM 生成代码声明 - [x] 此 PR 不包含 LLM 生成的代码,我**提供**质量担保 ## 相关 Issue 相关 #110 #117 ## 更改内容 ### 后端 (Rust) - modpack.rs:将 `env!("CURSEFORGE_API_KEY")` 替换为 `const CURSEFORGE_API_KEY: Option<&str> = option_env!("CURSEFORGE_API_KEY")`,key 不存在时编译为 `None`,调用 CurseForge 功能时返回友好错误而非 panic - build.rs:添加 `dotenvy::dotenv()` 调用,允许通过 .env 文件在编译期注入 key,并注册 `cargo:rerun-if-changed` / `cargo:rerun-if-env-changed` 确保增量构建正确 ### 前端 (Svelte) - 无 ### 配置 - Cargo.toml:在 `[build-dependencies]` 中添加 `dotenvy = { version = "0.15", default-features = false }` - .gitignore:添加 .env / `.env.local` 忽略规则,防止 key 被意外提交 - .env.example:新增示例文件,说明可选配置项及获取方式 ## 测试 ### 测试环境 - **操作系统**:Fedora Linux 6.19.6-300.fc44.x86_64 x86_64 - **DropOut 版本**:0.2.0-alpha.5 - **测试的 Minecraft 版本**:N/A - **Mod 加载器**:N/A ### 测试用例 - [ ] 已在 Windows 上测试 - [ ] 已在 macOS 上测试 - [x] 已在 Linux 上测试 - [ ] 已测试原版 Minecraft - [ ] 已测试 Fabric - [ ] 已测试 Forge - [ ] 已测试游戏启动 - [ ] 已测试登录流程 - [ ] 已测试 Java 检测/下载 ### 测试步骤 1. 不设置 `CURSEFORGE_API_KEY`,不创建 .env 文件,直接执行 `cargo check` → 应编译通过(无报错) 2. 创建 .env 文件并写入 `CURSEFORGE_API_KEY=test_key`,执行 `cargo check` → 应编译通过,key 被嵌入二进制 3. 不含 key 的构建中触发 CurseForge modpack 导入 → 应返回友好错误提示而非 panic ## 检查清单 ### 代码质量 - [x] 我的代码遵循项目的代码风格指南 - [x] 我已对自己的代码进行了自审 - [ ] 我已对难以理解的区域添加了注释 - [x] 我的更改没有产生新的警告或错误 ### 测试验证 - [x] 我已在本地测试了我的更改 - [ ] 我已添加测试来证明我的修复有效或功能正常工作 - [x] 新的和现有的单元测试在本地通过 - [x] 我至少在一个目标平台上进行了测试 ### 文档更新 - [ ] 我已相应地更新了文档 - [ ] 如有需要,我已更新 README - [ ] 我已在必要处添加/更新代码注释 ### 依赖项 - [x] 我已检查没有添加不必要的依赖项 - [x] 所有新依赖项都已正确记录 - [x] Cargo.lock 已更新 ## 附加说明 `dotenvy` 仅作为 **build-dependency**,不会进入最终二进制。官方发布构建通过 CI 环境变量注入 key,普通开发者无需任何操作即可正常编译和运行。 Co-authored-by: 简律纯 <i@jyunko.cn>
* Potential fix for pull request finding简律纯2026-03-181-1/+18
| | | Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* feat(instance): finish multi instances systemHsiangNianian2026-03-121-30/+472
|
* fix(modpack): make CURSEFORGE_API_KEY optional for devHsiangNianian2026-03-121-3/+7
|
* feat: prepare for nightly alpha苏向夜2026-02-251-0/+1
|
* refactor: rewrite login and settings pages苏向夜2026-02-242-3/+5
|
* Merge branch 'main' into refactor/migrate-to-react简律纯2026-02-232-0/+490
|\
| * Add modpack parsing and extraction for Modrinth, CurseForge, MultiMC (#100)SuperCCC2026-02-222-0/+490
| |
* | refactor(client): rewrite macros to generate client苏向夜2026-02-1814-239/+75
| |
* | feat(java): add mise version manager support and refactor detection logicBegonia, HE2026-01-304-12/+76
| | | | | | | | | | | | | | | | | | | | - Add scan_java_dir() helper to filter symlinks and scan directories - Implement find_mise_java() for ~/.local/share/mise/installs/java/ - Refactor find_sdkman_java() to scan candidates dir instead of 'current' - Fix import paths to use absolute crate::core::java:: paths - Add mise detection to Linux and macOS candidates Reviewed-by: Claude Sonnet 4.5
* | refactor: add TypeScript support to account storage structuresHsiangNianian2026-01-301-3/+21
| |
* | refactor: add TypeScript support to JavaConfig structHsiangNianian2026-01-301-3/+7
| |
* | refactor(java): add TypeScript support to Java data structuresHsiangNianian2026-01-301-4/+21
| |
* | refactor(java): enhance Adoptium structs with TypeScript supportHsiangNianian2026-01-301-5/+26
| |
* | fix: resolve rebase conflicts and compilation errorsBegonia, HE2026-01-294-137/+152
| | | | | | | | | | | | | | | | | | | | | | | | - Export JavaError from java module - Fix type mismatches in Adoptium provider methods - Add type annotations for reqwest json() calls - Remove non-existent cache_version field from JavaCatalog - Fix resolve_java_for_launch call signature (remove extra window param) - Add error conversion to String for Tauri commands - Fix import for save_catalog_cache in adoptium.rs Reviewed-by: Claude Sonnet 4.5
* | refactor(java): improve error handling and loggingBegonia, HE2026-01-294-20/+139
| | | | | | | | | | | | | | | | | | | | - Extract JavaError to dedicated error.rs module - Add serde defaults for JavaInstallation optional fields - Replace unwrap() with proper error propagation - Add detailed logging for Java resolution priority chain - Improve error mapping in validation (NotFound vs VerificationFailed) Reviewed-by: Claude Sonnet 4.5
* | feat(java): implement cache versioning, size limits, and automatic cleanupBegonia, HE2026-01-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add CACHE_VERSION constant for cache format compatibility tracking - Add MAX_CACHE_SIZE_BYTES limit (10 MB) to prevent unbounded cache growth - Add cache_version field to JavaCatalog struct with default value - Implement cache version validation in load_cached_catalog() - Implement cache size enforcement in save_catalog_cache() - Add cleanup_expired_caches() for background cache cleanup - Add enforce_cache_size_limit() to validate cache file sizes - Add is_cache_version_compatible() helper function - Automatically clean up expired caches on load and clear operations - Validate cache version before using cached data Fixes: - Cache expiration without automatic cleanup (now cleaned on load) - Missing cache version control (now validates format compatibility) - Unbounded cache size growth (now limited to 10 MB) Reviewed-by: Claude 3.5 Sonnet
* | feat(java): Enhance Java detection and error handlingBegonia, HE2026-01-293-28/+106
| | | | | | | | | | | | | | | | | | | | | | | | - Added support for detecting Java installations from SDKMAN! in `find_sdkman_java`. - Improved `run_which_command_with_timeout` to handle command timeouts gracefully. - Introduced a unified `JavaError` enum for consistent error handling across Java operations. - Updated functions to return `Result` types instead of `Option` for better error reporting. - Enhanced `load_cached_catalog` and `save_catalog_cache` to use `JavaError`. - Refactored `fetch_java_catalog`, `fetch_java_release`, and `fetch_available_versions` to return `JavaError`. - Improved validation functions to return detailed errors when checking Java installations. - Added tests for version parsing and compatibility checks. - Updated `resolve_java_for_launch` to handle instance-specific and global Java paths.
* | refactor(java): simplify version compatibility logic and improve error handlingBegonia, HE2026-01-295-81/+83
| | | | | | | | | | | | | | | | | | | | | | - Extract version compatibility check into shared validation function - Remove duplicated version checking code across multiple modules - Simplify Java detection timeout logic in detection.rs - Expand vendor detection to support more JDK distributions (Dragonwell, Kona, Semeru, BiSheng, etc.) - Refactor start_game to use priority-based Java resolution - Improve error handling in Adoptium provider task collection Reviewed-by: Claude Sonnet 4.5
* | refactor(java): replace unwrap with expect for better error handlingBegonia, HE2026-01-291-1/+6
| | | | | | | | | | | | Replace potentially panicking unwrap() call with expect() that includes a descriptive error message to aid debugging if the edge case occurs. Reviewed-by: Claude Sonnet 4.5
* | refactor(java): suppress dead code warnings and improve detectionBegonia, HE2026-01-294-16/+19
| | | | | | | | | | | | | | | | | | - Add #[allow(dead_code)] attributes to utility functions - Improve 64-bit detection with case-insensitive check - Support aarch64 architecture in bitness detection - Add TODO for future vendor expansion Reviewed-by: Claude Sonnet 4.5
* | refactor(java): address Sourcery AI code review feedbackBegonia, HE2026-01-294-84/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Centralize strip_unc_prefix into java/mod.rs to eliminate duplication across detection.rs and validation.rs - Remove unused JAVA_CHECK_TIMEOUT constant from validation.rs - Implement actual timeout mechanism in run_which_command_with_timeout() using try_wait() loop - Parallelize Adoptium API requests for better catalog fetch performance Fixes: - Multiple strip_unc_prefix implementations consolidated - Timeout constant now properly enforced in which/where command execution - Catalog fetching now uses concurrent tokio::spawn tasks instead of sequential await Reviewed-by: Claude Sonnet 4.5
* | refactor(java): modularize Java detection and management systemBegonia, HE2026-01-2911-1119/+1340
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Split monolithic java.rs (1089 lines) into focused modules - detection: Java installation discovery - validation: Version validation and requirements checking - priority: Installation selection priority logic - provider: Java download provider trait - providers: Provider implementations (Adoptium) - persistence: Cache and catalog management - Add java_path_override field to Instance struct for per-instance Java configuration - Export JavaInstallation at core module level This refactoring improves maintainability and prepares for multi-vendor Java provider support. Reviewed-by: Claude Sonnet 4.5
* | docs(java): add TODO comment for refactoring candidate detectionBegonia, HE2026-01-291-0/+2
| | | | | | | | Reviewed-by: Claude-Sonnet-4.5
* | feat(ts-bindings): fix ts bindings naming convention苏向夜2026-01-239-0/+41
| |
* | feat(ts-bindings): fix ts bindings naming convention苏向夜2026-01-2110-79/+70
| |
* | fix(fabric): Add untagged attribute to FabricMainClass enum exportHsiangNianian2026-01-211-1/+2
| |
* | fix(auth): Remove commented-out prism's Client ID from auth.rsHsiangNianian2026-01-211-1/+0
| |
* | fix: Update TypeScript export paths to reflect new directory structureHsiangNianian2026-01-2110-52/+67
| |
* | feat: Add TypeScript support to data structures using ts-rs for type generationHsiangNianian2026-01-2110-54/+247
|/
* feat(backend): enhance instance management for editor supportHsiangNianian2026-01-181-0/+14
| | | | | | | - Sync instance.version_id after start_game, install_fabric, install_forge - Add jvm_args_override and memory_override to Instance struct - Add file management commands: list_instance_directory, delete_instance_file, open_file_explorer - Support per-instance settings overrides (Java args, memory)
* feat(migration): implement shared cache migration with SHA1 dedupHsiangNianian2026-01-181-0/+224
| | | | | | | | - Add migrate_to_shared_caches() with hard link preference - SHA1-based deduplication across all instances - Copy fallback for cross-filesystem scenarios - Auto-enable use_shared_caches after successful migration - UI shows statistics: moved files, hardlinks/copies, MB saved
* fix(ci): improve pre-commit fmt hook configurationHsiangNianian2026-01-183-23/+99
| | | | | | - Add pass_filenames: false to fmt hook - Add -- separator for cargo fmt args - Manually format code with cargo fmt
* fix(java): handle build metadata and underscore formats in version parsingHsiangNianian2026-01-181-2/+21
| | | | | | | | | | | | Update parse_java_version() to properly handle: - Build metadata (strip '+' and everything after) - Trailing garbage (strip '-' and everything after, e.g. -Ubuntu) - Underscore version separators (1.8.0_411 -> 1.8.0.411) This ensures Java versions are correctly parsed on all platforms: - Old format: 1.8.0_411 (Java 8 update 411) - New format: 21.0.3+13-Ubuntu (Java 21 with build metadata) - Short format: 17.0.1 (Java 17 update 1).
* fix(manifest): add find_root_version for nested inheritance resolutionHsiangNianian2026-01-181-0/+37
| | | | | | | | | | | | Add find_root_version() function to walk the inheritance chain and find the root vanilla Minecraft version from a modded version (Fabric/Forge). This is useful for determining which vanilla version's client.jar should be used when launching modded versions, as modded versions inherit from vanilla versions but don't contain their own client.jar. The function follows the inheritsFrom field recursively until reaching a version without a parent (the root vanilla version).
* fix(rules): add architecture and version checks to library rule matchingHsiangNianian2026-01-181-5/+24
| | | | | | | | | | Complete the rule_matches function to properly evaluate: - OS name (already working: osx/macos, linux, windows) - Architecture (arch field): match against env::consts::ARCH - OS version (version field): accept all versions for now (conservative) This ensures that architecture-specific libraries (e.g. natives-arm64) are correctly filtered based on the current platform.
* fix(downloader): use proper atomic ordering for thread-safe progress trackingHsiangNianian2026-01-181-11/+11
| | | | | | | | | | Replace Ordering::Relaxed with appropriate synchronization: - Ordering::AcqRel for fetch_add operations that modify shared state - Ordering::Acquire for loads that depend on other thread's writes - Ordering::Release for stores that other threads may read This ensures visibility of downloaded bytes and completed files across concurrent download tasks without data races.
* fix(auth): add token expiry check in start_gameHsiangNianian2026-01-181-1/+0
| | | | | | | | | Check if the Microsoft account token is expired before attempting to launch the game. If expired, attempt to refresh using the refresh_token. If refresh fails, return an error instructing the user to login again. Also removed #[allow(dead_code)] from is_token_expired since it's now actively used.
* fix(instance): copy directory BEFORE creating metadata in duplicate_instanceHsiangNianian2026-01-181-11/+32
| | | | | | | | Prevent race condition in duplicate_instance by copying the source game directory BEFORE creating and saving the new instance metadata. This ensures that if the copy fails, no orphaned metadata is created. Also copy the icon_path from source instance to maintain visual consistency.
* fix(auth): prevent infinite recursion in get_client()HsiangNianian2026-01-181-2/+2
| | | | | | | | | | The fallback in the reqwest client builder was calling get_client() recursively, which would cause a stack overflow if Client::builder() failed. Now uses reqwest::Client::new() as the fallback. Also fixed User-Agent to be platform-agnostic. Reviewed-by: Claude Opus 4.5
* feat: implement instance management features and enhance game launch processHsiangNianian2026-01-162-0/+326
| | | | Added functionality for managing game instances, including creating, deleting, updating, and duplicating instances. Integrated instance selection into the game launch process, allowing users to specify the instance when starting a game. Updated the main application logic to handle instance states and paths, ensuring proper directory management for each instance. Introduced a new module for instance management and updated relevant commands to support instance-specific operations.
* feat: enhance Java version management for Minecraft versionsHsiangNianian2026-01-163-31/+150
| | | | Added functionality to determine and validate the required Java version for Minecraft versions, including checks for compatibility with older versions. Implemented event emissions for version installation and deletion, and updated the UI to reflect Java version requirements and installation status. Improved version metadata handling and added support for deleting versions.
* feat: enhance Java path handling by resolving symlinks and stripping UNC ↵HsiangNianian2026-01-161-2/+8
| | | | | | prefixes Updated the Java installation and executable retrieval functions to resolve symlinks and strip UNC prefixes from paths. This improvement ensures cleaner and more reliable path handling on Windows systems, enhancing compatibility and usability.
* feat: add UNC prefix stripping for Windows paths in Java handlingHsiangNianian2026-01-161-1/+17
| | | | Implemented a helper function to strip the UNC prefix from file paths on Windows, ensuring cleaner path handling. Updated the Java candidate retrieval process to resolve symlinks and apply the new prefix stripping function, enhancing compatibility and usability on Windows systems.
* feat: improve Java command execution on WindowsHsiangNianian2026-01-162-10/+24
| | | | Enhanced the Java command execution by adding support for Windows-specific creation flags in both the installer and candidate checking functions. This change ensures better compatibility and performance when running Java commands on Windows systems.
* feat: integrate AI assistant functionality and configuration managementHsiangNianian2026-01-1612-78/+855
| | | | Implemented new commands for managing the AI assistant, including health checks, chat interactions, and model listings for both Ollama and OpenAI. Enhanced the configuration system to support raw JSON editing and added a dedicated AssistantConfig structure for better management of assistant settings. This update significantly improves the user experience by providing comprehensive control over AI interactions and configurations.
* feat: Enhance Forge installation process by fetching installer manifest and ↵HsiangNianian2026-01-151-57/+245
| | | | improving library management for better compatibility
* feat: Add version installation and check functionality to enhance mod loader ↵HsiangNianian2026-01-151-3/+24
| | | | support in the application
* feat: Add log upload service and optional API key to LauncherConfig for ↵HsiangNianian2026-01-151-0/+4
| | | | enhanced logging capabilities