Merge pull request #3 from CChannel/meza/update-tracker

save user ip on the window to cache it
pull/1644/head
Sergei Meza 2022-10-18 11:16:56 +09:00 committed by GitHub
commit 94f512fa2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -86,14 +86,16 @@
const getClientIPAddress = () => {
return new Promise((res, rej) => {
if (ip) {
res(ip);
if (window.ip) {
ip = window.ip;
res(window.ip);
return;
}
fetch('https://api64.ipify.org/?format=json')
.then(res => res.json())
.then(data => {
ip = data.ip;
window.ip = data.ip;
res(ip);
return;
})