fix(plugins): install plugin packages from a .zip (#896)

Root cause: Install Plugin from Disk only opened a folder picker and the host could only copy folders, so a zipped plugin could not be installed. The picker now accepts a .zip or a package's plugin.toml, and the host's install_from_path unpacks a zip to a temporary folder and runs it through the existing install_from_dir validation. The package may sit at the archive root or in its only folder (archiver metadata such as __MACOSX is ignored). Archives with unsafe paths or symbolic links, more than 10,000 entries or over 1 GB unpacked are refused, and a zip without plugin.toml (e.g. an IntelliJ plugin) gets a clear error.

Fixes #892

Co-authored-by: florentvdry <[email protected]>
Цей коміт міститься в:
Florent Vтаflorentvdry authored and GitHub committed 2026-11-03 01:44:28 +08:00
1 джерело eb633f6ca6
коміт db5251efe6
12 files changed
+208 -21

No files matched your search

+2 -2
Переглянути файл
@@ -91,12 +91,12 @@ pub async fn plugin_set_enabled(state: State<'_, AppState>, id: String, enabled:
blocking(move || host.set_enabled(&id, enabled)).await
}
/// Installs the plugin package in `path` (a folder with `plugin.toml`).
/// Installs the plugin package at `path`: a folder, its `plugin.toml`, or a `.zip` of the folder.
#[tauri::command]
#[specta::specta]
pub async fn plugin_install_dir(state: State<'_, AppState>, path: PathBuf) -> IdeResult<PluginInfo> {
let host = state.plugins.clone();
blocking(move || host.install_from_dir(&path)).await
blocking(move || host.install_from_path(&path)).await
}
/// Plugin packages available locally for installation: `<resources>/plugins`