fix: skip alt-IP detection when querying another IP address

The detectAltIp() function was unconditionally fetching the viewer's own
IPv6/IPv4 address and displaying it alongside queried IP results. Pass
the is_query flag to the client via a data attribute and guard the
alt-IP detection so it only runs when viewing your own IP.
This commit is contained in:
NetworkCats
2026-03-22 11:58:44 +08:00
parent fb661933e8
commit d236302b09
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -320,5 +320,7 @@ function initCopyIp(wrap){
}
}
detectAltIp();
if(!root.hasAttribute("data-is-query")){
detectAltIp();
}
})();
+1
View File
@@ -67,6 +67,7 @@
<div itemscope itemtype="https://schema.org/WebPage"
data-ipv4-domain="{{ ipv4_domain }}"
data-copied-text="{{ t_copied }}"
{% if is_query %}data-is-query="true"{% endif %}
id="ip-info-root">
<div class="ip-copy-wrap" data-copied="{{ t_copied }}">
<h1 class="ip-display" itemprop="name">{{ ip }}</h1>