in src/js/popup.js [1711:1747]
async updateProxyDependentUi(proxyInfo) {
const mozillaVpnProxyLocationAvailable = (proxy) => {
return typeof(proxy) !== "undefined" && typeof(proxy.countryCode) !== "undefined" && typeof(proxy.cityName) !== "undefined";
};
const mozillaVpnProxyIsEnabled = (proxy) => {
return typeof(proxy) !== "undefined" && typeof(proxy.mozProxyEnabled) !== "undefined" && proxy.mozProxyEnabled === true;
};
this.switch.checked = mozillaVpnProxyIsEnabled(proxyInfo);
this.updateProxyInputs(proxyInfo);
this.enableDisableProxyButtons();
const mozillaVpnConnected = await browser.runtime.sendMessage({ method: "MozillaVPN_getConnectionStatus" });
if (
!proxyInfo ||
!mozillaVpnProxyLocationAvailable(proxyInfo) ||
!mozillaVpnConnected
) {
// Hide server location button
this.currentServerButton.classList.add("hidden");
this.classList.remove("show-server-button");
} else {
// Unhide server location button
this.currentServerButton.style.display = "flex";
this.currentServerButton.classList.remove("hidden");
this.classList.add("show-server-button");
}
// Populate inputs and server button with current or previously stored mozilla vpn proxy
if(proxyInfo && mozillaVpnProxyLocationAvailable(proxyInfo)) {
this.currentCountryFlag.style.backgroundImage = `url("./img/flags/${proxyInfo.countryCode.toUpperCase()}.png")`;
this.currentCountryFlag.style.backgroundImage = proxyInfo.countryCode + ".png";
this.currentCityName.textContent = proxyInfo.cityName;
this.countryCode = proxyInfo.countryCode;
}
}