Skip to content

Commit

Permalink
feat(IP2Region): add IP2Region package (#5402)
Browse files Browse the repository at this point in the history
* feat: 增加 enableIpLocator 参数控制

* feat: 增加禁止调用 ip.axd 逻辑

* refactor: 增加 EnableIpLocator 参数

* chore: bump version 9.3.1-beta23

* refactor: 代码重构

* refactor: 移除不使用的命名空间

* feat: 增加离线 IP 地理位置定位包

* chore: 增加 IP2Region 包引用

* doc: 更新文档
  • Loading branch information
ArgoZhang authored Feb 20, 2025
1 parent e5e83f8 commit 75897ad
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<IsWebProject>true</IsWebProject>
Expand Down Expand Up @@ -31,7 +31,7 @@
<PackageReference Include="BootstrapBlazor.Chart" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.CherryMarkdown" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.Dock" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.DockView" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.DockView" Version="9.1.1" />
<PackageReference Include="BootstrapBlazor.DriverJs" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.ElementIcon" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.FileViewer" Version="9.0.0" />
Expand All @@ -41,6 +41,7 @@
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.IconPark" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.IP2Region" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ protected override void OnInitialized()
{
base.OnInitialized();

_providers = IpLocatorProviders.Select(provider => new SelectedItem
_providers = [.. IpLocatorProviders.Select(provider => new SelectedItem
{
Text = provider.GetType().Name,
Value = provider.GetType().Name
}).ToList();
})];
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect
// 增加 Table Excel 导出服务
services.AddBootstrapBlazorTableExportService();

// 增加离线 IP 定位服务
services.AddBootstrapBlazorIP2RegionfService();

// 增加 PetaPoco ORM 数据服务操作类
// 需要时打开下面代码
//services.AddPetaPoco(option =>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,7 @@
"LocatorsNormalInputText": "IpAddress",
"LocatorsNormalDisplayText": "Geographical location",
"LocatorsNormalButtonText": "Locating",
"LocatorsProviderDesc": "The component library has two built-in geolocation locators: <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code>"
"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>"
},
"BootstrapBlazor.Server.Components.Samples.Print": {
"PrintsTitle": "Print",
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,7 @@
"LocatorsNormalInputText": "Ip 地址",
"LocatorsNormalDisplayText": "地理位置",
"LocatorsNormalButtonText": "定位",
"LocatorsProviderDesc": "组件库内置两个地理位置定位器分别为 <code>BaiduIpLocatorProvider</code> <code>BaiduIpLocatorProviderV2</code>"
"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>"
},
"BootstrapBlazor.Server.Components.Samples.Print": {
"PrintsTitle": "Print 打印按钮",
Expand Down
1 change: 0 additions & 1 deletion src/BootstrapBlazor.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone

using BootstrapBlazor.Server.Components;
using BootstrapBlazor.Server.Components.Layout;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Options;
using System.Text;
Expand Down

0 comments on commit 75897ad

Please sign in to comment.