Skip to content

Commit ba712eb

Browse files
committed
feat: 增加禁止调用 ip.axd 逻辑
1 parent 18ab161 commit ba712eb

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/BootstrapBlazor/wwwroot/modules/client.js

Lines changed: 11 additions & 9 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) {
5-
const data = await getClientInfo(url);
4+
export async function ping(url, invoke, method, options) {
5+
const data = await getClientInfo(url, options);
66
await invoke.invokeMethodAsync(method, data)
77
}
88

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

20-
const result = await execute({
21-
method: 'GET',
22-
url
23-
});
24-
if (result) {
25-
data.ip = result.Ip;
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+
}
2628
}
2729
data.id = localStorage.getItem('bb_hub_connection_id') ?? result.Id;
2830
return data;

0 commit comments

Comments
 (0)