Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit b5915ad

Browse files
committed
add ping addr config and city display
1 parent d37332a commit b5915ad

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/_boot.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ if (!fs.existsSync(settingsFile)) {
5555
shell: (process.platform === "win32") ? "powershell.exe" : "bash",
5656
cwd: electron.app.getPath("userData"),
5757
keyboard: "en-US",
58-
theme: "tron"
58+
theme: "tron",
59+
lang: "en",
60+
pingAddr: "1.1.1.1"
5961
}));
6062
}
6163

src/classes/locationGlobe.class.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LocationGlobe {
1313
this.parent = document.getElementById(parentId);
1414
this.parent.innerHTML += `<div id="mod_globe">
1515
<div id="mod_globe_innercontainer">
16-
<h1>WORLD VIEW<i>GLOBAL NETWORK MAP</i></h1>
16+
<h1>WORLD VIEW<i class="mod_globe_location">GLOBAL NETWORK MAP</i></h1>
1717
<h2>ENDPOINT LAT/LON<i class="mod_globe_headerInfo">0.0000, 0.0000</i></h2>
1818
<div id="mod_globe_canvas_placeholder"></div>
1919
</div>
@@ -138,13 +138,14 @@ class LocationGlobe {
138138
}
139139
updateLoc() {
140140
try {
141-
let newgeo = window.mods.netstat.ipinfo.geo.location;
141+
let lang = window.settings.lang;
142+
let geo = window.mods.netstat.ipinfo.geo;
143+
let newgeo = geo.location;
142144
newgeo.latitude = Math.round(newgeo.latitude*10000)/10000;
143145
newgeo.longitude = Math.round(newgeo.longitude*10000)/10000;
144146

145147
if (newgeo.latitude !== this.lastgeo.latitude || newgeo.longitude !== this.lastgeo.longitude) {
146148
document.querySelector("i.mod_globe_headerInfo").innerText = `${newgeo.latitude}, ${newgeo.longitude}`;
147-
148149
this.globe.pins.forEach(pin => {
149150
pin.remove();
150151
});
@@ -161,6 +162,8 @@ class LocationGlobe {
161162
}
162163

163164
this.lastgeo = newgeo;
165+
document.querySelector("i.mod_globe_location").innerText = `${geo.country.names[lang]}`;
166+
document.querySelector("i.mod_globe_location").innerText +=`,${geo.city.names[lang]}`
164167
} catch(e) {
165168
document.querySelector("i.mod_globe_headerInfo").innerText = "UNKNOWN";
166169
}

src/classes/netstat.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Netstat {
8989
});
9090
}
9191

92-
this.si.inetLatency("1.1.1.1", (data) => {
92+
this.si.inetLatency(window.settings.pingAddr, (data) => {
9393
let ping;
9494
if (data === -1) {
9595
ping = "--ms";

0 commit comments

Comments
 (0)