Skip to content

Commit b2521fb

Browse files
committed
feat: make it default for to use default and static files
1 parent 91f12cf commit b2521fb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/NetCore2Blockly/NetCore2BlocklyNew/Extensions.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace NetCore2BlocklyNew
1616
public static class Extensions
1717
{
1818
public static IEndpointRouteBuilder UseBlocklyAutomation(this IEndpointRouteBuilder endpoints)
19-
{
19+
{
2020
//endpoints.MapFallbackToFile("BlocklyAutomation/{**:nonfile}", "BlocklyAutomation/index.html");
2121
endpoints.Map("BlocklyAutomation/{**:nonfile}", async ctx =>
2222
{
@@ -33,8 +33,14 @@ public static IEndpointRouteBuilder UseBlocklyAutomation(this IEndpointRouteBuil
3333
return endpoints;
3434
}
3535
public static IFileProvider FileProvider { get; set; }
36-
public static void UseBlocklyUI(this IApplicationBuilder appBuilder, IWebHostEnvironment environment)
36+
public static void UseBlocklyUI(this IApplicationBuilder appBuilder, IWebHostEnvironment environment, bool registerStaticAndDefaultFiles=true)
3737
{
38+
if (registerStaticAndDefaultFiles)
39+
{
40+
appBuilder.UseDefaultFiles();
41+
appBuilder.UseStaticFiles();
42+
}
43+
3844
if (FileProvider == null)
3945
{
4046
var manifestEmbeddedProvider =

src/NetCore2Blockly/NetCore2BlocklyNew/NetCore2BlocklyNew.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<ItemGroup>
5050
<!--<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />-->
5151
<!--<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />-->
52+
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
5253
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.0.0" />
5354
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
5455
<PackageReference Include="MimeTypeMapOfficial" Version="1.0.17" />

0 commit comments

Comments
 (0)