diff --git a/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.Designer.cs b/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.Designer.cs
index c4557b5..beb6af7 100644
--- a/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.Designer.cs
+++ b/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.Designer.cs
@@ -78,6 +78,15 @@ namespace WelsonJS.Launcher.Properties {
}
}
+ ///
+ /// https://catswords.blob.core.windows.net/welsonjs/과(와) 유사한 지역화된 문자열을 찾습니다.
+ ///
+ internal static string BlobServerPrefix {
+ get {
+ return ResourceManager.GetString("BlobServerPrefix", resourceCulture);
+ }
+ }
+
///
/// https://copilot.microsoft.com/과(와) 유사한 지역화된 문자열을 찾습니다.
///
diff --git a/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.resx b/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.resx
index 6be5c75..fc3f436 100644
--- a/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.resx
+++ b/WelsonJS.Toolkit/WelsonJS.Launcher/Properties/Resources.resx
@@ -181,4 +181,7 @@
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.3124.77
+
+ https://catswords.blob.core.windows.net/welsonjs/
+
\ No newline at end of file
diff --git a/WelsonJS.Toolkit/WelsonJS.Launcher/ResourceServer.cs b/WelsonJS.Toolkit/WelsonJS.Launcher/ResourceServer.cs
index 8538054..17ac918 100644
--- a/WelsonJS.Toolkit/WelsonJS.Launcher/ResourceServer.cs
+++ b/WelsonJS.Toolkit/WelsonJS.Launcher/ResourceServer.cs
@@ -21,7 +21,8 @@ namespace WelsonJS.Launcher
private bool _isRunning;
private string _prefix;
private string _resourceName;
- private List _resourceTools = new List();
+ private List _tools = new List();
+ private const int _blobTimeout = 5000;
public ResourceServer(string prefix, string resourceName)
{
@@ -31,12 +32,12 @@ namespace WelsonJS.Launcher
_resourceName = resourceName;
// Add resource tools
- _resourceTools.Add(new ResourceTools.Completion(this));
- _resourceTools.Add(new ResourceTools.Config(this));
- _resourceTools.Add(new ResourceTools.DevTools(this));
- _resourceTools.Add(new ResourceTools.DnsQuery(this));
- _resourceTools.Add(new ResourceTools.Tfa(this));
- _resourceTools.Add(new ResourceTools.Whois(this));
+ _tools.Add(new ResourceTools.Completion(this));
+ _tools.Add(new ResourceTools.Config(this));
+ _tools.Add(new ResourceTools.DevTools(this));
+ _tools.Add(new ResourceTools.DnsQuery(this));
+ _tools.Add(new ResourceTools.Tfa(this));
+ _tools.Add(new ResourceTools.Whois(this));
}
public string GetPrefix()
@@ -93,28 +94,67 @@ namespace WelsonJS.Launcher
{
string path = context.Request.Url.AbsolutePath.TrimStart('/');
- // Serve the favicon.ico file
- if ("favicon.ico".Equals(path, StringComparison.OrdinalIgnoreCase))
+ if (!String.IsNullOrEmpty(path))
{
- ServeResource(context, GetResource("favicon"), "image/x-icon");
- return;
- }
-
- // Serve from a resource tool
- foreach(var tool in _resourceTools)
- {
-
- if (tool.CanHandle(path))
+ // Serve the favicon.ico file
+ if ("favicon.ico".Equals(path, StringComparison.OrdinalIgnoreCase))
{
- await tool.HandleAsync(context, path);
+ ServeResource(context, GetResource("favicon"), "image/x-icon");
return;
}
+
+ // Serve from a resource tool
+ foreach (var tool in _tools)
+ {
+
+ if (tool.CanHandle(path))
+ {
+ await tool.HandleAsync(context, path);
+ return;
+ }
+ }
+
+ // Serve from the blob server
+ if (await ServeBlob(context, path)) return;
}
// Serve from a resource name
ServeResource(context, GetResource(_resourceName), "text/html");
}
+ private async Task ServeBlob(HttpListenerContext context, string path)
+ {
+ try
+ {
+ using (HttpClient client = new HttpClient())
+ {
+ client.Timeout = TimeSpan.FromMilliseconds(_blobTimeout);
+
+ string blobServerPrefix = Program.GetAppConfig("BlobServerPrefix");
+ string url = $"{blobServerPrefix}{path}";
+
+ HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);
+ HttpResponseMessage response = await client.SendAsync(request);
+
+ if (!response.IsSuccessStatusCode)
+ {
+ return false;
+ }
+
+ byte[] data = await response.Content.ReadAsByteArrayAsync();
+ string mimeType = response.Content.Headers.ContentType?.MediaType ?? "application/octet-stream";
+
+ ServeResource(context, data, mimeType);
+
+ return true;
+ }
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
public void ServeResource(HttpListenerContext context)
{
ServeResource(context, "Not Found", "application/xml", 404);
diff --git a/WelsonJS.Toolkit/WelsonJS.Launcher/app.config b/WelsonJS.Toolkit/WelsonJS.Launcher/app.config
index 0a85782..812f990 100644
--- a/WelsonJS.Toolkit/WelsonJS.Launcher/app.config
+++ b/WelsonJS.Toolkit/WelsonJS.Launcher/app.config
@@ -12,6 +12,7 @@
+
diff --git a/WelsonJS.Toolkit/WelsonJS.Launcher/editor.html b/WelsonJS.Toolkit/WelsonJS.Launcher/editor.html
index c6be876..53a1b50 100644
--- a/WelsonJS.Toolkit/WelsonJS.Launcher/editor.html
+++ b/WelsonJS.Toolkit/WelsonJS.Launcher/editor.html
@@ -3,9 +3,9 @@
WelsonJS Editor
-
-
-
+
+
+