Dev update to mh-root-prefixed.json

merge-requests/205/head
Tag 2022-10-01 18:21:21 -07:00
rodzic 119bf4cf77
commit fe1abd656a
4 zmienionych plików z 66 dodań i 43949 usunięć

Wyświetl plik

@ -1474,7 +1474,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</table>
</div>
<br />
<div id="devPanel" class="mapItem" style="display:none;" >
<div class="button" onclick="downloadCtyDat()">Update from ctydat</div>
<div id="ctyDatStatus"></div>
<div id="ctyDatFinal"></div>
</div>
<div id="callsignDatabaseDiv" class="mapItem">
<table align="center" class="darkTable">
<tr>

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -824,3 +824,58 @@ function lookupUsCallsign(object, writeState = false)
);
});
}
function downloadCtyDat()
{
ctyDatStatus.innerHTML = "<b><i>Downloading...</i></b>";
getBuffer(
"https://storage.googleapis.com/gt_app/ctydat.json",
processCtyDat,
null,
"https",
443
);
}
function processCtyDat(buffer)
{
let data = String(buffer);
ctyDatStatus.innerHTML = "Update: " + data.length + " bytes read";
try
{
let ctydata = JSON.parse(data);
let file = "./data/mh-root-prefixed.json";
if (fs.existsSync(file))
{
let fileBuf = fs.readFileSync(file, "UTF-8");
let worldGeoData = JSON.parse(fileBuf);
for (const key in worldGeoData)
{
if (worldGeoData[key].dxcc in ctydata)
{
// Skip Guantanamo Bay, hand crafted with love
if (worldGeoData[key].dxcc != "105")
{
worldGeoData[key].prefix = [];
let arr = ctydata[worldGeoData[key].dxcc].prefix.substr(0, ctydata[worldGeoData[key].dxcc].prefix.length - 1).split(" ");
for (const x in arr)
{
if (!(arr[x].includes("(")) && !(arr[x].includes("[")) && !(arr[x].includes("<")) && !(arr[x].includes("{")) && !(arr[x].includes("~")))
{
worldGeoData[key].prefix.push(arr[x]);
}
}
worldGeoData[key].prefix.sort();
}
}
}
fs.writeFileSync(file, JSON.stringify(worldGeoData));
ctyDatFinal.innerHTML = file + " updated!";
}
}
catch (e)
{
console.log(e);
}
}

Wyświetl plik

@ -13599,6 +13599,11 @@ function postInit()
openCallRosterWindow(false);
openConditionsWindow(false);
showMessaging(false);
if (g_developerMode)
{
devPanel.style.display = "inline-block";
}
}
document.addEventListener("dragover", function (event)