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:
@@ -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?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user