ServerPack: use the engine's web panel when it has one
OpenWeb now opens the page in RynthCore's in-game web panel (plugin API v93) and falls back to the system browser only when the panel refused before navigating. A handle from OpenWebPanel only means queued, so the open is answered from OnTick (PollWeb), which reads GetWebPanelState until it decides: Loading/Ready opened; Failed+OpenedInBrowser the engine opened the browser (do nothing more); Failed+ProcessFailed spent; Failed+RuntimeMissing or CreateFailed with no browser and no navigation falls back. A 20 s poll timeout answers NoAnswer (neutral, no fallback). done fires exactly once. ServerWebPanel.cs is pure (an int/string engine seam), so the mappings and the once-only answer are tested with a fake engine. Every SDK web-panel name sits in four NoInlining helpers in ServerPackWeb.cs, each called inside catch (MissingMethodException) and catch (TypeLoadException); a source scan pins that, the poll's place in OnTick, and the absence of locks. CloseWeb closes only the handle this plugin opened. Builds only against a RynthCore SDK with the web panel (0ef12d7); against 418d80b the helpers do not compile (8 errors, all in ServerPackWeb.cs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b72720aca4
commit
0ba3b5909e
8 changed files with 733 additions and 22 deletions
|
|
@ -19,7 +19,13 @@ internal sealed record WebOpenRequest(string Url, IReadOnlyList<string> AllowedH
|
|||
internal enum WebOpenRoute { Panel, Browser, Refused }
|
||||
|
||||
/// <summary>What the engine's panel did. Only a refusal before navigating may fall back to the browser.</summary>
|
||||
internal enum PanelResult { Opened, RefusedBeforeNavigate, UrlNotAllowed, FailedAfterNavigate }
|
||||
/// <remarks>
|
||||
/// OpenedInBrowserByEngine: the engine's own fallback opened the system browser (do nothing more).
|
||||
/// BadArgs and UrlNotAllowed: plugin bugs, never sent to the browser. Pending: the engine queued the
|
||||
/// open and the tick polls its state (ServerWebPanel). Closed: closed or replaced before it loaded.
|
||||
/// NoAnswer: the state never settled before the poll timeout (or could not be read); neutral, no fallback.
|
||||
/// </remarks>
|
||||
internal enum PanelResult { Opened, RefusedBeforeNavigate, UrlNotAllowed, FailedAfterNavigate, OpenedInBrowserByEngine, BadArgs, Pending, Closed, NoAnswer }
|
||||
|
||||
/// <summary>What happened. The message never contains the URL.</summary>
|
||||
internal sealed record WebOpenOutcome(WebOpenRoute Route, bool Ok, string Message);
|
||||
|
|
|
|||
Loading…
Reference in a new issue