Skip to content

Commit 02c2186

Browse files
authored
feat(JuHeIpLocatorProvider): add JuHeIpLocatorProvider package (#5404)
* feat: 增加 enableIpLocator 参数控制 * feat: 增加禁止调用 ip.axd 逻辑 * refactor: 增加 EnableIpLocator 参数 * chore: bump version 9.3.1-beta23 * refactor: 代码重构 * refactor: 移除不使用的命名空间 * feat: 增加离线 IP 地理位置定位包 * chore: 增加 IP2Region 包引用 * doc: 更新文档 * refactor: 增加 JuHeIpLocatorOptions 配置类 * refactor: 重构逻辑 * chore: 移除 JuHeIpLocatorProvider * test: 更新单元测试 * refactor: 移除注入服务代码 * chore: bump version 9.3.1-beta24 * chore: 增加 BootstrapBlazor.JuHeIpLocatorProvider 包依赖 * doc: 更新文档 * test: 更新单元测试 * feat: 增加 Keyed 服务 * test: 增加单元测试
1 parent 75897ad commit 02c2186

File tree

8 files changed

+15
-301
lines changed

8 files changed

+15
-301
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<PackageReference Include="BootstrapBlazor.IconPark" Version="9.0.2" />
4343
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.0" />
4444
<PackageReference Include="BootstrapBlazor.IP2Region" Version="9.0.1" />
45+
<PackageReference Include="BootstrapBlazor.JuHeIpLocatorProvider" Version="9.0.0-beta01" />
4546
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="9.0.1" />
4647
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.1" />
4748
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.1" />

src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
8282
// 增加离线 IP 定位服务
8383
services.AddBootstrapBlazorIP2RegionfService();
8484

85+
// 增加 JuHe 定位服务
86+
services.AddBootstrapBlazorJuHeIpLocatorService();
87+
8588
// 增加 PetaPoco ORM 数据服务操作类
8689
// 需要时打开下面代码
8790
//services.AddPetaPoco(option =>

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4142,7 +4142,7 @@
41424142
"LocatorsNormalInputText": "IpAddress",
41434143
"LocatorsNormalDisplayText": "Geographical location",
41444144
"LocatorsNormalButtonText": "Locating",
4145-
"LocatorsProviderDesc": "<p>The component library has two built-in free online geolocation locators, <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>The component library has a built-in paid online geolocation locator <code>JuHeIpLocatorProvider</code> <a href=\"https://juhe.cn\" target=\"_blank\">Official website address</a></p><p>The component library has a built-in free offline geolocation locator <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget package</a></p>"
4145+
"LocatorsProviderDesc": "<p>The component library has two built-in free online geolocation locators, <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>The component library has a built-in paid online geolocation locator <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget package</a> <a href=\"https://juhe.cn\" target=\"_blank\">Official website address</a></p><p>The component library has a built-in free offline geolocation locator <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget package</a></p>"
41464146
},
41474147
"BootstrapBlazor.Server.Components.Samples.Print": {
41484148
"PrintsTitle": "Print",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4142,7 +4142,7 @@
41424142
"LocatorsNormalInputText": "Ip 地址",
41434143
"LocatorsNormalDisplayText": "地理位置",
41444144
"LocatorsNormalButtonText": "定位",
4145-
"LocatorsProviderDesc": "<p>组件库内置两个免费在线地理位置定位器分别为 <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>组件库内置一个收费在线地理位置定位器 <code>JuHeIpLocatorProvider</code> <a href=\"https://juhe.cn\" target=\"_blank\">官网地址</a></p><p>组件库内置一个免费离线地理位置定位器 <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget 包</a></p>"
4145+
"LocatorsProviderDesc": "<p>组件库内置两个免费在线地理位置定位器分别为 <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code><p><p>组件库内置一个收费在线地理位置定位器 <code>BootstrapBlazor.JuHeIpLocatorProvider</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.JuHeIpLocatorProvider\" target=\"_blank\">Nuget 包</a> <a href=\"https://juhe.cn\" target=\"_blank\">官网地址</a></p><p>组件库内置一个免费离线地理位置定位器 <code>BootstrapBlazor.IP2Region</code> <a href=\"https://www.nuget.org/packages/BootstrapBlazor.IP2Region\" target=\"_blank\">Nuget 包</a></p>"
41464146
},
41474147
"BootstrapBlazor.Server.Components.Samples.Print": {
41484148
"PrintsTitle": "Print 打印按钮",

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.3.1-beta23</Version>
4+
<Version>9.3.1-beta24</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ public static IServiceCollection AddBootstrapBlazor(this IServiceCollection serv
4747

4848
// IP 地理位置定位服务
4949
services.TryAddSingleton<IIpLocatorFactory, DefaultIpLocatorFactory>();
50-
services.AddSingleton<IIpLocatorProvider, JuHeIpLocatorProvider>();
5150
services.AddSingleton<IIpLocatorProvider, BaiduIpLocatorProvider>();
5251
services.AddSingleton<IIpLocatorProvider, BaiduIpLocatorProviderV2>();
5352

53+
#if NET8_0_OR_GREATER
54+
services.AddKeyedSingleton<IIpLocatorProvider, BaiduIpLocatorProvider>(nameof(BaiduIpLocatorProvider));
55+
services.AddKeyedSingleton<IIpLocatorProvider, BaiduIpLocatorProviderV2>(nameof(BaiduIpLocatorProviderV2));
56+
#endif
57+
5458
// 节日服务
5559
services.TryAddSingleton<ICalendarFestivals, DefaultCalendarFestivals>();
5660

src/BootstrapBlazor/Services/IPLocator/JuHeIpLocatorProvider.cs

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)