diff --git a/src/RynthCore.Engine/Compatibility/ChatCommandReplies.cs b/src/RynthCore.Engine/Compatibility/ChatCommandReplies.cs
index 2a0e746..4e44f2c 100644
--- a/src/RynthCore.Engine/Compatibility/ChatCommandReplies.cs
+++ b/src/RynthCore.Engine/Compatibility/ChatCommandReplies.cs
@@ -200,6 +200,7 @@ internal static class ChatCommandReplies
V("vitals", "Usage: /rc vitals (the old vitals HUD is gone: /rv plates self)", NoArgs, "hud"),
V("layout", "Usage: /rc layout [status] | default | reset [confirm]", LayoutArgs),
V("uicost", UiCostUsage, null),
+ V("webpanel", "Usage: /rc webpanel [status|close] (status is a redacted one-line report; it never opens a URL)", Words("", "status", "close")),
};
/// /rc uicost: the UI frame cost breakdown (ImGui/UiCost.cs).
diff --git a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
index 3330ce1..f174872 100644
--- a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
+++ b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs
@@ -651,6 +651,13 @@ internal static class RynthCoreChatCommands
return;
}
// /rc layout [status] | default | reset [confirm]: this client's panel layout (UI/PanelLayout).
+ // /rc webpanel [status|close]: diagnostics for the in-game web panel. It never opens a URL
+ // (an arbitrary-URL command would be a phishing vector); every URL in the line is redacted.
+ if (IsVerb(sub, "webpanel", out string webPanelArgs))
+ {
+ HandleWebPanelCommand(webPanelArgs);
+ return;
+ }
if (IsVerb(sub, "layout", out string layoutArgs))
{
HandleLayoutCommand(layoutArgs);
@@ -1722,6 +1729,24 @@ internal static class RynthCoreChatCommands
/// reset asks, reset confirm copies the default over this character's. Those two answer when their
/// files are written (from the UI writer), or at once with why they can't run.
///
+ ///
+ /// /rc webpanel [status|close]. Status: one redacted line (WebPanelApi.Describe plus the address
+ /// space). Close: closes the live panel (WebPanelApi.Close does not block). Nothing here opens a URL.
+ ///
+ private static void HandleWebPanelCommand(string args)
+ {
+ string a = args.Trim().ToLowerInvariant();
+ if (a == "close")
+ {
+ int handle = WebPanel.WebPanelApi.LiveHandle;
+ if (handle <= 0) { Reply("web panel: nothing to close."); return; }
+ int rc = WebPanel.WebPanelApi.Close(handle);
+ Reply($"web panel: close requested (handle {handle}, code {rc}).");
+ return;
+ }
+ Reply(WebPanel.WebPanelApi.Describe() + "; address space " + AddressSpace.Describe());
+ }
+
private static void HandleLayoutCommand(string args)
{
UI.LayoutCommand cmd = UI.PanelLayoutPolicy.ParseCommand(args);
diff --git a/src/RynthCore.Engine/WebPanel/WebPanelHost.cs b/src/RynthCore.Engine/WebPanel/WebPanelHost.cs
index aec7a07..c636896 100644
--- a/src/RynthCore.Engine/WebPanel/WebPanelHost.cs
+++ b/src/RynthCore.Engine/WebPanel/WebPanelHost.cs
@@ -222,7 +222,7 @@ internal sealed unsafe class WebPanelHost
string thread = _thread == null ? "not started" : _threadDone ? "stopped" : "running";
string status = ((WebPanelStatusCode)_status).ToString();
return $"web panel: thread {thread}{(_shuttingDown ? " (shut down)" : "")}, handle {_live}, {status}, error {_error}, " +
- $"http {_http}, navigations {_navCount}, environments {_environmentCount}, flags {_flags}, browser pid {_browserPid}, url {WebPanelUrlPolicy.Redact(_liveUrl)}";
+ $"http {_http}, navigations {_navCount}, environments {_environmentCount}, visible {((_flags & StateVisible) != 0 ? "yes" : "no")}, focused {((_flags & StateFocused) != 0 ? "yes" : "no")}, in browser {((_flags & StateOpenedInBrowser) != 0 ? "yes" : "no")}, browser pid {_browserPid}, url {WebPanelUrlPolicy.Redact(_liveUrl)}";
}
}
@@ -266,9 +266,9 @@ internal sealed unsafe class WebPanelHost
internal bool ThreadRunningForTests { get { lock (_sync) return _thread != null && !_threadDone && _thread.IsAlive; } }
internal bool PostForTests(Action a) => Post(() => a(_web));
internal bool PanelOpenForTests => _open;
- /// A failure arriving late for (the harness passes a superseded one).
/// A renderer-unresponsive report, as WebView2 would raise it (counting against UnresponsiveLimit).
internal bool UnresponsiveForTests() => Post(() => HandleProcessFailed(CoreWebView2ProcessFailedKind.RenderProcessUnresponsive));
+ /// A failure arriving late for (the harness passes a superseded one).
internal bool FailForTests(int handle) => Post(() => Fail(handle, WebPanelCode.ProcessFailed, "synthetic (harness)", allowFallback: false));
// ============================ panel thread ============================
diff --git a/tools/ChatCommandReplyTests/Program.cs b/tools/ChatCommandReplyTests/Program.cs
index d2efaca..e82fc1f 100644
--- a/tools/ChatCommandReplyTests/Program.cs
+++ b/tools/ChatCommandReplyTests/Program.cs
@@ -115,6 +115,9 @@ internal static class Program
("layout", "layout", "layout frob"),
("layout", "layout reset confirm", "layout reset now"),
("layout", "layout default", "layout default now"),
+ ("webpanel", "webpanel status", "webpanel open"),
+ ("webpanel", "webpanel", "webpanel frob"),
+ ("webpanel", "webpanel close", "webpanel close now"),
};
private static void EveryVerbValidAndInvalid()