feat: Implement backend commands for plugin data management and enhance frontend synchronization with updated plugin interfaces
This commit is contained in:
1 parent
78f22f65f4
commit
83be780243
35 files changed
+5261
-2208
No files matched your search
@@ -0,0 +1,57 @@
|
||||
# Server Platform Compatibility in PlugSnatcher
|
||||
|
||||
## Overview
|
||||
|
||||
PlugSnatcher now has enhanced platform compatibility checking to ensure that plugins you download and update are compatible with your specific server type. This feature prevents potential issues like downloading a NeoForge version of a plugin for a Paper server or vice versa.
|
||||
|
||||
## Supported Server Types
|
||||
|
||||
PlugSnatcher automatically detects and supports the following server types:
|
||||
|
||||
- **Paper** - Can use plugins built for Paper, Spigot, and Bukkit
|
||||
- **Spigot** - Can use plugins built for Spigot and Bukkit
|
||||
- **Bukkit** - Can use plugins built for Bukkit only
|
||||
- **Forge** - Can use plugins built for Forge
|
||||
- **Fabric** - Can use plugins built for Fabric
|
||||
- **Velocity** - Can use plugins built for Velocity
|
||||
- **BungeeCord** - Can use plugins built for BungeeCord
|
||||
- **Waterfall** - Can use plugins built for Waterfall and BungeeCord
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Server Type Detection**: When you scan a server directory, PlugSnatcher automatically determines the server type based on file patterns and configuration files.
|
||||
|
||||
2. **Platform-Aware Updates**: When checking for updates, PlugSnatcher filters plugin versions based on your server type. For example, if you're running a Paper server, PlugSnatcher will prioritize Paper/Spigot/Bukkit versions and avoid Forge/Fabric versions.
|
||||
|
||||
3. **Compatible Version Selection**: When multiple versions of a plugin are available (e.g., Paper, Forge, and Fabric versions), PlugSnatcher automatically selects the one compatible with your server.
|
||||
|
||||
4. **Warning System**: If no compatible version is found, PlugSnatcher will warn you before allowing you to proceed with an update that might not work on your server.
|
||||
|
||||
## Examples
|
||||
|
||||
- **Plugin with multiple versions**: For plugins like LuckPerms that have versions for various platforms (Paper, Forge, NeoForge, Fabric), PlugSnatcher will automatically select the version that matches your server type.
|
||||
|
||||
- **Universal plugins**: Some plugins work across multiple platforms without specific builds. In these cases, PlugSnatcher will consider them compatible with all server types.
|
||||
|
||||
## Technical Details
|
||||
|
||||
This feature primarily affects plugins downloaded from repositories that provide platform information, such as:
|
||||
|
||||
- **Modrinth**: Provides detailed platform compatibility information through "loaders" metadata
|
||||
- **Hangar**: Includes platform tags for each plugin version
|
||||
- **GitHub**: May or may not include platform information depending on the repository structure
|
||||
|
||||
For repositories without explicit platform tagging (like SpigotMC), PlugSnatcher will use the general repository focus (e.g., SpigotMC is for Bukkit/Spigot/Paper servers) to determine compatibility.
|
||||
|
||||
## Current Limitations
|
||||
|
||||
- Some repositories don't provide structured platform compatibility information
|
||||
- Plugin naming conventions aren't always consistent, making it difficult to determine platform compatibility from filenames alone
|
||||
- Some custom/niche server types may not be properly detected or matched
|
||||
|
||||
## Future Improvements
|
||||
|
||||
- Allow manual override of detected server type
|
||||
- Add compatibility visualization in the UI
|
||||
- Improve detection of platform from plugin filename patterns
|
||||
- Support for more server types and platforms
|
||||
@@ -0,0 +1,38 @@
|
||||
# Frontend/Backend Synchronization Checklist
|
||||
|
||||
This checklist tracks the necessary changes to ensure `src/App.tsx` works correctly with the refactored Rust backend.
|
||||
|
||||
## Backend Changes (`src-tauri/`)
|
||||
|
||||
- [ ] **Create `load_plugin_data` Command:**
|
||||
- Implement a command `load_plugin_data(app_handle: AppHandle, server_path: String) -> Result<Vec<Plugin>, String>`.
|
||||
- Use `get_plugin_data_path` from `scanner.rs` to find the correct `plugins.json`.
|
||||
- Read and deserialize `plugins.json`.
|
||||
- Return `Ok(plugins)` or an appropriate `Err(String)`.
|
||||
- Register the command in `lib.rs`.
|
||||
- [ ] **Create `save_plugin_data` Command:**
|
||||
- Implement a command `save_plugin_data(app_handle: AppHandle, plugins: Vec<Plugin>, server_path: String) -> Result<(), String>`.
|
||||
- Use `get_plugin_data_path` from `scanner.rs`.
|
||||
- Serialize the `plugins` vector to JSON.
|
||||
- Write the JSON to `plugins.json`, creating the directory if needed.
|
||||
- Return `Ok(())` or an appropriate `Err(String)`.
|
||||
- Register the command in `lib.rs`.
|
||||
- [ ] **Align Bulk Update Events/Logic:**
|
||||
- In `update_checker.rs` (`check_for_plugin_updates`), rename the emitted event from `"update_check_started"` to `"bulk_update_start"`.
|
||||
- In `update_checker.rs` (`check_for_plugin_updates`), remove the `app_handle.emit("update_check_completed", ())` call. The result should be handled via the command's return value.
|
||||
|
||||
## Frontend Changes (`src/App.tsx`)
|
||||
|
||||
- [ ] **Align `Plugin` Interface Nullability:**
|
||||
- Ensure `depend`, `soft_depend`, and `load_before` fields consistently use `string[] | null`.
|
||||
- [ ] **Rename Command Invokes:**
|
||||
- Change `invoke("check_single_plugin_update", ...)` to `invoke("check_single_plugin_update_command", ...)`.
|
||||
- Change `invoke("set_plugin_repository_source", ...)` to `invoke("set_plugin_repository", ...)`.
|
||||
- [ ] **Refactor `checkForUpdates` Result Handling:**
|
||||
- Modify the `checkForUpdates` async function to `await` the `invoke("check_plugin_updates", ...)` call.
|
||||
- Use a `try...catch` block or `.then().catch()` to handle the `Result<Vec<Plugin>, String>`.
|
||||
- On success (`Ok(updatedPlugins)`), call `setPlugins(updatedPlugins)` and clear errors/loading states.
|
||||
- On error (`Err(error)`), call `setUpdateError(error)` and clear loading states.
|
||||
- [ ] **Adjust/Remove Event Listeners:**
|
||||
- In `useEffect`, rename the listener for `"update_check_started"` to `"bulk_update_start"`.
|
||||
- In `useEffect`, remove the listeners for `"bulk_update_complete"` and `"bulk_update_error"`.
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user