Skip to content

Commit cab0326

Browse files
committed
Merge branch 'main' into dev-auto-mode
# Conflicts: # src/BootstrapBlazor.Server/Extensions/ServiceCollectionExtensions.cs # src/BootstrapBlazor.Shared/BootstrapBlazor.Shared.csproj # src/BootstrapBlazor.Shared/Extensions/ServicesCollectionExtensions.cs
2 parents cdc9eaa + 05adf6f commit cab0326

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

src/BootstrapBlazor.Server/Extensions/ServiceCollectionExtensions.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using BootstrapBlazor.Service.Services;
77
using Microsoft.AspNetCore.SignalR;
8+
using Microsoft.Extensions.Options;
89
using System.Text.Encodings.Web;
910
using System.Text.Unicode;
1011

@@ -16,8 +17,28 @@ public static IServiceCollection AddBootstrapBlazorServerService(this IServiceCo
1617
{
1718
// 增加中文编码支持网页源码显示汉字
1819
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
20+
21+
// 增加错误日志
22+
services.AddLogging(logBuilder => logBuilder.AddFileLogger());
23+
24+
// 增加跨域服务
1925
services.AddCors();
2026

27+
// 增加多语言支持配置信息
28+
services.AddRequestLocalization<IOptionsMonitor<BootstrapBlazorOptions>>((localizerOption, blazorOption) =>
29+
{
30+
blazorOption.OnChange(Invoke);
31+
Invoke(blazorOption.CurrentValue);
32+
return;
33+
34+
void Invoke(BootstrapBlazorOptions option)
35+
{
36+
var supportedCultures = option.GetSupportedCultures();
37+
localizerOption.SupportedCultures = supportedCultures;
38+
localizerOption.SupportedUICultures = supportedCultures;
39+
}
40+
});
41+
2142
#if DEBUG
2243
#else
2344
services.AddResponseCompression(options =>
@@ -32,8 +53,8 @@ public static IServiceCollection AddBootstrapBlazorServerService(this IServiceCo
3253
// 增加 SignalR 服务数据传输大小限制配置
3354
services.Configure<HubOptions>(option => option.MaximumReceiveMessageSize = null);
3455

35-
// 增加错误日志
36-
services.AddLogging(logging => logging.AddFileLogger());
56+
// 增加授权服务
57+
services.AddAuthorization();
3758

3859
// 增加后台任务服务
3960
services.AddTaskServices();

src/BootstrapBlazor.Shared/BootstrapBlazor.Shared.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@
5959
<PackageReference Include="BootstrapBlazor.SvgEditor" Version="9.0.0" />
6060
<PackageReference Include="BootstrapBlazor.SummerNote" Version="9.0.1" />
6161
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.0.0" />
62-
<!--<PackageReference Include="BootstrapBlazor.TagHelper" Version="9.0.0" />-->
6362
<PackageReference Include="BootstrapBlazor.Topology" Version="9.0.0" />
6463
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="9.0.1" />
6564
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.5" />
66-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
6765
</ItemGroup>
6866

6967
<ItemGroup>

src/BootstrapBlazor.Shared/Extensions/ServicesCollectionExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
7171
// 增加 Table Excel 导出服务
7272
services.AddBootstrapBlazorTableExportService();
7373

74-
// 增加 脚本版本服务
75-
//services.AddBootstrapAppendVersionService();
76-
7774
// 增加 PetaPoco ORM 数据服务操作类
7875
// 需要时打开下面代码
7976
//services.AddPetaPoco(option =>
@@ -132,7 +129,6 @@ public static IServiceCollection AddWebSiteServices(this IServiceCollection serv
132129
services.AddOptionsMonitor<WebsiteOptions>();
133130

134131
// 增加模拟登录服务
135-
//services.AddAuthorization();
136132
services.AddCascadingAuthenticationState();
137133
services.AddScoped<AuthenticationStateProvider, MockAuthenticationStateProvider>();
138134

0 commit comments

Comments
 (0)