Add a CDN servers

This commit is contained in:
Namhyeon Go 2025-05-05 23:32:41 +09:00
parent deed89560b
commit 14c8b12df7
4 changed files with 18 additions and 2 deletions

View File

@ -295,6 +295,15 @@ namespace WelsonJS.Launcher.Properties {
}
}
/// <summary>
/// https://raw.githubusercontent.com/과(와) 유사한 지역화된 문자열을 찾습니다.
/// </summary>
internal static string RawGitHubPrefix {
get {
return ResourceManager.GetString("RawGitHubPrefix", resourceCulture);
}
}
/// <summary>
/// https://github.com/gnh1201/welsonjs과(와) 유사한 지역화된 문자열을 찾습니다.
/// </summary>

View File

@ -214,4 +214,7 @@
<data name="PolyfillPrefix" xml:space="preserve">
<value>https://polyfill-fastly.io/</value>
</data>
<data name="RawGitHubPrefix" xml:space="preserve">
<value>https://raw.githubusercontent.com/</value>
</data>
</root>

View File

@ -37,7 +37,8 @@ namespace WelsonJS.Launcher
new[] { "npm/", "gh/", "wp/" },
new[] { "jquery/" },
new[] { "polyfill/" },
new[] { "ajax/" } // https://learn.microsoft.com/en-us/aspnet/ajax/cdn/overview
new[] { "ajax/" }, // https://learn.microsoft.com/en-us/aspnet/ajax/cdn/overview
new[] { "raw/gh/"}
};
private enum CDN_TYPES: int
{
@ -45,7 +46,8 @@ namespace WelsonJS.Launcher
JsDeliver = 1,
Jquery = 2,
Polyfill = 3,
Microsoft = 4
Microsoft = 4,
GitHub = 5
};
public ResourceServer(string prefix, string resourceName)
@ -241,6 +243,7 @@ namespace WelsonJS.Launcher
(isPrefixMatched(CDN_TYPES.Polyfill), "CdnJsPrefix", p => p), // polyfill.js from Cloudflare
(isPrefixMatched(CDN_TYPES.Polyfill), "PolyfillPrefix", p => p.Substring("polyfill/".Length)), // polyfill.js from Fastly
(isPrefixMatched(CDN_TYPES.Microsoft), "AspNetCdnPrefix", p => p), // Libraries from Microsoft
(isPrefixMatched(CDN_TYPES.GitHub), "RawGitHubPrefix", p => p.Substring("raw/gh/".Length)),
(true, "BlobStoragePrefix", p => p) // fallback
};

View File

@ -22,6 +22,7 @@
<add key="JqueryCdnPrefix" value="https://code.jquery.com/"/>
<add key="AspNetCdnPrefix" value="https://ajax.aspnetcdn.com/"/>
<add key="GoogleApisPrefix" value="https://ajax.googleapis.com/"/>
<add key="RawGitHubPrefix" value="https://raw.githubusercontent.com/"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>