mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-29 02:50:48 +00:00
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:
parent
837ab036a8
commit
92a35606ed
|
|
@ -8,6 +8,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.WebSockets;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -128,7 +129,7 @@ namespace WelsonJS.Launcher.ResourceTools
|
|||
|
||||
private string EscapeXml(string text)
|
||||
{
|
||||
return WebUtility.HtmlEncode(text);
|
||||
return SecurityElement.Escape(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
CancellationTokenSource cts = timeoutSeconds > 0
|
||||
|
|
@ -115,7 +115,7 @@ namespace WelsonJS.Launcher
|
|||
|
||||
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);
|
||||
return Encoding.UTF8.GetString(recvBuffer, 0, result.Count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
.banner a:hover {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
color: inherit; /* keeps contrast consistent */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user