34 lines
2.4 KiB
Markdown
34 lines
2.4 KiB
Markdown
## Backend Changes (`src-tauri/`)
|
|
|
|
- [x] **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`.
|
|
- [x] **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`.
|
|
- [x] **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`)
|
|
|
|
- [x] **Align `Plugin` Interface Nullability:**
|
|
- Ensure `depend`, `soft_depend`, and `load_before` fields consistently use `string[] | null`.
|
|
- [x] **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", ...)`.
|
|
- [x] **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.
|
|
- [x] **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"`. |