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,23 +460,19 @@ window.addEventListener("DOMContentLoaded", () => {
} }
var timestamp = Math.floor(Date.now() / 1000); var timestamp = Math.floor(Date.now() / 1000);
// check if broadcast // check if broadcast
dxcallsign.starts dxcallsign.starts;
if (dxcallsign.startsWith('BC-')) { if (dxcallsign.startsWith("BC-")) {
var tnc_command = "broadcast" var tnc_command = "broadcast";
let Data = { let Data = {
command: tnc_command, command: tnc_command,
broadcastChannel: dxcallsign, broadcastChannel: dxcallsign,
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 =
@ -510,8 +506,6 @@ window.addEventListener("DOMContentLoaded", () => {
ipcRenderer.send("run-tnc-command", Data); ipcRenderer.send("run-tnc-command", Data);
} }
db.post({ db.post({
_id: uuid, _id: uuid,
timestamp: timestamp, timestamp: timestamp,

View file

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

View file

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