Prettified Code!

This commit is contained in:
DJ2LS 2023-05-14 17:45:07 +00:00 committed by GitHub Action
parent c7a9a6c1f1
commit 66ab3f4e21
3 changed files with 45 additions and 58 deletions

View file

@ -460,57 +460,51 @@ window.addEventListener("DOMContentLoaded", () => {
}
var timestamp = Math.floor(Date.now() / 1000);
// check if broadcast
dxcallsign.starts
if (dxcallsign.startsWith('BC-')) {
var tnc_command = "broadcast"
dxcallsign.starts;
if (dxcallsign.startsWith("BC-")) {
var tnc_command = "broadcast";
let Data = {
command: tnc_command,
broadcastChannel: dxcallsign,
data: chatmessage,
};
ipcRenderer.send("run-tnc-command", Data);
command: tnc_command,
broadcastChannel: dxcallsign,
data: chatmessage,
};
ipcRenderer.send("run-tnc-command", Data);
} else {
var file_checksum = crc32(file).toString(16).toUpperCase();
var tnc_command = "msg"
var file_checksum = crc32(file).toString(16).toUpperCase();
console.log(file_checksum);
var data_with_attachment =
timestamp +
split_char +
chatmessage +
split_char +
filename +
split_char +
filetype +
split_char +
file;
var file_checksum = crc32(file).toString(16).toUpperCase();
var tnc_command = "msg";
var file_checksum = crc32(file).toString(16).toUpperCase();
console.log(file_checksum);
var data_with_attachment =
timestamp +
split_char +
chatmessage +
split_char +
filename +
split_char +
filetype +
split_char +
file;
document.getElementById("selectFilesButton").innerHTML = ``;
var uuid = uuidv4();
let uuidlast = uuid.lastIndexOf("-");
uuidlast += 1;
if (uuidlast > 0) {
uuid = uuid.substring(uuidlast);
document.getElementById("selectFilesButton").innerHTML = ``;
var uuid = uuidv4();
let uuidlast = uuid.lastIndexOf("-");
uuidlast += 1;
if (uuidlast > 0) {
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({
_id: uuid,

View file

@ -2786,11 +2786,8 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
arg.command
);
}
if (arg.command == "broadcast") {
sock.sendBroadcastChannel(
arg.broadcastChannel,
arg.data
);
if (arg.command == "broadcast") {
sock.sendBroadcastChannel(arg.broadcastChannel, arg.data);
}
if (arg.command == "stop_transmission") {
sock.stopTransmission();

View file

@ -837,10 +837,9 @@ exports.sendFecIsWriting = function (mycallsign) {
// SEND FEC TO BROADCASTCHANNEL
exports.sendBroadcastChannel = function (channel, data) {
let checksum = ''
let uuid = ''
let command = ''
let checksum = "";
let uuid = "";
let command = "";
data = FD.btoa_FD(
"m" +
split_char +
@ -853,8 +852,6 @@ exports.sendBroadcastChannel = function (channel, data) {
data
);
let payload = data;
command =
'{"type" : "fec", "command" : "transmit", "mode": "datac4", "wakeup": "True", "payload" : "' +
@ -863,7 +860,6 @@ exports.sendBroadcastChannel = function (channel, data) {
writeTncCommand(command);
};
// RECORD AUDIO
exports.record_audio = function () {
command = '{"type" : "set", "command" : "record_audio"}';