feat(login): show xGat3 button only when accessed via IP address

Hide the Open xGat3 button when the page is accessed via a domain name.
Only show it when the hostname is a raw IP (e.g. 10.0.0.1 over WireGuard).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
xtcnet 2026-03-17 21:44:02 +07:00
parent 1b97b8b0ad
commit dd525adaef

View file

@ -198,16 +198,18 @@ export default function Login() {
</div> </div>
</div> </div>
<div className="text-center text-secondary mt-3">{getVersion()}</div> <div className="text-center text-secondary mt-3">{getVersion()}</div>
<div className="text-center mt-3"> {/^\d+\.\d+\.\d+\.\d+$/.test(window.location.hostname) && (
<a <div className="text-center mt-3">
href={`${window.location.origin}/wg-public`} <a
className="btn btn-outline-secondary btn-sm" href={`${window.location.origin}/wg-public`}
target="_blank" className="btn btn-outline-secondary btn-sm"
rel="noopener noreferrer" target="_blank"
> rel="noopener noreferrer"
Open xGat3 >
</a> Open xGat3
</div> </a>
</div>
)}
</div> </div>
</Page> </Page>
); );