Improve XML escaping, WebSocket buffer, and editor style

Replaced HTML encoding with SecurityElement.Escape for XML escaping in ChromiumDevTools. Made WebSocketManager's receive buffer size configurable with a default of 65536 bytes. Updated editor.html to use 'color: inherit' for banner link hover to maintain contrast.
This commit is contained in:
Namhyeon Go 2025-07-31 17:23:11 +09:00
parent 837ab036a8
commit 92a35606ed
3 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.WebSockets; using System.Net.WebSockets;
using System.Security;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -128,7 +129,7 @@ namespace WelsonJS.Launcher.ResourceTools
private string EscapeXml(string text) private string EscapeXml(string text)
{ {
return WebUtility.HtmlEncode(text); return SecurityElement.Escape(text);
} }
} }
} }

View File

@ -103,7 +103,7 @@ namespace WelsonJS.Launcher
} }
} }
public async Task<string> SendAndReceiveAsync(string host, int port, string path, string message, int timeoutSeconds) public async Task<string> SendAndReceiveAsync(string host, int port, string path, string message, int timeoutSeconds, int bufferSize = 65536)
{ {
var buffer = Encoding.UTF8.GetBytes(message); var buffer = Encoding.UTF8.GetBytes(message);
CancellationTokenSource cts = timeoutSeconds > 0 CancellationTokenSource cts = timeoutSeconds > 0
@ -115,7 +115,7 @@ namespace WelsonJS.Launcher
ClientWebSocket ws = await GetOrCreateAsync(host, port, path); ClientWebSocket ws = await GetOrCreateAsync(host, port, path);
byte[] recvBuffer = new byte[4096]; byte[] recvBuffer = new byte[bufferSize];
WebSocketReceiveResult result = await ws.ReceiveAsync(new ArraySegment<byte>(recvBuffer), cts.Token); WebSocketReceiveResult result = await ws.ReceiveAsync(new ArraySegment<byte>(recvBuffer), cts.Token);
return Encoding.UTF8.GetString(recvBuffer, 0, result.Count); return Encoding.UTF8.GetString(recvBuffer, 0, result.Count);
} }

View File

@ -47,7 +47,7 @@
.banner a:hover { .banner a:hover {
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
color: #000; color: inherit; /* keeps contrast consistent */
} }
</style> </style>
</head> </head>