mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-15 20:34:36 +00:00
## What this changes On the web build, `PdfCraftApp::open_url` now opens links with `window.open(url, "_blank", "noopener,noreferrer")` via `web-sys`, instead of `egui::OpenUrl::new_tab`. eframe opens new tabs without features, which gave the opened page a `window.opener` handle it could use to navigate the PdfCraft tab. Every app-level open goes through `open_url`: document links, button URI actions, `app.launchURL`, help links and the releases page. Desktop builds are unchanged. The web packaging now sends `Cross-Origin-Opener-Policy: same-origin`: `_headers`, `.htaccess`, and the nginx example in `packaging/web/README.md` (`HOSTING.md`), whose old "doesn't need COOP" note is rewritten. Fixes #5084 ## How you verified it `cargo fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean on `pdfcraft-ui-egui`, including the review fixes. Tests not run yet; CI runs them. `cargo check -p pdfcraft-ui-egui --target wasm32-unknown-unknown` passes too, with no warnings in `links.rs`. - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed - [ ] tests pass on the crates I changed ## Anything a reviewer should look at first - COOP `same-origin` has no effect inside an iframe, so the `postMessage` embedding bridge is unaffected. A page on another origin that opens PdfCraft with `window.open` does lose its window handle. Nothing in the repo does that. - Not covered: `dialogs/credits.rs` uses `ui.hyperlink_to` for fixed GitHub URLs, which on the web may open in the PdfCraft tab itself.
15 lines
368 B
Plaintext
15 lines
368 B
Plaintext
# Netlify / Cloudflare Pages header rules (see HOSTING.md). Other hosts: set the same headers.
|
|
/*
|
|
X-Content-Type-Options: nosniff
|
|
Cross-Origin-Opener-Policy: same-origin
|
|
|
|
/*.wasm
|
|
Content-Type: application/wasm
|
|
Cache-Control: public, max-age=31536000, immutable
|
|
|
|
/*.js
|
|
Cache-Control: public, max-age=31536000, immutable
|
|
|
|
/index.html
|
|
Cache-Control: no-cache
|