Prettified Code!

This commit is contained in:
DJ2LS 2023-05-14 12:36:49 +00:00 committed by GitHub Action
parent fd21b8b71b
commit e62cac90de

View file

@ -460,57 +460,50 @@ window.addEventListener("DOMContentLoaded", () => {
} }
var timestamp = Math.floor(Date.now() / 1000); var timestamp = Math.floor(Date.now() / 1000);
// check if broadcast // check if broadcast
if (dxcallsign == 'broadcast') { if (dxcallsign == "broadcast") {
var tnc_command = "broadcast";
var tnc_command = "broadcast"
let Data = { let Data = {
command: tnc_command, command: tnc_command,
data: chatmessage, data: chatmessage,
}; };
ipcRenderer.send("run-tnc-command", Data); ipcRenderer.send("run-tnc-command", Data);
} else { } else {
var file_checksum = crc32(file).toString(16).toUpperCase(); var file_checksum = crc32(file).toString(16).toUpperCase();
var tnc_command = "msg" var tnc_command = "msg";
var file_checksum = crc32(file).toString(16).toUpperCase(); var file_checksum = crc32(file).toString(16).toUpperCase();
console.log(file_checksum); console.log(file_checksum);
var data_with_attachment = var data_with_attachment =
timestamp + timestamp +
split_char + split_char +
chatmessage + chatmessage +
split_char + split_char +
filename + filename +
split_char + split_char +
filetype + filetype +
split_char + split_char +
file; file;
document.getElementById("selectFilesButton").innerHTML = ``; document.getElementById("selectFilesButton").innerHTML = ``;
var uuid = uuidv4(); var uuid = uuidv4();
let uuidlast = uuid.lastIndexOf("-"); let uuidlast = uuid.lastIndexOf("-");
uuidlast += 1; uuidlast += 1;
if (uuidlast > 0) { if (uuidlast > 0) {
uuid = uuid.substring(uuidlast); uuid = uuid.substring(uuidlast);
}
console.log(data_with_attachment);
let Data = {
command: tnc_command,
dxcallsign: dxcallsign,
mode: 255,
frames: 5,
data: data_with_attachment,
checksum: file_checksum,
uuid: uuid,
};
ipcRenderer.send("run-tnc-command", Data);
} }
console.log(data_with_attachment);
let Data = {
command: tnc_command,
dxcallsign: dxcallsign,
mode: 255,
frames: 5,
data: data_with_attachment,
checksum: file_checksum,
uuid: uuid,
};
ipcRenderer.send("run-tnc-command", Data);
}
db.post({ db.post({
_id: uuid, _id: uuid,