Prettified Code!

This commit is contained in:
Mashintime 2023-07-05 16:43:56 +00:00 committed by GitHub Action
parent 59fbee8893
commit 104db8830e
13 changed files with 308 additions and 328 deletions

View file

@ -228,7 +228,7 @@ exports.startTNC = function (
tx_delay, tx_delay,
tci_ip, tci_ip,
tci_port, tci_port,
enable_mesh enable_mesh,
) { ) {
var json_command = JSON.stringify({ var json_command = JSON.stringify({
type: "set", type: "set",
@ -265,7 +265,7 @@ exports.startTNC = function (
tx_delay: tx_delay, tx_delay: tx_delay,
tci_ip: tci_ip, tci_ip: tci_ip,
tci_port: tci_port, tci_port: tci_port,
enable_mesh: enable_mesh enable_mesh: enable_mesh,
}, },
], ],
}); });
@ -292,7 +292,7 @@ exports.testHamlib = function (
stop_bits, stop_bits,
handshake, handshake,
rigctld_ip, rigctld_ip,
rigctld_port rigctld_port,
) { ) {
var json_command = JSON.stringify({ var json_command = JSON.stringify({
type: "get", type: "get",

View file

@ -331,7 +331,7 @@ app.whenReady().then(() => {
daemonPath = path.join( daemonPath = path.join(
process.resourcesPath, process.resourcesPath,
"tnc", "tnc",
"freedata-daemon.exe" "freedata-daemon.exe",
); );
break; break;
default: default:
@ -433,7 +433,7 @@ ipcMain.on("request-update-daemon-ip", (event, data) => {
ipcMain.on("request-update-tnc-state", (event, arg) => { ipcMain.on("request-update-tnc-state", (event, arg) => {
win.webContents.send("action-update-tnc-state", arg); win.webContents.send("action-update-tnc-state", arg);
meshViewer.send("action-update-mesh-table", arg) meshViewer.send("action-update-mesh-table", arg);
//data.webContents.send('action-update-tnc-state', arg); //data.webContents.send('action-update-tnc-state', arg);
}); });
@ -517,7 +517,6 @@ ipcMain.on("request-open-mesh-module", () => {
meshViewer.show(); meshViewer.show();
}); });
//file selector //file selector
ipcMain.on("get-file-path", (event, data) => { ipcMain.on("get-file-path", (event, data) => {
dialog dialog
@ -676,7 +675,7 @@ ipcMain.on("save-file-to-folder", (event, data) => {
filepath.filePath, filepath.filePath,
arraybuffer, arraybuffer,
"binary", "binary",
function (err, data) {} function (err, data) {},
); );
} catch (err) { } catch (err) {
console.log(err); console.log(err);
@ -758,9 +757,9 @@ ipcMain.on(
(event, data) => { (event, data) => {
win.webContents.send( win.webContents.send(
"action-show-arq-toast-datachannel-received-opener", "action-show-arq-toast-datachannel-received-opener",
data data,
); );
} },
); );
// ARQ TRANSMISSION FAILED // ARQ TRANSMISSION FAILED
@ -789,9 +788,9 @@ ipcMain.on(
(event, data) => { (event, data) => {
win.webContents.send( win.webContents.send(
"action-show-arq-toast-transmission-transmitting", "action-show-arq-toast-transmission-transmitting",
data data,
); );
} },
); );
// ARQ TRANSMISSION TRANSMITTED // ARQ TRANSMISSION TRANSMITTED

View file

@ -184,7 +184,7 @@ window.addEventListener("DOMContentLoaded", () => {
}); });
} else { } else {
console.log( console.log(
config.mycall + " not found in user db - creating new entry" config.mycall + " not found in user db - creating new entry",
); );
// add initial entry for own callsign and grid // add initial entry for own callsign and grid
let obj = new Object(); let obj = new Object();
@ -639,10 +639,10 @@ ipcRenderer.on("return-select-user-image", (event, arg) => {
.then(function (compressedFile) { .then(function (compressedFile) {
console.log( console.log(
"compressedFile instanceof Blob", "compressedFile instanceof Blob",
compressedFile instanceof Blob compressedFile instanceof Blob,
); // true ); // true
console.log( console.log(
`compressedFile size ${compressedFile.size / 1024 / 1024} MB` `compressedFile size ${compressedFile.size / 1024 / 1024} MB`,
); // smaller than maxSizeMB ); // smaller than maxSizeMB
console.log(compressedFile.size); console.log(compressedFile.size);
@ -683,7 +683,7 @@ ipcRenderer.on("action-update-transmission-status", (event, arg) => {
document.getElementById("txtConnectedWithChat").textContent = data.dxcallsign; document.getElementById("txtConnectedWithChat").textContent = data.dxcallsign;
if (typeof data.uuid === undefined) return; if (typeof data.uuid === undefined) return;
//console.log(data.status); //console.log(data.status);
if (data.uuid !== "no-uuid") { if (data.uuid !== "no-uuid") {
@ -1056,16 +1056,19 @@ update_chat = function (obj) {
} }
// check if wrong status message // check if wrong status message
if (obj.status == "transmit" && obj.type == "transmit" && obj.percent < 100) { if (obj.status == "transmit" && obj.type == "transmit" && obj.percent < 100) {
var TimeDifference = new Date().getTime() / 1000 - obj.timestamp; var TimeDifference = new Date().getTime() / 1000 - obj.timestamp;
if (TimeDifference > 21600) { //Six hours if (TimeDifference > 21600) {
console.log("Resetting message to failed state since in transmit status for over 6 hours:") //Six hours
console.log(
"Resetting message to failed state since in transmit status for over 6 hours:",
);
console.log(obj); console.log(obj);
db.upsert(obj._id, function (doc) { db.upsert(obj._id, function (doc) {
doc.status = "failed"; doc.status = "failed";
return doc; return doc;
}); });
obj.status = "failed"; obj.status = "failed";
} }
} }
if (typeof obj.new == "undefined") { if (typeof obj.new == "undefined") {
@ -1114,7 +1117,7 @@ update_chat = function (obj) {
var fileheader = ` var fileheader = `
<div class="card-header border-0 bg-transparent text-end p-0 mb-0 hover-overlay"> <div class="card-header border-0 bg-transparent text-end p-0 mb-0 hover-overlay">
<img class="w-100 rounded-2" src="data:image/png;base64,${FD.atob( <img class="w-100 rounded-2" src="data:image/png;base64,${FD.atob(
obj._attachments[filename]["data"] obj._attachments[filename]["data"],
)}"> )}">
<p class="text-right mb-0 p-1" style="text-align: right; font-size : 1rem"> <p class="text-right mb-0 p-1" style="text-align: right; font-size : 1rem">
<span class="p-1" style="text-align: right; font-size : 0.8rem">${filename}</span> <span class="p-1" style="text-align: right; font-size : 0.8rem">${filename}</span>
@ -1246,7 +1249,7 @@ update_chat = function (obj) {
let clear = selected_callsign; let clear = selected_callsign;
clearUnreadMessages(clear); clearUnreadMessages(clear);
document.getElementById( document.getElementById(
`chat-${selected_callsign}-list-displaydxcall` `chat-${selected_callsign}-list-displaydxcall`,
).textContent = selected_callsign; ).textContent = selected_callsign;
document document
.getElementById(`chat-${selected_callsign}-list`) .getElementById(`chat-${selected_callsign}-list`)
@ -1273,7 +1276,7 @@ update_chat = function (obj) {
shortmsg; shortmsg;
if (obj.new == 1) { if (obj.new == 1) {
document.getElementById( document.getElementById(
`chat-${obj.dxcallsign}-list-displaydxcall` `chat-${obj.dxcallsign}-list-displaydxcall`,
).textContent = "*" + obj.dxcallsign; ).textContent = "*" + obj.dxcallsign;
document document
.getElementById(`chat-${dxcallsign}-list`) .getElementById(`chat-${dxcallsign}-list`)
@ -1416,8 +1419,8 @@ update_chat = function (obj) {
<span class="text-white" id="msg-${ <span class="text-white" id="msg-${
obj._id obj._id
}-status" style="font-size:0.8rem;">${get_icon_for_state( }-status" style="font-size:0.8rem;">${get_icon_for_state(
obj.status obj.status,
)}</span> )}</span>
</p> </p>
<span id="msg-${ <span id="msg-${
obj._id obj._id
@ -1443,7 +1446,7 @@ update_chat = function (obj) {
var progressbar_bg = "bg-danger"; var progressbar_bg = "bg-danger";
var percent_value = "TRANSMISSION FAILED"; var percent_value = "TRANSMISSION FAILED";
//Set to 100 so progressbar background populates //Set to 100 so progressbar background populates
obj.percent=100; obj.percent = 100;
} else if (obj.status == "transmitted") { } else if (obj.status == "transmitted") {
var progressbar_bg = "bg-success"; var progressbar_bg = "bg-success";
var percent_value = "TRANSMITTED"; var percent_value = "TRANSMITTED";
@ -1471,8 +1474,8 @@ update_chat = function (obj) {
<span class="text-white" id="msg-${ <span class="text-white" id="msg-${
obj._id obj._id
}-status" style="font-size:0.8rem;">${get_icon_for_state( }-status" style="font-size:0.8rem;">${get_icon_for_state(
obj.status obj.status,
)}</span> )}</span>
</p> </p>
<span id="msg-${ <span id="msg-${
obj._id obj._id
@ -1485,15 +1488,17 @@ update_chat = function (obj) {
</span> </span>
<div class="progress p-0 m-0 rounded-0 rounded-bottom bg-secondary" style="height: 10px;"> <div class="progress p-0 m-0 rounded-0 rounded-bottom bg-secondary" style="height: 10px;">
<div class="progress-bar progress-bar-striped ${progressbar_bg} p-0 m-0 rounded-0 force-gpu" id="msg-${ <div class="progress-bar progress-bar-striped ${progressbar_bg} p-0 m-0 rounded-0 force-gpu" id="msg-${
obj._id obj._id
}-progress" role="progressbar" style="width: ${ }-progress" role="progressbar" style="width: ${
obj.percent obj.percent
}%;" aria-valuenow="${ }%;" aria-valuenow="${
obj.percent obj.percent
}" aria-valuemin="0" aria-valuemax="100"></div> }" aria-valuemin="0" aria-valuemax="100"></div>
<p class="justify-content-center d-flex position-absolute m-0 p-0 w-100 text-white" style="font-size: xx-small" id="msg-${ <p class="justify-content-center d-flex position-absolute m-0 p-0 w-100 text-white" style="font-size: xx-small" id="msg-${
obj._id obj._id
}-progress-information">${percent_value} - ${obj.bytesperminute} Bpm</p> }-progress-information">${percent_value} - ${
obj.bytesperminute
} Bpm</p>
</div> </div>
</div> </div>
</div> </div>
@ -1527,7 +1532,7 @@ update_chat = function (obj) {
.getElementById("msg-" + obj._id + "-progress") .getElementById("msg-" + obj._id + "-progress")
.setAttribute("style", "width:" + obj.percent + "%;"); .setAttribute("style", "width:" + obj.percent + "%;");
document.getElementById( document.getElementById(
"msg-" + obj._id + "-progress-information" "msg-" + obj._id + "-progress-information",
).innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm"; ).innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm";
document.getElementById("msg-" + obj._id + "-attempts").innerHTML = document.getElementById("msg-" + obj._id + "-attempts").innerHTML =
@ -1546,7 +1551,7 @@ update_chat = function (obj) {
.getElementById("msg-" + obj._id + "-progress") .getElementById("msg-" + obj._id + "-progress")
.setAttribute("style", "width:" + obj.percent + "%;"); .setAttribute("style", "width:" + obj.percent + "%;");
document.getElementById( document.getElementById(
"msg-" + obj._id + "-progress-information" "msg-" + obj._id + "-progress-information",
).innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm"; ).innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm";
} else { } else {
document document
@ -1556,7 +1561,7 @@ update_chat = function (obj) {
.getElementById("msg-" + obj._id + "-progress") .getElementById("msg-" + obj._id + "-progress")
.setAttribute("style", "width:0%;"); .setAttribute("style", "width:0%;");
document.getElementById( document.getElementById(
"msg-" + obj._id + "-progress-information" "msg-" + obj._id + "-progress-information",
).innerHTML = "0% - 0 Bpm"; ).innerHTML = "0% - 0 Bpm";
} }
@ -1578,7 +1583,7 @@ update_chat = function (obj) {
document.getElementById("msg-" + obj._id + "-progress").innerHTML = ""; document.getElementById("msg-" + obj._id + "-progress").innerHTML = "";
document.getElementById( document.getElementById(
"msg-" + obj._id + "-progress-information" "msg-" + obj._id + "-progress-information",
).innerHTML = "TRANSMITTED - " + obj.bytesperminute + " Bpm"; ).innerHTML = "TRANSMITTED - " + obj.bytesperminute + " Bpm";
} else if ( } else if (
obj.status != "broadcast_transmit" || obj.status != "broadcast_transmit" ||
@ -1605,11 +1610,11 @@ update_chat = function (obj) {
.classList.add("bg-danger"); .classList.add("bg-danger");
console.log( console.log(
document.getElementById("msg-" + obj._id + "-progress").classList document.getElementById("msg-" + obj._id + "-progress").classList,
); );
document.getElementById( document.getElementById(
"msg-" + obj._id + "-progress-information" "msg-" + obj._id + "-progress-information",
).innerHTML = "TRANSMISSION FAILED - " + obj.bytesperminute + " Bpm"; ).innerHTML = "TRANSMISSION FAILED - " + obj.bytesperminute + " Bpm";
} }
@ -2461,7 +2466,7 @@ function getSetUserInformation(selected_callsign) {
// Callsign list elements // Callsign list elements
document.getElementById( document.getElementById(
"chat-" + selected_callsign + "-list-dxgrid" "chat-" + selected_callsign + "-list-dxgrid",
).innerHTML = "<small>" + data.user_info_gridsquare + "</small>"; ).innerHTML = "<small>" + data.user_info_gridsquare + "</small>";
document.getElementById("user-image-" + selected_callsign).className = document.getElementById("user-image-" + selected_callsign).className =
"p-1 rounded-circle"; "p-1 rounded-circle";
@ -2524,7 +2529,7 @@ function getSetUserInformation(selected_callsign) {
document.getElementById("user-image-" + selected_callsign).style = document.getElementById("user-image-" + selected_callsign).style =
"height:60px"; "height:60px";
document.getElementById( document.getElementById(
"chat-" + selected_callsign + "-list-dxgrid" "chat-" + selected_callsign + "-list-dxgrid",
).innerHTML = "<small>no grid</small>"; ).innerHTML = "<small>no grid</small>";
// DX Station tab // DX Station tab
@ -2862,13 +2867,13 @@ async function dbClean() {
let beaconKeep = 7; let beaconKeep = 7;
let itemCount = 0; let itemCount = 0;
let timestampPurge = Math.floor( let timestampPurge = Math.floor(
(Date.now() - beaconKeep * 24 * 60 * 60 * 1000) / 1000 (Date.now() - beaconKeep * 24 * 60 * 60 * 1000) / 1000,
); );
if ( if (
confirm( confirm(
"Delete beacons and pings older than " + "Delete beacons and pings older than " +
beaconKeep + beaconKeep +
" days and compact database?" " days and compact database?",
) )
) { ) {
} else { } else {
@ -2911,7 +2916,7 @@ async function dbClean() {
window.alert( window.alert(
"Database maintenance is complete. " + "Database maintenance is complete. " +
itemCount + itemCount +
" items removed from database. It's recommended you now restart the GUI." " items removed from database. It's recommended you now restart the GUI.",
); );
ipcRenderer.send("request-update-dbclean-spinner"); ipcRenderer.send("request-update-dbclean-spinner");
} }

View file

@ -73,7 +73,7 @@ ipcRenderer.on("action-update-log", (event, arg) => {
// https://stackoverflow.com/a/29497680 // https://stackoverflow.com/a/29497680
entry = entry.replace( entry = entry.replace(
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
"" "",
); );
var tbl = document.getElementById("log"); var tbl = document.getElementById("log");

View file

@ -201,7 +201,7 @@ window.addEventListener("DOMContentLoaded", () => {
FD.saveConfig(config, configPath); FD.saveConfig(config, configPath);
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); //fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
} },
); );
}); });
@ -221,7 +221,7 @@ window.addEventListener("DOMContentLoaded", () => {
config.shared_folder_path = data.path.filePaths[0]; config.shared_folder_path = data.path.filePaths[0];
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); //fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
FD.saveConfig(config, configPath); FD.saveConfig(config, configPath);
} },
); );
}); });
@ -245,7 +245,7 @@ window.addEventListener("DOMContentLoaded", () => {
// ENABLE TOOLTIPS EVERYWHERE // ENABLE TOOLTIPS EVERYWHERE
// https://getbootstrap.com/docs/5.1/components/tooltips/ // https://getbootstrap.com/docs/5.1/components/tooltips/
var tooltipTriggerList = [].slice.call( var tooltipTriggerList = [].slice.call(
document.querySelectorAll('[data-bs-toggle="tooltip"]') document.querySelectorAll('[data-bs-toggle="tooltip"]'),
); );
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl); return new bootstrap.Tooltip(tooltipTriggerEl);
@ -397,21 +397,16 @@ window.addEventListener("DOMContentLoaded", () => {
document.getElementById("NotificationSwitch").checked = false; document.getElementById("NotificationSwitch").checked = false;
} }
if(config.enable_mesh_features.toLowerCase() == "true"){ if (config.enable_mesh_features.toLowerCase() == "true") {
document.getElementById("liMeshTable").style.visibility = "visible"; document.getElementById("liMeshTable").style.visibility = "visible";
document.getElementById("liMeshTable").style.display = "block"; document.getElementById("liMeshTable").style.display = "block";
document.getElementById("enableMeshSwitch").checked = true; document.getElementById("enableMeshSwitch").checked = true;
} else { } else {
document.getElementById("liMeshTable").style.visibility = "hidden"; document.getElementById("liMeshTable").style.visibility = "hidden";
document.getElementById("liMeshTable").style.display = "none"; document.getElementById("liMeshTable").style.display = "none";
document.getElementById("enableMeshSwitch").checked = false; document.getElementById("enableMeshSwitch").checked = false;
} }
// theme selector // theme selector
changeGuiDesign(config.theme); changeGuiDesign(config.theme);
@ -419,7 +414,7 @@ window.addEventListener("DOMContentLoaded", () => {
document.getElementById("update_channel_selector").value = document.getElementById("update_channel_selector").value =
config.update_channel; config.update_channel;
document.getElementById("updater_channel").innerHTML = escape( document.getElementById("updater_channel").innerHTML = escape(
config.update_channel config.update_channel,
); );
// Update tuning range fmin fmax // Update tuning range fmin fmax
@ -431,10 +426,10 @@ window.addEventListener("DOMContentLoaded", () => {
// Update TX Audio Level // Update TX Audio Level
document.getElementById("audioLevelTXvalue").innerHTML = parseInt( document.getElementById("audioLevelTXvalue").innerHTML = parseInt(
config.tx_audio_level config.tx_audio_level,
); );
document.getElementById("audioLevelTX").value = parseInt( document.getElementById("audioLevelTX").value = parseInt(
config.tx_audio_level config.tx_audio_level,
); );
// Update RX Buffer Size // Update RX Buffer Size
@ -734,7 +729,7 @@ window.addEventListener("DOMContentLoaded", () => {
.getElementById("hamlib_rigctld_server_port") .getElementById("hamlib_rigctld_server_port")
.addEventListener("change", () => { .addEventListener("change", () => {
config.hamlib_rigctld_server_port = document.getElementById( config.hamlib_rigctld_server_port = document.getElementById(
"hamlib_rigctld_server_port" "hamlib_rigctld_server_port",
).value; ).value;
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); //fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
FD.saveConfig(config, configPath); FD.saveConfig(config, configPath);
@ -809,7 +804,7 @@ window.addEventListener("DOMContentLoaded", () => {
if (document.getElementById("hamlib_handshake").value !== "ignore") { if (document.getElementById("hamlib_handshake").value !== "ignore") {
var hamlib_handshake = document.getElementById("hamlib_handshake").value; var hamlib_handshake = document.getElementById("hamlib_handshake").value;
paramList = paramList.concat( paramList = paramList.concat(
"--set-conf=serial_handshake=" + hamlib_handshake "--set-conf=serial_handshake=" + hamlib_handshake,
); );
} }
@ -838,13 +833,13 @@ window.addEventListener("DOMContentLoaded", () => {
} }
var hamlib_rigctld_server_port = document.getElementById( var hamlib_rigctld_server_port = document.getElementById(
"hamlib_rigctld_server_port" "hamlib_rigctld_server_port",
).value; ).value;
paramList = paramList.concat("--port=" + hamlib_rigctld_server_port); paramList = paramList.concat("--port=" + hamlib_rigctld_server_port);
//Custom rigctld arguments to pass to rigctld //Custom rigctld arguments to pass to rigctld
var hamlib_rigctld_custom_args = document.getElementById( var hamlib_rigctld_custom_args = document.getElementById(
"hamlib_rigctld_custom_args" "hamlib_rigctld_custom_args",
).value; ).value;
paramList = paramList.concat(hamlib_rigctld_custom_args); paramList = paramList.concat(hamlib_rigctld_custom_args);
@ -1006,7 +1001,7 @@ window.addEventListener("DOMContentLoaded", () => {
// on change audio TX Level // on change audio TX Level
document.getElementById("audioLevelTX").addEventListener("change", () => { document.getElementById("audioLevelTX").addEventListener("change", () => {
var tx_audio_level = parseInt( var tx_audio_level = parseInt(
document.getElementById("audioLevelTX").value document.getElementById("audioLevelTX").value,
); );
document.getElementById("audioLevelTXvalue").innerHTML = tx_audio_level; document.getElementById("audioLevelTXvalue").innerHTML = tx_audio_level;
config.tx_audio_level = tx_audio_level; config.tx_audio_level = tx_audio_level;
@ -1263,18 +1258,17 @@ window.addEventListener("DOMContentLoaded", () => {
document.getElementById("enableMeshSwitch").addEventListener("click", () => { document.getElementById("enableMeshSwitch").addEventListener("click", () => {
if (document.getElementById("enableMeshSwitch").checked == true) { if (document.getElementById("enableMeshSwitch").checked == true) {
config.enable_mesh_features = "True"; config.enable_mesh_features = "True";
document.getElementById("liMeshTable").style.visibility = "visible"; document.getElementById("liMeshTable").style.visibility = "visible";
document.getElementById("liMeshTable").style.display = "block"; document.getElementById("liMeshTable").style.display = "block";
} else { } else {
config.enable_mesh_features = "False"; config.enable_mesh_features = "False";
document.getElementById("liMeshTable").style.visibility = "hidden"; document.getElementById("liMeshTable").style.visibility = "hidden";
document.getElementById("liMeshTable").style.display = "none"; document.getElementById("liMeshTable").style.display = "none";
} }
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); //fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
FD.saveConfig(config, configPath); FD.saveConfig(config, configPath);
}); });
// enable is writing switch clicked // enable is writing switch clicked
document.getElementById("enable_is_writing").addEventListener("click", () => { document.getElementById("enable_is_writing").addEventListener("click", () => {
if (document.getElementById("enable_is_writing").checked == true) { if (document.getElementById("enable_is_writing").checked == true) {
@ -1372,7 +1366,7 @@ window.addEventListener("DOMContentLoaded", () => {
.getElementById("update_channel_selector") .getElementById("update_channel_selector")
.addEventListener("change", () => { .addEventListener("change", () => {
config.update_channel = document.getElementById( config.update_channel = document.getElementById(
"update_channel_selector" "update_channel_selector",
).value; ).value;
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); //fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
FD.saveConfig(config, configPath); FD.saveConfig(config, configPath);
@ -1399,7 +1393,7 @@ window.addEventListener("DOMContentLoaded", () => {
document.getElementById("openExplorer").addEventListener("click", () => { document.getElementById("openExplorer").addEventListener("click", () => {
shell.openExternal( shell.openExternal(
"https://explorer.freedata.app/?myCall=" + "https://explorer.freedata.app/?myCall=" +
document.getElementById("myCall").value document.getElementById("myCall").value,
); );
}); });
@ -1438,7 +1432,7 @@ window.addEventListener("DOMContentLoaded", () => {
var tci_port = document.getElementById("tci_port").value; var tci_port = document.getElementById("tci_port").value;
var hamlib_rigctld_server_port = document.getElementById( var hamlib_rigctld_server_port = document.getElementById(
"hamlib_rigctld_server_port" "hamlib_rigctld_server_port",
).value; ).value;
var deviceid = document.getElementById("hamlib_deviceid").value; var deviceid = document.getElementById("hamlib_deviceid").value;
@ -1462,15 +1456,15 @@ window.addEventListener("DOMContentLoaded", () => {
var handshake = document.getElementById("hamlib_handshake").value; var handshake = document.getElementById("hamlib_handshake").value;
var tx_delay = document.getElementById("tx_delay").value; var tx_delay = document.getElementById("tx_delay").value;
if (document.getElementById("enableMeshSwitch").checked == true) { if (document.getElementById("enableMeshSwitch").checked == true) {
var enable_mesh_features = "True"; var enable_mesh_features = "True";
document.getElementById("liMeshTable").style.visibility = "visible"; document.getElementById("liMeshTable").style.visibility = "visible";
document.getElementById("liMeshTable").style.display = "block"; document.getElementById("liMeshTable").style.display = "block";
} else { } else {
var enable_mesh_features = "False"; var enable_mesh_features = "False";
document.getElementById("liMeshTable").style.visibility = "hidden"; document.getElementById("liMeshTable").style.visibility = "hidden";
document.getElementById("liMeshTable").style.display = "none"; document.getElementById("liMeshTable").style.display = "none";
} }
if (document.getElementById("scatterSwitch").checked == true) { if (document.getElementById("scatterSwitch").checked == true) {
var enable_scatter = "True"; var enable_scatter = "True";
@ -1598,7 +1592,7 @@ window.addEventListener("DOMContentLoaded", () => {
) { ) {
if ( if (
!window.confirm( !window.confirm(
"Rig control is set to hamlib/rigctl, but it doesn't appear to be running.\n\nPlease start rigctld (start button in Rig Control area), or use rigctl mode 'none'. If you're having issues starting rigctld please review the Hamlib tab in settings.\n\nClick OK to continue or cancel to abort." "Rig control is set to hamlib/rigctl, but it doesn't appear to be running.\n\nPlease start rigctld (start button in Rig Control area), or use rigctl mode 'none'. If you're having issues starting rigctld please review the Hamlib tab in settings.\n\nClick OK to continue or cancel to abort.",
) )
) { ) {
return; return;
@ -1636,7 +1630,7 @@ window.addEventListener("DOMContentLoaded", () => {
tx_delay, tx_delay,
tci_ip, tci_ip,
tci_port, tci_port,
enable_mesh_features enable_mesh_features,
); );
}); });
@ -1693,7 +1687,7 @@ window.addEventListener("DOMContentLoaded", () => {
stop_bits, stop_bits,
handshake, handshake,
rigctld_ip, rigctld_ip,
rigctld_port rigctld_port,
); );
}); });
@ -1803,20 +1797,14 @@ window.addEventListener("DOMContentLoaded", () => {
resetSortIcon(); resetSortIcon();
}); });
autostart_rigctld();
autostart_rigctld();
}); });
//End of domcontentloaded //End of domcontentloaded
function resetSortIcon() { function resetSortIcon() {
document.getElementById("hslSort").remove(); document.getElementById("hslSort").remove();
let headers = document.querySelectorAll( let headers = document.querySelectorAll(
"#tblHeardStationList > thead > tr > th" "#tblHeardStationList > thead > tr > th",
); );
if (hslLastSortDir == "desc") text = "bi-sort-up"; if (hslLastSortDir == "desc") text = "bi-sort-up";
else text = "bi-sort-down"; else text = "bi-sort-down";
@ -1857,8 +1845,8 @@ function connectedStation(data) {
} }
//Called by chat to turn off db clean spinner //Called by chat to turn off db clean spinner
ipcRenderer.on("action-update-dbclean-spinner",() =>{ ipcRenderer.on("action-update-dbclean-spinner", () => {
document.getElementById("divCleanDBSpinner").classList.add("invisible"); document.getElementById("divCleanDBSpinner").classList.add("invisible");
}); });
//Listen for events caused by tnc 'tnc-message' rx //Listen for events caused by tnc 'tnc-message' rx
ipcRenderer.on("action-update-reception-status", (event, arg) => { ipcRenderer.on("action-update-reception-status", (event, arg) => {
@ -1917,7 +1905,7 @@ ipcRenderer.on("action-update-reception-status", (event, arg) => {
compress = 1; compress = 1;
} }
var arq_bytes_per_minute_compressed = Math.round( var arq_bytes_per_minute_compressed = Math.round(
arq_bytes_per_minute * compress arq_bytes_per_minute * compress,
); );
console.log(arq_bytes_per_minute); console.log(arq_bytes_per_minute);
time_left += time_left +=
@ -1986,7 +1974,7 @@ ipcRenderer.on("action-update-transmission-status", (event, arg) => {
compress = 1; compress = 1;
} }
var arq_bytes_per_minute_compressed = Math.round( var arq_bytes_per_minute_compressed = Math.round(
arq_bytes_per_minute * compress arq_bytes_per_minute * compress,
); );
time_left += time_left +=
@ -2507,7 +2495,7 @@ function updateHeardStations(arg) {
hour: "2-digit", hour: "2-digit",
minute: "2-digit", minute: "2-digit",
second: "2-digit", second: "2-digit",
} },
); );
//var hours = date.getHours(); //var hours = date.getHours();
//var minutes = "0" + date.getMinutes(); //var minutes = "0" + date.getMinutes();
@ -2548,8 +2536,8 @@ function updateHeardStations(arg) {
parseInt( parseInt(
distance( distance(
document.getElementById("myGrid").value, document.getElementById("myGrid").value,
arg.stations[i]["dxgrid"] arg.stations[i]["dxgrid"],
) ),
) + " km"; ) + " km";
} else { } else {
gridDistanceText.innerText = "---"; gridDistanceText.innerText = "---";
@ -2807,22 +2795,22 @@ ipcRenderer.on("action-update-tnc-connection", (event, arg) => {
// collapse settings screen // collapse settings screen
var collapseFirstRow = new bootstrap.Collapse( var collapseFirstRow = new bootstrap.Collapse(
document.getElementById("collapseFirstRow"), document.getElementById("collapseFirstRow"),
{ toggle: false } { toggle: false },
); );
collapseFirstRow.hide(); collapseFirstRow.hide();
var collapseSecondRow = new bootstrap.Collapse( var collapseSecondRow = new bootstrap.Collapse(
document.getElementById("collapseSecondRow"), document.getElementById("collapseSecondRow"),
{ toggle: false } { toggle: false },
); );
collapseSecondRow.hide(); collapseSecondRow.hide();
var collapseThirdRow = new bootstrap.Collapse( var collapseThirdRow = new bootstrap.Collapse(
document.getElementById("collapseThirdRow"), document.getElementById("collapseThirdRow"),
{ toggle: false } { toggle: false },
); );
collapseThirdRow.show(); collapseThirdRow.show();
var collapseFourthRow = new bootstrap.Collapse( var collapseFourthRow = new bootstrap.Collapse(
document.getElementById("collapseFourthRow"), document.getElementById("collapseFourthRow"),
{ toggle: false } { toggle: false },
); );
collapseFourthRow.show(); collapseFourthRow.show();
@ -2848,22 +2836,22 @@ ipcRenderer.on("action-update-tnc-connection", (event, arg) => {
// collapse settings screen // collapse settings screen
var collapseFirstRow = new bootstrap.Collapse( var collapseFirstRow = new bootstrap.Collapse(
document.getElementById("collapseFirstRow"), document.getElementById("collapseFirstRow"),
{ toggle: false } { toggle: false },
); );
collapseFirstRow.show(); collapseFirstRow.show();
var collapseSecondRow = new bootstrap.Collapse( var collapseSecondRow = new bootstrap.Collapse(
document.getElementById("collapseSecondRow"), document.getElementById("collapseSecondRow"),
{ toggle: false } { toggle: false },
); );
collapseSecondRow.show(); collapseSecondRow.show();
var collapseThirdRow = new bootstrap.Collapse( var collapseThirdRow = new bootstrap.Collapse(
document.getElementById("collapseThirdRow"), document.getElementById("collapseThirdRow"),
{ toggle: false } { toggle: false },
); );
collapseThirdRow.hide(); collapseThirdRow.hide();
var collapseFourthRow = new bootstrap.Collapse( var collapseFourthRow = new bootstrap.Collapse(
document.getElementById("collapseFourthRow"), document.getElementById("collapseFourthRow"),
{ toggle: false } { toggle: false },
); );
collapseFourthRow.hide(); collapseFourthRow.hide();
} }
@ -2960,7 +2948,7 @@ ipcRenderer.on("action-update-rx-buffer", (event, arg) => {
}, },
function (err) { function (err) {
console.log(err); console.log(err);
} },
); );
// write file to data folder // write file to data folder
@ -2997,7 +2985,6 @@ ipcRenderer.on("action-update-unread-messages-main", (event, data) => {
}); });
ipcRenderer.on("run-tnc-command", (event, arg) => { ipcRenderer.on("run-tnc-command", (event, arg) => {
if (arg.command == "save_my_call") { if (arg.command == "save_my_call") {
sock.saveMyCall(arg.callsign); sock.saveMyCall(arg.callsign);
} }
@ -3016,7 +3003,7 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
arg.filename, arg.filename,
arg.filetype, arg.filetype,
arg.data, arg.data,
arg.checksum arg.checksum,
); );
} }
if (arg.command == "msg") { if (arg.command == "msg") {
@ -3027,7 +3014,7 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
arg.data, arg.data,
arg.checksum, arg.checksum,
arg.uuid, arg.uuid,
arg.command arg.command,
); );
} }
if (arg.command == "broadcast") { if (arg.command == "broadcast") {
@ -3078,11 +3065,9 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
sock.sendResponseSharedFile(arg.dxcallsign, arg.file, arg.filedata); sock.sendResponseSharedFile(arg.dxcallsign, arg.file, arg.filedata);
} }
if (arg.command == "mesh_ping") { if (arg.command == "mesh_ping") {
sock.sendMeshPing(arg.dxcallsign); sock.sendMeshPing(arg.dxcallsign);
} }
}); });
// IPC ACTION FOR AUTO UPDATER // IPC ACTION FOR AUTO UPDATER
@ -3113,7 +3098,7 @@ ipcRenderer.on("action-updater", (event, arg) => {
config.myCall, config.myCall,
config.tnc_host, config.tnc_host,
config.tnc_port, config.tnc_port,
" -v " + arg.version " -v " + arg.version,
); );
document.getElementById("updater_status").innerHTML = document.getElementById("updater_status").innerHTML =
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>'; '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>';
@ -3165,7 +3150,7 @@ ipcRenderer.on("action-show-cq-toast-transmitting", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "transmitting cq"), (content = "transmitting cq"),
(duration = 5000) (duration = 5000),
); );
}); });
// fec iswriting received // fec iswriting received
@ -3176,7 +3161,7 @@ ipcRenderer.on("action-show-fec-toast-iswriting", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-pencil-fill"), (icon = "bi-pencil-fill"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
// CQ RECEIVED // CQ RECEIVED
@ -3189,7 +3174,7 @@ ipcRenderer.on("action-show-cq-toast-received", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3199,7 +3184,7 @@ ipcRenderer.on("action-show-qrv-toast-transmitting", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "transmitting qrv"), (content = "transmitting qrv"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3214,7 +3199,7 @@ ipcRenderer.on("action-show-qrv-toast-received", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3224,7 +3209,7 @@ ipcRenderer.on("action-show-beacon-toast-transmitting", (event, data) => {
(type = "info"), (type = "info"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "transmitting beacon"), (content = "transmitting beacon"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3238,7 +3223,7 @@ ipcRenderer.on("action-show-beacon-toast-received", (event, data) => {
(type = "info"), (type = "info"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3248,7 +3233,7 @@ ipcRenderer.on("action-show-ping-toast-transmitting", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "transmitting ping"), (content = "transmitting ping"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3261,7 +3246,7 @@ ipcRenderer.on("action-show-ping-toast-received", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3275,7 +3260,7 @@ ipcRenderer.on("action-show-ping-toast-received-ack", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-check"), (icon = "bi-check"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3288,7 +3273,7 @@ ipcRenderer.on("action-show-arq-toast-datachannel-opening", (event, data) => {
(type = "secondary"), (type = "secondary"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3298,7 +3283,7 @@ ipcRenderer.on("action-show-arq-toast-datachannel-waiting", (event, data) => {
(type = "warning"), (type = "warning"),
(icon = "bi-smartwatch"), (icon = "bi-smartwatch"),
(content = "channel busy - waiting..."), (content = "channel busy - waiting..."),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3308,7 +3293,7 @@ ipcRenderer.on("action-show-arq-toast-datachannel-open", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "datachannel open"), (content = "datachannel open"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3323,9 +3308,9 @@ ipcRenderer.on(
(type = "success"), (type = "success"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = content), (content = content),
(duration = 5000) (duration = 5000),
); );
} },
); );
// ARQ TRANSMISSION FAILED // ARQ TRANSMISSION FAILED
@ -3335,7 +3320,7 @@ ipcRenderer.on("action-show-arq-toast-transmission-failed", (event, data) => {
(type = "danger"), (type = "danger"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "transmission failed"), (content = "transmission failed"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3347,9 +3332,9 @@ ipcRenderer.on(
(type = "danger"), (type = "danger"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "protocol version missmatch"), (content = "protocol version missmatch"),
(duration = 5000) (duration = 5000),
); );
} },
); );
// ARQ TRANSMISSION STOPPED // ARQ TRANSMISSION STOPPED
@ -3359,7 +3344,7 @@ ipcRenderer.on("action-show-arq-toast-transmission-stopped", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "transmission stopped"), (content = "transmission stopped"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3370,7 +3355,7 @@ ipcRenderer.on("action-show-arq-toast-transmission-failed", (event, data) => {
(type = "danger"), (type = "danger"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "arq transmission failed"), (content = "arq transmission failed"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3384,9 +3369,9 @@ ipcRenderer.on(
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "data transmitted"), (content = "data transmitted"),
(duration = 5000) (duration = 5000),
); );
} },
); );
// ARQ TRANSMISSION TRANSMITTING // ARQ TRANSMISSION TRANSMITTING
@ -3400,21 +3385,21 @@ ipcRenderer.on(
(type = "warning"), (type = "warning"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "low link margin: <strong>" + irs_snr + " dB</strong>"), (content = "low link margin: <strong>" + irs_snr + " dB</strong>"),
(duration = 5000) (duration = 5000),
); );
} else if (irs_snr > 0 && irs_snr <= 5) { } else if (irs_snr > 0 && irs_snr <= 5) {
displayToast( displayToast(
(type = "warning"), (type = "warning"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "medium link margin: <strong>" + irs_snr + " dB</strong>"), (content = "medium link margin: <strong>" + irs_snr + " dB</strong>"),
(duration = 5000) (duration = 5000),
); );
} else if (irs_snr > 5 && irs_snr < 12.7) { } else if (irs_snr > 5 && irs_snr < 12.7) {
displayToast( displayToast(
(type = "success"), (type = "success"),
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = "high link margin: <strong>" + irs_snr + " dB</strong>"), (content = "high link margin: <strong>" + irs_snr + " dB</strong>"),
(duration = 5000) (duration = 5000),
); );
} else if (irs_snr >= 12.7) { } else if (irs_snr >= 12.7) {
displayToast( displayToast(
@ -3422,12 +3407,12 @@ ipcRenderer.on(
(icon = "bi-broadcast"), (icon = "bi-broadcast"),
(content = (content =
"very high link margin: <strong>" + irs_snr + " dB</strong>"), "very high link margin: <strong>" + irs_snr + " dB</strong>"),
(duration = 5000) (duration = 5000),
); );
} else { } else {
//displayToast(type='info', icon='bi-broadcast', content='no snr information', duration=5000); //displayToast(type='info', icon='bi-broadcast', content='no snr information', duration=5000);
} }
} },
); );
// ARQ TRANSMISSION RECEIVED // ARQ TRANSMISSION RECEIVED
@ -3437,7 +3422,7 @@ ipcRenderer.on("action-show-arq-toast-transmission-received", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-check-circle"), (icon = "bi-check-circle"),
(content = "all data received"), (content = "all data received"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3449,9 +3434,9 @@ ipcRenderer.on(
(type = "primary"), (type = "primary"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "session receiving"), (content = "session receiving"),
(duration = 5000) (duration = 5000),
); );
} },
); );
// ARQ SESSION CONNECTING // ARQ SESSION CONNECTING
@ -3460,7 +3445,7 @@ ipcRenderer.on("action-show-arq-toast-session-connecting", (event, data) => {
(type = "primary"), (type = "primary"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "connecting..."), (content = "connecting..."),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3470,7 +3455,7 @@ ipcRenderer.on("action-show-arq-toast-session-connected", (event, data) => {
(type = "success"), (type = "success"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "session connected"), (content = "session connected"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3480,7 +3465,7 @@ ipcRenderer.on("action-show-arq-toast-session-waiting", (event, data) => {
(type = "warning"), (type = "warning"),
(icon = "bi-smartwatch"), (icon = "bi-smartwatch"),
(content = "session waiting..."), (content = "session waiting..."),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3490,7 +3475,7 @@ ipcRenderer.on("action-show-arq-toast-session-close", (event, data) => {
(type = "warning"), (type = "warning"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "session close"), (content = "session close"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3500,7 +3485,7 @@ ipcRenderer.on("action-show-arq-toast-session-failed", (event, data) => {
(type = "danger"), (type = "danger"),
(icon = "bi-arrow-left-right"), (icon = "bi-arrow-left-right"),
(content = "session failed"), (content = "session failed"),
(duration = 5000) (duration = 5000),
); );
}); });
@ -3565,7 +3550,7 @@ function updateTitle(
mycall = config.mycall, mycall = config.mycall,
tnc = config.tnc_host, tnc = config.tnc_host,
tncport = config.tnc_port, tncport = config.tnc_port,
appender = "" appender = "",
) { ) {
//Multiple consecutive spaces get converted to a single space //Multiple consecutive spaces get converted to a single space
var title = var title =
@ -3657,7 +3642,7 @@ function displayToast(
type = "primary", type = "primary",
icon = "bi-info", icon = "bi-info",
content = "default", content = "default",
duration = 5000 duration = 5000,
) { ) {
mainToastContainer = document.getElementById("mainToastContainer"); mainToastContainer = document.getElementById("mainToastContainer");

View file

@ -13,176 +13,164 @@ const config = require(configPath);
// WINDOW LISTENER // WINDOW LISTENER
window.addEventListener("DOMContentLoaded", () => { window.addEventListener("DOMContentLoaded", () => {
// startPing button clicked // startPing button clicked
document.getElementById("transmit_mesh_ping").addEventListener("click", () => { document
var dxcallsign = document.getElementById("dxCallMesh").value.toUpperCase(); .getElementById("transmit_mesh_ping")
if (dxcallsign == "" || dxcallsign == null || dxcallsign == undefined) .addEventListener("click", () => {
return; var dxcallsign = document
//pauseButton(document.getElementById("transmit_mesh_ping"), 2000); .getElementById("dxCallMesh")
ipcRenderer.send("run-tnc-command", { .value.toUpperCase();
command: "mesh_ping", if (dxcallsign == "" || dxcallsign == null || dxcallsign == undefined)
dxcallsign: dxcallsign, return;
//pauseButton(document.getElementById("transmit_mesh_ping"), 2000);
ipcRenderer.send("run-tnc-command", {
command: "mesh_ping",
dxcallsign: dxcallsign,
});
}); });
});
}); });
ipcRenderer.on("action-update-mesh-table", (event, arg) => { ipcRenderer.on("action-update-mesh-table", (event, arg) => {
var routes = arg.routing_table; var routes = arg.routing_table;
if (typeof routes == "undefined") { if (typeof routes == "undefined") {
return; return;
} }
var tbl = document.getElementById("mesh-table");
var tbl = document.getElementById("mesh-table"); if (tbl !== null) {
if (tbl !== null) { tbl.innerHTML = "";
tbl.innerHTML = "";
} }
for (i = 0; i < routes.length; i++) {
for (i = 0; i < routes.length; i++) { var row = document.createElement("tr");
var row = document.createElement("tr");
var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString( var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString(
navigator.language,{ navigator.language,
hourCycle: 'h23', {
hourCycle: "h23",
year: "numeric", year: "numeric",
month: "2-digit", month: "2-digit",
day: "2-digit", day: "2-digit",
hour: "2-digit", hour: "2-digit",
minute: "2-digit", minute: "2-digit",
second: "2-digit" second: "2-digit",
} },
); );
var timestamp = document.createElement("td"); var timestamp = document.createElement("td");
var timestampText = document.createElement("span"); var timestampText = document.createElement("span");
timestampText.innerText = datetime; timestampText.innerText = datetime;
timestamp.appendChild(timestampText); timestamp.appendChild(timestampText);
var dxcall = document.createElement("td"); var dxcall = document.createElement("td");
var dxcallText = document.createElement("span"); var dxcallText = document.createElement("span");
dxcallText.innerText = routes[i]["dxcall"]; dxcallText.innerText = routes[i]["dxcall"];
dxcall.appendChild(dxcallText); dxcall.appendChild(dxcallText);
var router = document.createElement("td"); var router = document.createElement("td");
var routerText = document.createElement("span"); var routerText = document.createElement("span");
routerText.innerText = routes[i]["router"]; routerText.innerText = routes[i]["router"];
router.appendChild(routerText); router.appendChild(routerText);
var hops = document.createElement("td"); var hops = document.createElement("td");
var hopsText = document.createElement("span"); var hopsText = document.createElement("span");
hopsText.innerText = routes[i]["hops"]; hopsText.innerText = routes[i]["hops"];
hops.appendChild(hopsText); hops.appendChild(hopsText);
var score = document.createElement("td"); var score = document.createElement("td");
var scoreText = document.createElement("span"); var scoreText = document.createElement("span");
scoreText.innerText = routes[i]["score"]; scoreText.innerText = routes[i]["score"];
score.appendChild(scoreText); score.appendChild(scoreText);
var snr = document.createElement("td"); var snr = document.createElement("td");
var snrText = document.createElement("span"); var snrText = document.createElement("span");
snrText.innerText = routes[i]["snr"]; snrText.innerText = routes[i]["snr"];
snr.appendChild(snrText); snr.appendChild(snrText);
row.appendChild(timestamp); row.appendChild(timestamp);
row.appendChild(dxcall); row.appendChild(dxcall);
row.appendChild(router); row.appendChild(router);
row.appendChild(hops); row.appendChild(hops);
row.appendChild(score); row.appendChild(score);
row.appendChild(snr); row.appendChild(snr);
tbl.appendChild(row);
}
tbl.appendChild(row);
}
/*-------------------------------------------*/ /*-------------------------------------------*/
var routes = arg.mesh_signalling_table; var routes = arg.mesh_signalling_table;
console.log(routes) console.log(routes);
if (typeof routes == "undefined") { if (typeof routes == "undefined") {
return; return;
} }
var tbl = document.getElementById("mesh-signalling-table");
var tbl = document.getElementById("mesh-signalling-table"); if (tbl !== null) {
if (tbl !== null) { tbl.innerHTML = "";
tbl.innerHTML = "";
} }
for (i = 0; i < routes.length; i++) {
for (i = 0; i < routes.length; i++) { var row = document.createElement("tr");
var row = document.createElement("tr");
var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString( var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString(
navigator.language,{ navigator.language,
hourCycle: 'h23', {
hourCycle: "h23",
year: "numeric", year: "numeric",
month: "2-digit", month: "2-digit",
day: "2-digit", day: "2-digit",
hour: "2-digit", hour: "2-digit",
minute: "2-digit", minute: "2-digit",
second: "2-digit" second: "2-digit",
} },
); );
var timestamp = document.createElement("td"); var timestamp = document.createElement("td");
var timestampText = document.createElement("span"); var timestampText = document.createElement("span");
timestampText.innerText = datetime; timestampText.innerText = datetime;
timestamp.appendChild(timestampText); timestamp.appendChild(timestampText);
var destination = document.createElement("td"); var destination = document.createElement("td");
var destinationText = document.createElement("span"); var destinationText = document.createElement("span");
destinationText.innerText = routes[i]["destination"]; destinationText.innerText = routes[i]["destination"];
destination.appendChild(destinationText); destination.appendChild(destinationText);
var router = document.createElement("td"); var router = document.createElement("td");
var routerText = document.createElement("span"); var routerText = document.createElement("span");
routerText.innerText = routes[i]["router"]; routerText.innerText = routes[i]["router"];
router.appendChild(routerText); router.appendChild(routerText);
var frametype = document.createElement("td"); var frametype = document.createElement("td");
var frametypeText = document.createElement("span"); var frametypeText = document.createElement("span");
frametypeText.innerText = routes[i]["frametype"]; frametypeText.innerText = routes[i]["frametype"];
frametype.appendChild(frametypeText); frametype.appendChild(frametypeText);
var payload = document.createElement("td"); var payload = document.createElement("td");
var payloadText = document.createElement("span"); var payloadText = document.createElement("span");
payloadText.innerText = routes[i]["payload"]; payloadText.innerText = routes[i]["payload"];
payload.appendChild(payloadText); payload.appendChild(payloadText);
var attempt = document.createElement("td"); var attempt = document.createElement("td");
var attemptText = document.createElement("span"); var attemptText = document.createElement("span");
attemptText.innerText = routes[i]["attempt"]; attemptText.innerText = routes[i]["attempt"];
attempt.appendChild(attemptText); attempt.appendChild(attemptText);
var status = document.createElement("td"); var status = document.createElement("td");
var statusText = document.createElement("span"); var statusText = document.createElement("span");
statusText.innerText = routes[i]["status"]; statusText.innerText = routes[i]["status"];
status.appendChild(statusText); status.appendChild(statusText);
row.appendChild(timestamp);
row.appendChild(destination);
row.appendChild(router);
row.appendChild(frametype);
row.appendChild(payload);
row.appendChild(attempt);
row.appendChild(status);
row.appendChild(timestamp); tbl.appendChild(row);
row.appendChild(destination); }
row.appendChild(router);
row.appendChild(frametype);
row.appendChild(payload);
row.appendChild(attempt);
row.appendChild(status);
tbl.appendChild(row); if (tbl !== null) {
} // scroll to bottom of page
// https://stackoverflow.com/a/11715670
//window.scrollTo(0, document.body.scrollHeight);
if (tbl !== null) {
// scroll to bottom of page
// https://stackoverflow.com/a/11715670
//window.scrollTo(0, document.body.scrollHeight);
} }
}); });

View file

@ -397,7 +397,7 @@ client.on("data", function (socketdata) {
} else { } else {
ipcRenderer.send( ipcRenderer.send(
"request-show-arq-toast-datachannel-received-opener", "request-show-arq-toast-datachannel-received-opener",
{ data: [data] } { data: [data] },
); );
ipcRenderer.send("request-update-reception-status", { ipcRenderer.send("request-update-reception-status", {
data: [data], data: [data],
@ -425,7 +425,7 @@ client.on("data", function (socketdata) {
if (data["reason"] == "protocol version missmatch") { if (data["reason"] == "protocol version missmatch") {
ipcRenderer.send( ipcRenderer.send(
"request-show-arq-toast-transmission-failed-ver", "request-show-arq-toast-transmission-failed-ver",
{ data: [data] } { data: [data] },
); );
} else { } else {
ipcRenderer.send("request-show-arq-toast-transmission-failed", { ipcRenderer.send("request-show-arq-toast-transmission-failed", {
@ -492,7 +492,7 @@ client.on("data", function (socketdata) {
// ARQ transmitting // ARQ transmitting
ipcRenderer.send( ipcRenderer.send(
"request-show-arq-toast-transmission-transmitting", "request-show-arq-toast-transmission-transmitting",
{ data: [data] } { data: [data] },
); );
ipcRenderer.send("request-update-transmission-status", { ipcRenderer.send("request-update-transmission-status", {
data: [data], data: [data],
@ -503,7 +503,7 @@ client.on("data", function (socketdata) {
// ARQ transmitted // ARQ transmitted
ipcRenderer.send( ipcRenderer.send(
"request-show-arq-toast-transmission-transmitted", "request-show-arq-toast-transmission-transmitted",
{ data: [data] } { data: [data] },
); );
ipcRenderer.send("request-update-transmission-status", { ipcRenderer.send("request-update-transmission-status", {
data: [data], data: [data],
@ -618,7 +618,7 @@ exports.sendFile = function (
filename, filename,
filetype, filetype,
data, data,
checksum checksum,
) { ) {
socketLog.info(data); socketLog.info(data);
socketLog.info(filetype); socketLog.info(filetype);
@ -664,7 +664,7 @@ exports.sendMessage = function (
data, data,
checksum, checksum,
uuid, uuid,
command command,
) { ) {
data = FD.btoa_FD( data = FD.btoa_FD(
"m" + "m" +
@ -675,7 +675,7 @@ exports.sendMessage = function (
split_char + split_char +
uuid + uuid +
split_char + split_char +
data data,
); );
command = command =
'{"type" : "arq", "command" : "send_raw", "uuid" : "' + '{"type" : "arq", "command" : "send_raw", "uuid" : "' +
@ -776,13 +776,13 @@ exports.sendResponseSharedFolderList = function (dxcallsign, sharedFolderList) {
exports.sendResponseSharedFile = function ( exports.sendResponseSharedFile = function (
dxcallsign, dxcallsign,
sharedFile, sharedFile,
sharedFileData sharedFileData,
) { ) {
console.log( console.log(
"In sendResponseSharedFile", "In sendResponseSharedFile",
dxcallsign, dxcallsign,
sharedFile, sharedFile,
sharedFileData sharedFileData,
); );
//Command 0 = user/station information //Command 0 = user/station information
//Command 1 = shared folder list //Command 1 = shared folder list
@ -862,8 +862,6 @@ exports.sendFecIsWriting = function (mycallsign) {
writeTncCommand(command); writeTncCommand(command);
}; };
// SEND FEC TO BROADCASTCHANNEL // SEND FEC TO BROADCASTCHANNEL
exports.sendBroadcastChannel = function (channel, data_out, uuid) { exports.sendBroadcastChannel = function (channel, data_out, uuid) {
let checksum = ""; let checksum = "";
@ -877,7 +875,7 @@ exports.sendBroadcastChannel = function (channel, data_out, uuid) {
split_char + split_char +
uuid + uuid +
split_char + split_char +
data_out data_out,
); );
console.log(data.length); console.log(data.length);
let payload = data; let payload = data;

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en" data-bs-theme="light"> <html lang="en" data-bs-theme="light">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en" data-bs-theme="light"> <html lang="en" data-bs-theme="light">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->
@ -216,17 +216,17 @@
</button> </button>
</li> </li>
<li> <li>
<button class="dropdown-item" id="tncLog" type="button"> <button class="dropdown-item" id="tncLog" type="button">
<i class="bi bi-card-text me-2"></i> <i class="bi bi-card-text me-2"></i>
TNC Live Logs TNC Live Logs
</button> </button>
</li> </li>
<li id="liMeshTable"> <li id="liMeshTable">
<button class="dropdown-item" id="meshtable" type="button"> <button class="dropdown-item" id="meshtable" type="button">
<i class="bi bi-rocket-takeoff me-2"></i> <i class="bi bi-rocket-takeoff me-2"></i>
Mesh Table Prototype Mesh Table Prototype
</button> </button>
</li> </li>
<li> <li>
<button <button
class="dropdown-item" class="dropdown-item"
@ -3805,7 +3805,9 @@
</label> </label>
</div> </div>
<div class="input-group input-group-sm mb-1"> <div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable MESH protocol</label> <label class="input-group-text w-50"
>Enable MESH protocol</label
>
<label class="input-group-text w-50"> <label class="input-group-text w-50">
<div class="form-check form-switch form-check-inline ms-2"> <div class="form-check form-switch form-check-inline ms-2">
<input <input
@ -3829,9 +3831,13 @@
id="btnCleanDB" id="btnCleanDB"
type="button" type="button"
> >
Clean Clean</button
</button>&nbsp; >&nbsp;
<div class="spinner-border text-warning invisible" role="status" id="divCleanDBSpinner"></div> <div
class="spinner-border text-warning invisible"
role="status"
id="divCleanDBSpinner"
></div>
</label> </label>
</div> </div>
<div class="center"> <div class="center">

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->
@ -20,25 +20,25 @@
<!-- chart.js --> <!-- chart.js -->
<nav class="navbar fixed-top bg-light ms-2 me-2"> <nav class="navbar fixed-top bg-light ms-2 me-2">
<div class="input-group">
<div class="input-group"> <input
<input type="text"
type="text" class="form-control"
class="form-control" style="max-width: 6rem; text-transform: uppercase"
style="max-width: 6rem; text-transform: uppercase" placeholder="DXcall"
placeholder="DXcall" pattern="[A-Z]*"
pattern="[A-Z]*" id="dxCallMesh"
id="dxCallMesh" maxlength="11"
maxlength="11" aria-label="Input group"
aria-label="Input group" aria-describedby="btnGroupAddon"
aria-describedby="btnGroupAddon" />
/> <button id="transmit_mesh_ping" type="button" class="btn btn-primary">
<button id="transmit_mesh_ping" type="button" class="btn btn-primary">mesh ping</button> mesh ping
</div> </button>
</div>
</nav> </nav>
<div class="container-fluid h-100 mt-5"> <div class="container-fluid h-100 mt-5">
<div class="tableFixHead h-50"> <div class="tableFixHead h-50">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
@ -52,7 +52,7 @@
</tr> </tr>
</thead> </thead>
<tbody id="mesh-table"> <tbody id="mesh-table">
<!-- ... --> <!-- ... -->
</tbody> </tbody>
</table> </table>
</div> </div>
@ -70,8 +70,7 @@
<th scope="col">Status</th> <th scope="col">Status</th>
</tr> </tr>
</thead> </thead>
<tbody id="mesh-signalling-table"> <tbody id="mesh-signalling-table"></tbody>
</tbody>
</table> </table>
</div> </div>
</div> </div>

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />