-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(JuHeIpLocatorProvider): bump version 10.1.0 #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
57133e1
c843c00
5bb4b49
6172e1e
5a68835
317382d
1605eee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,16 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
|
||
| <PropertyGroup> | ||
| <Version>10.1.0</Version> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <PackageTags>Bootstrap Blazor WebAssembly wasm UI Components JuHe Ip Locator</PackageTags> | ||
| <Description>Bootstrap UI components extensions of JuHeIpLocator</Description> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="BootstrapBlazor" Version="$(BBVersion)" /> | ||
| <PackageReference Include="BootstrapBlazor" Version="10.4.0" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,31 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// 聚合搜索引擎 IP 定位器配置类 | ||
| /// <para lang="zh">聚合搜索引擎 IP 定位器配置类</para> | ||
| /// <para lang="en">JuHe IP locator options</para> | ||
| /// </summary> | ||
| class JuHeIpLocatorOptions | ||
| { | ||
| /// <summary> | ||
| /// 聚合搜索引擎 IP 定位器 AppKey | ||
| /// <para lang="zh">获得/设置 聚合搜索引擎 IP 定位器 AppKey</para> | ||
| /// <para lang="en">Gets or sets the JuHe IP locator AppKey</para> | ||
| /// </summary> | ||
| public string Key { get; set; } = ""; | ||
| public string? Key { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 聚合搜索引擎 IP 定位器请求地址 | ||
| /// <para lang="zh">获得/设置 聚合搜索引擎 IP 定位器请求地址</para> | ||
| /// <para lang="en">Gets or sets the JuHe IP locator request URL</para> | ||
| /// </summary> | ||
| public string Url { get; set; } = "http://apis.juhe.cn/ip/ipNew"; | ||
| public string? Url { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 聚合搜索引擎 IP 定位器请求超时时间 默认 5 秒 | ||
| /// <para lang="zh">获得/设置 聚合搜索引擎 IP 定位器请求超时时间 默认 5 秒</para> | ||
| /// <para lang="en">Gets or sets the JuHe IP locator request timeout, default is 5 seconds</para> | ||
| /// </summary> | ||
| public TimeSpan Timeout { get; set; } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,17 +1,16 @@ | ||||||
| // Copyright (c) Argo Zhang (argo@163.com). All rights reserved. | ||||||
| // Copyright (c) Argo Zhang (argo@163.com). All rights reserved. | ||||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||
|
|
||||||
| using Microsoft.Extensions.Configuration; | ||||||
| using Microsoft.Extensions.Logging; | ||||||
| using Microsoft.Extensions.Options; | ||||||
| using System.Net.Http.Json; | ||||||
| using System.Text.Json.Serialization; | ||||||
|
|
||||||
| namespace BootstrapBlazor.Components; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 聚合搜索引擎 IP 定位器 | ||||||
| /// <para lang="zh">聚合搜索引擎 IP 定位器</para> | ||||||
| /// <para lang="en">JuHe IP locator provider</para> | ||||||
| /// </summary> | ||||||
| /// <param name="httpClientFactory"></param> | ||||||
| /// <param name="options"></param> | ||||||
|
|
@@ -26,6 +25,8 @@ class JuHeIpLocatorProvider(IHttpClientFactory httpClientFactory, | |||||
|
|
||||||
| private JuHeIpLocatorOptions? _options; | ||||||
|
|
||||||
| private const string Url = "http://apis.juhe.cn/ip/ipNewV3"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 suggestion (security): Consider using HTTPS instead of HTTP for the default JuHe API URL to avoid sending IP data over an unencrypted channel. This constant currently uses plain HTTP. If
|
||||||
| private const string Url = "http://apis.juhe.cn/ip/ipNewV3"; | |
| private const string Url = "https://apis.juhe.cn/ip/ipNewV3"; |
Copilot
AI
Mar 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The English portion of the error message "Key not value in appsettings configuration file" is grammatically incorrect. It should read something like "Key has no value in appsettings configuration file" or "Key is not configured in appsettings configuration file".
| LastError = $"{nameof(JuHeIpLocatorOptions)}:Key not value in appsettings configuration file. 未配置 {nameof(JuHeIpLocatorOptions)}:Key 请在 appsettings.json 中配置 {nameof(JuHeIpLocatorOptions)}:Key"; | |
| LastError = $"{nameof(JuHeIpLocatorOptions)}:Key has no value in appsettings configuration file. 未配置 {nameof(JuHeIpLocatorOptions)}:Key 请在 appsettings.json 中配置 {nameof(JuHeIpLocatorOptions)}:Key"; |
Copilot
AI
Mar 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Key is empty/null, the method logs an error but still returns the options object. The caller LocateByIp then proceeds to construct a URL with an empty key and makes a pointless HTTP request that will fail. Previously, this code threw an InvalidOperationException, which would prevent the HTTP call. Consider either returning early (e.g., returning null and checking in LocateByIp) or short-circuiting the LocateByIp call when Key is missing, to avoid unnecessary network requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component hardcodes
BootstrapBlazorversion10.4.0while every other component in the repository uses$(BBVersion)(currently10.0.0, defined insrc/Directory.Build.props:25). This breaks the convention for centralized dependency version management and could lead to version inconsistencies across the solution. Consider using$(BBVersion)here as well, or updatingBBVersioncentrally if a newer version is needed.