mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-10 05:36:04 +00:00
Update editor.html, ResourceServer.cs
This commit is contained in:
parent
1f859c75c6
commit
e2c9169121
|
@ -9,7 +9,6 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace WelsonJS.Launcher
|
namespace WelsonJS.Launcher
|
||||||
|
@ -106,7 +105,7 @@ namespace WelsonJS.Launcher
|
||||||
const string devtoolsPrefix = "devtools/";
|
const string devtoolsPrefix = "devtools/";
|
||||||
if (path.StartsWith(devtoolsPrefix, StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith(devtoolsPrefix, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
ServeDevTools(context, path.Substring(devtoolsPrefix.Length - 1));
|
ServeDevTools(context, path.Substring(devtoolsPrefix.Length - 1)).GetAwaiter().GetResult(); ;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +113,7 @@ namespace WelsonJS.Launcher
|
||||||
const string whoisPrefix = "whois/";
|
const string whoisPrefix = "whois/";
|
||||||
if (path.StartsWith(whoisPrefix, StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith(whoisPrefix, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
ServeWhoisRequest(context, path.Substring(whoisPrefix.Length)).Wait();
|
ServeWhoisRequest(context, path.Substring(whoisPrefix.Length)).GetAwaiter().GetResult();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,14 +156,14 @@ namespace WelsonJS.Launcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ServeDevTools(HttpListenerContext context, string endpoint)
|
private async Task ServeDevTools(HttpListenerContext context, string endpoint)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (HttpClient client = new HttpClient())
|
using (HttpClient client = new HttpClient())
|
||||||
{
|
{
|
||||||
string url = "http://localhost:9222" + endpoint;
|
string url = "http://localhost:9222" + endpoint;
|
||||||
string data = client.GetStringAsync(url).GetAwaiter().GetResult();
|
string data = await client.GetStringAsync(url);
|
||||||
|
|
||||||
ServeResource(context, data, "application/json");
|
ServeResource(context, data, "application/json");
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,6 +338,7 @@
|
||||||
|
|
||||||
if (response.id == 3) {
|
if (response.id == 3) {
|
||||||
appendTextToEditor(response.result.result.value);
|
appendTextToEditor(response.result.result.value);
|
||||||
|
socket.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user