Remove the special cases for the old Browser package

A browser request now needs the session token of its window. Disabling
an old runestone.browser package no longer stops the engine. One list of
built-in modules starts the browser and the theme editor, and the plugin
menus skip their tools. The access rules no longer treat the browser ID
in a special way.
This commit is contained in:
Knotty Wyvern
2026-10-29 00:48:37 -07:00
parent 5dc53e4a5e
commit 48b8249ba6
13 changed files with 55 additions and 52 deletions
+5 -10
View File
@@ -13,7 +13,6 @@ use tauri::{AppHandle, Emitter, Manager, State};
use crate::error::{Error, Result};
const PLUGIN: &str = "runestone.browser";
const COMMANDS: &[&str] = &[
"state",
"newTab",
@@ -571,16 +570,12 @@ pub async fn browser_request(
session: Option<String>,
) -> Result<Value> {
let owner = window.label().to_string();
// The plugin lease check can wait for the plugin lock, so it also runs on the blocking worker.
// A request can wait for the engine to start or to answer, so it runs on the blocking worker.
tauri::async_runtime::spawn_blocking(move || {
if let Some(token) = session {
app.state::<BrowserState>().require_session(&owner, &token)?;
} else {
app.state::<crate::plugins::PluginState>()
.require_lease(&app, &owner, PLUGIN)?;
}
app.state::<BrowserState>()
.request(&app, &owner, &command, args)
let state = app.state::<BrowserState>();
// Only the built-in browser gets a session from `browser_connect`. A request without one fails.
state.require_session(&owner, session.as_deref().unwrap_or_default())?;
state.request(&app, &owner, &command, args)
})
.await?
}
-6
View File
@@ -1365,13 +1365,7 @@ pub async fn plugins_set_enabled(
enabled: bool,
hash: Option<String>,
) -> Result<()> {
let stop_browser = id == "runestone.browser" && !enabled;
PluginState::run(&app, move |service| service.set_enabled(&id, enabled, hash.as_deref())).await?;
if stop_browser {
// Stopping the browser engine waits for its reply.
let browser_app = app.clone();
tauri::async_runtime::spawn_blocking(move || browser_app.state::<crate::browser::BrowserState>().close_all()).await?;
}
changed(&app);
Ok(())
}