Terminal file viewer/editor + per-window app-command lockdown (#60)
Build App / compute-version (push) Successful in 7s
Secret Scan / scan (push) Successful in 8s
Build App / build-macos (push) Successful in 2m53s
Build App / build-linux (push) Successful in 5m12s
Build App / build-windows (push) Successful in 5m15s
Build App / create-tag (push) Successful in 3s
Build App / sync-to-github (push) Successful in 1m5s
Build App / compute-version (push) Successful in 7s
Secret Scan / scan (push) Successful in 8s
Build App / build-macos (push) Successful in 2m53s
Build App / build-linux (push) Successful in 5m12s
Build App / build-windows (push) Successful in 5m15s
Build App / create-tag (push) Successful in 3s
Build App / sync-to-github (push) Successful in 1m5s
Clicking a file path in Claude's terminal output now opens the file in its own window with a CodeMirror 6 editor. The editor highlights the target line, live-reloads while the file changes, and saves explicitly with hash-based conflict detection. The viewer commands are gated by window label. Every app command is now ACL-gated per window through a Tauri AppManifest. build.rs checks the handler list against the capability files and fails the build on any mismatch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #60.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//! The viewer window itself. Mirrors `browser_view/popout.rs`, with two differences:
|
||||
//! the URL is the app's own second entry (`WebviewUrl::App`), so the capability in
|
||||
//! `capabilities/file-viewer.json` applies; and the registry entry is removed on
|
||||
//! `Destroyed`, which fires for both the X button (after JS calls `destroy()`) and a
|
||||
//! Rust-side `destroy()`.
|
||||
|
||||
use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindowBuilder, WindowEvent};
|
||||
|
||||
use super::registry::ViewerRegistry;
|
||||
|
||||
pub fn open_viewer_window(app: &AppHandle, label: &str, title: &str) -> Result<(), String> {
|
||||
let window = WebviewWindowBuilder::new(app, label, WebviewUrl::App("viewer.html".into()))
|
||||
.title(title)
|
||||
.inner_size(900.0, 700.0)
|
||||
.min_inner_size(480.0, 320.0)
|
||||
.build()
|
||||
.map_err(|e| format!("Could not open the file window: {}", e))?;
|
||||
|
||||
let app_for_event = app.clone();
|
||||
let label_owned = label.to_string();
|
||||
window.on_window_event(move |event| {
|
||||
if let WindowEvent::Destroyed = event {
|
||||
app_for_event.state::<ViewerRegistry>().remove(&label_owned);
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user