Skip to content

Commit 1ab1ba2

Browse files
committed
Revert "fix(EnableIpLocator): WebClientOptions parameter EnableIpLocator not work (#5400)"
This reverts commit e5e83f8. # Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj
1 parent 02c2186 commit 1ab1ba2

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

src/BootstrapBlazor/Components/ConnectionHub/ConnectionHub.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ protected override async Task InvokeInitAsync()
5151
Method = nameof(Callback),
5252
ConnectionId = Guid.NewGuid(),
5353
Interval = options.BeatInterval.TotalMilliseconds,
54-
Url = "ip.axd",
55-
BootstrapBlazorOptions.Value.WebClientOptions.EnableIpLocator
54+
Url = "ip.axd"
5655
});
5756
}
5857
}

src/BootstrapBlazor/Services/WebClientService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ public async Task<ClientInfo> GetClientInfo()
4444
{
4545
_jsModule ??= await runtime.LoadModuleByName("client");
4646
_interop ??= DotNetObjectReference.Create(this);
47-
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData), new
48-
{
49-
options.CurrentValue.WebClientOptions.EnableIpLocator
50-
});
47+
await _jsModule.InvokeVoidAsync("ping", "ip.axd", _interop, nameof(SetData));
5148

5249
// 等待 SetData 方法执行完毕
5350
await _taskCompletionSource.Task.WaitAsync(TimeSpan.FromSeconds(3));

src/BootstrapBlazor/wwwroot/modules/client.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import "./browser.js"
22
import { execute } from "./ajax.js"
33

4-
export async function ping(url, invoke, method, options) {
5-
const data = await getClientInfo(url, options);
4+
export async function ping(url, invoke, method) {
5+
const data = await getClientInfo(url);
66
await invoke.invokeMethodAsync(method, data)
77
}
88

9-
export async function getClientInfo(url, options) {
9+
export async function getClientInfo(url) {
1010
const info = browser()
1111
let data = {
1212
browser: info.browser + ' ' + info.version,
@@ -17,14 +17,12 @@ export async function getClientInfo(url, options) {
1717
os: info.system + ' ' + info.systemVersion
1818
}
1919

20-
if (options.enableIpLocator === true) {
21-
const result = await execute({
22-
method: 'GET',
23-
url
24-
});
25-
if (result) {
26-
data.ip = result.Ip;
27-
}
20+
const result = await execute({
21+
method: 'GET',
22+
url
23+
});
24+
if (result) {
25+
data.ip = result.Ip;
2826
}
2927
data.id = localStorage.getItem('bb_hub_connection_id') ?? result.Id;
3028
return data;

src/BootstrapBlazor/wwwroot/modules/hub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Data from "./data.js"
33
import EventHandler from "./event-handler.js";
44

55
export async function init(id, options) {
6-
const { invoke, method, interval = 3000, url, connectionId, enableIpLocator } = options;
6+
const { invoke, method, interval = 3000, url, connectionId } = options;
77
const elKey = 'bb_hub_el_id';
88
if (localStorage.getItem(elKey) === null) {
99
localStorage.setItem(elKey, id);
@@ -34,7 +34,7 @@ export async function init(id, options) {
3434
}
3535
});
3636

37-
const info = await getClientInfo(url, { enableIpLocator: enableIpLocator });
37+
const info = await getClientInfo(url);
3838
info.id = clientId;
3939

4040
const callback = async () => {

0 commit comments

Comments
 (0)