Wire plugin file install command

This commit is contained in:
2026-05-08 21:20:29 -04:00
parent 527762fd36
commit d769b45f54
6 changed files with 113 additions and 20 deletions
@@ -202,6 +202,10 @@ pub(crate) fn plugins_url() -> Result<UrlText, CoreError> {
internal_page_url("ely://plugins")
}
pub(crate) fn plugin_settings_url() -> Result<UrlText, CoreError> {
internal_page_url("ely://settings/plugins")
}
pub(crate) fn plugin_detail_url(plugin_id: &PluginId) -> Result<UrlText, CoreError> {
let route = format!("ely://plugin/{}", plugin_id.as_str());
internal_page_url(&route)
+11 -4
View File
@@ -9,10 +9,10 @@ use crate::{
navigation::{
about_url, archive_idle_days, archive_url, bookmarks_url, downloads_url, history_url,
move_tab_space_name, new_private_profile_name, new_profile_name, new_space_name, note_body,
notes_url, plugin_detail_url, plugins_url, reading_list_url, reading_progress_percent,
rename_tab_group_name, search_url, settings_page_url, settings_url, shortcut_settings_url,
space_icon, split_group_name, switch_profile_name, sync_status_url, tab_group_color_hex,
tab_group_name, tab_note_body, task_manager_url,
notes_url, plugin_detail_url, plugin_settings_url, plugins_url, reading_list_url,
reading_progress_percent, rename_tab_group_name, search_url, settings_page_url,
settings_url, shortcut_settings_url, space_icon, split_group_name, switch_profile_name,
sync_status_url, tab_group_color_hex, tab_group_name, tab_note_body, task_manager_url,
},
};
@@ -271,6 +271,13 @@ impl BrowserCore {
self.open_tab(plugins_url()?);
Ok(true)
}
"install-plugin-from-file"
| "install plugin from file"
| "install-plugin"
| "install plugin" => {
self.open_tab(plugin_settings_url()?);
Ok(true)
}
"site-settings" | "open-site-settings" | "open site settings" => {
let Some(url) = self.active_tab_site_settings_url()? else {
return Ok(false);
+15
View File
@@ -3,6 +3,21 @@ use std::{error::Error, io};
use ely_browser_core::{BrowserCore, CoreError, InitialBrowserConfig, PluginAuditAction};
use ely_domain::{CommandIntent, CommandScope, PluginId, PluginManifest};
#[test]
fn install_plugin_from_file_command_opens_plugin_settings_page() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
core.set_command_query(">install-plugin-from-file");
let intent = core.submit_command()?;
let active_tab = core.active_tab()?;
assert_eq!(intent, Some(CommandIntent::Command("install-plugin-from-file".to_string())));
assert_eq!(active_tab.title(), "Plugin Settings");
assert_eq!(active_tab.url().as_str(), "ely://settings/plugins");
assert_eq!(core.snapshot()?.command_query, "");
Ok(())
}
#[test]
fn installs_standard_plugin_and_records_audit_event() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;