WebPanel final-review fix: truthful browser fallback, focus gate, docs
- Creation-failure fallback sets OpenedInBrowser and says "opened" only when the system browser actually opened; otherwise chat says the browser did not open. Harness check CreateFailureBrowserFails. - FocusPage follows the same in-process foreground rule as SetForegroundWindow (Show and controller creation). Harness check NoFocusFromAnotherProcess; posted-key checks report UNVERIFIED when another process holds the foreground. - PermissionRequested: SavesInProfile = false. - WEB_PANEL.md: allowlist empty-entry rule, GetState -4, AOT renumber caveat, softened focus claim (also in the Changelog). - Formatting: ChatCommandReplyTests brace, /rc layout comment, PluginContract blank line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f75a9711a
commit
537a40a430
7 changed files with 116 additions and 21 deletions
|
|
@ -5,7 +5,9 @@ The engine owns the window, the navigation allowlist, focus and the lifetime; th
|
|||
an allowlist and a profile key, then polls for state. This file is the contract plugin authors build against.
|
||||
|
||||
The API number 93 is provisional: upstream may take 93 first, in which case it renumbers on merge
|
||||
(`PluginContractVersion.cs`). Write `HasWebPanel` checks, not `Version >= 93` checks, and nothing breaks.
|
||||
(`PluginContractVersion.cs`). Write `HasWebPanel` checks, not `Version >= 93` checks. That keeps a plugin working
|
||||
across a renumber only for shared-SDK release builds. A NativeAOT plugin build compiles the `Version >= 93` test
|
||||
in, so a plugin built against the provisional SDK must not be distributed, and must be rebuilt after a renumber.
|
||||
|
||||
## Calls
|
||||
|
||||
|
|
@ -93,7 +95,9 @@ starts itself, and on pop-up requests. Entries are matched against the URL's hos
|
|||
- `*.suffix`: any subdomain, at any depth, but not the suffix itself. `*.example.com` matches `a.example.com`
|
||||
and `a.b.example.com`, and does **not** match `example.com`. To allow both, list both entries.
|
||||
- The suffix after `*.` must contain a dot, so `*.com` is rejected.
|
||||
- No scheme, path, port or other `*`. Entries are lower-cased and trimmed; blank lines are ignored.
|
||||
- No scheme, path, port or other `*`. Entries are lower-cased and trimmed. Through the SDK wrapper an empty entry
|
||||
(or one containing `\n`) is refused with `BadArgs`; at the native level, where the list is one `\n`-separated
|
||||
string, blank lines are ignored.
|
||||
- Entries are ASCII: letters, digits, `-` and `.`; each label 1 to 63 characters, not starting or ending with `-`;
|
||||
at most 253 characters per entry. Write an internationalised host in its punycode form (`xn--...`).
|
||||
- 1 to 16 entries, and the joined list must fit in 8192 bytes.
|
||||
|
|
@ -147,8 +151,9 @@ WebView2 environment is reused.
|
|||
- The panel's size and place are remembered as fractions of the game window in
|
||||
`<LocalAppData>\RynthCore\WebPanel\layout.json`, shared by all profiles. A valid stored layout wins over
|
||||
`WidthPercent` / `HeightPercent`.
|
||||
- **The panel never takes focus from another program.** On Open it takes the foreground only if the foreground
|
||||
window already belongs to the game's process; if the player is in another program (or mid alt-tab) it does not.
|
||||
- **The panel is designed never to take focus from another program; confirm in game.** On Open it takes the
|
||||
foreground, and moves keyboard focus into the page, only if the foreground window already belongs to the game's
|
||||
process; if the player is in another program (or mid alt-tab) it does neither.
|
||||
It hides while another program is in the foreground, and comes back when the game is. The panel's own
|
||||
WebView2 dialogs (alert, file picker) are meant not to count as another program: the engine treats the
|
||||
WebView2 browser process as its own. Whether those dialogs belong to that process is not yet confirmed in game.
|
||||
|
|
@ -172,8 +177,10 @@ At engine shutdown the panel is torn down after the plugins' own Shutdown, so a
|
|||
The state is `Failed`, with `Error` set, and the panel is hidden.
|
||||
|
||||
- `RuntimeMissing` / `CreateFailed`: the panel could not start. With `FallbackToBrowser`, and only if no navigation
|
||||
has happened yet and the URL is absolute `http` or `https`, the engine opens the URL in the system browser, sets
|
||||
`OpenedInBrowser`, and tells the player in chat. The plugin must not open it a second time.
|
||||
has happened yet and the URL is absolute `http` or `https`, the engine tries to open the URL in the system browser.
|
||||
Only if the browser opens does it set `OpenedInBrowser` and tell the player the page opened there; the plugin
|
||||
must not open it a second time. If the browser does not open, `OpenedInBrowser` stays clear and chat says
|
||||
`[RynthCore] The in-game browser could not start (<why>), and your web browser did not open.`
|
||||
- `ProcessFailed`: the engine fails the panel for only these causes: the WebView2 browser process exited
|
||||
(`BrowserProcessExited`), the page's main renderer exited (`RenderProcessExited`), or the renderer is reported
|
||||
unresponsive (`RenderProcessUnresponsive`) 3 times within 30 seconds of the first report (a completed
|
||||
|
|
@ -250,7 +257,8 @@ Test `Version >= 93` before reading them: an older engine's table is shorter.
|
|||
`WebPanelStateNative` (pack 4, 48 bytes): `uint Size`, `int Handle`, `int Status`, `uint Flags`, `int Error`,
|
||||
`int LastHttpStatus`, `uint NavigationCount`, `uint Reserved[5]`. The engine accepts `Size` of 28 or more and writes
|
||||
only the fields before `Reserved`. At the native level `WebPanelGetState` returns the status (a handle that is not the
|
||||
live panel reads 6) or a negative code (`-1` bad arguments, `-5` shutting down); the wrapper turns a negative into `None`.
|
||||
live panel reads 6) or a negative code (`-1` bad arguments, `-4` unavailable: an internal exception, or an engine
|
||||
build without the panel, `-5` shutting down); the wrapper turns a negative into `None`.
|
||||
|
||||
## /rc webpanel
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue