RynthCore/Changelog/2026-11-07-web-panel.md

3.1 KiB

In-game web panel: plugin API v94

Branch pr/web-panel, from upstream main c68204f (release 2026.11.8.1). Not deployed. The API number 94 follows upstream's v93 (GetMonsterHealth) and is provisional (unmerged upstream branches also use 94; whichever merges second renumbers). CoreCLR engine only.

What changed

  • Four new function slots at the end of the plugin API table (WebPanelOpenFn, WebPanelNavigateFn, WebPanelCloseFn, WebPanelGetStateFn), and SDK wrappers on RynthCoreHost: HasWebPanel, OpenWebPanel(WebPanelOptions), NavigateWebPanel, CloseWebPanel, GetWebPanelState. Types are in RynthCore.PluginSdk/WebPanelTypes.cs. No call blocks its caller.
  • WebPanel/WebPanelHost.cs (engine): one WebView2 panel over the game window, on its own STA thread, with an unowned popup window, a caption bar with a close box, a remembered size and place, and Escape / Alt+F4 / X to close.
  • Navigation allowlist (WebPanelUrlPolicy): https only, default port, no user info, exact host or *.suffix (*.x.com does not match x.com: list both). Off-list navigations, pop-ups and custom-scheme launches never load in the panel; an absolute http(s) URL goes to the system browser, anything else is dropped.
  • Per-world, per-key WebView2 profile (WebPanelProfile): the plugin's key is lower-cased and hashed, and the world is added.
  • /rc webpanel [status|close]: a redacted one-line report, and a close.
  • engine.json "WebPanel": false: kill switch. OpenWebPanel then answers Unavailable.
  • RynthCore.PluginSdk.targets already raised a shared-SDK release build's RynthPluginMinEngineApi below 88 to the SDK's API; that is now 94 for every such plugin. Plugins that must run on older cores declare 88 or higher.
  • tools\WebPanelHarness: an offline 32-bit harness for the host (see the doc).
  • Docs: docs/WEB_PANEL.md is the plugin contract.

How it behaves

  • The panel is designed never to take focus from another program; confirm in game. It takes the foreground (and page focus) only if the foreground window already belongs to the game, and it hides while another program is in front.
  • Logs and chat never carry a URL's query, fragment or user info (the launch code rides in the query).
  • Failures: the panel fails only when the WebView2 browser process or the main renderer exits, or the renderer is reported unresponsive 3 times in 30 s. Other process failures are logged. RuntimeMissing / CreateFailed fall back to the system browser when the plugin asked for it (the default). Page permission ClipboardRead is allowed only for allowlisted origins; the rest are denied.
  • The NativeAOT engine flavour has no web panel: the slots stay zero and HasWebPanel is false.

Tests

tools/WebPanelTests: URL allowlist and redaction, window visibility and layout, profile folder, the ABI glue. tools/WebPanelHarness: the host in a collectible load context against real WebView2 (needs a desktop, the WebView2 runtime and the x86 .NET 10 runtime; not part of Run-AllTests.ps1). Checks that need another program in the foreground report UNVERIFIED and are owner in-game checks.

Not yet tested in game.