mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Prettified Code!
This commit is contained in:
parent
8c99edf2a7
commit
ff8c41fa91
|
@ -694,8 +694,7 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
|
||||
console.log(splitted_data);
|
||||
|
||||
if(splitted_data[1] == 'msg'){
|
||||
|
||||
if (splitted_data[1] == "msg") {
|
||||
obj.timestamp = parseInt(splitted_data[4]);
|
||||
obj.dxcallsign = item.dxcallsign;
|
||||
obj.dxgrid = item.dxgrid;
|
||||
|
@ -712,8 +711,7 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
obj.filetype = splitted_data[7];
|
||||
//obj.file = btoa(splitted_data[8]);
|
||||
obj.file = btoa_FD(splitted_data[8]);
|
||||
|
||||
} else if (splitted_data[1] == 'req') {
|
||||
} else if (splitted_data[1] == "req") {
|
||||
obj.uuid = uuidv4().toString();
|
||||
obj.timestamp = Math.floor(Date.now() / 1000);
|
||||
obj.dxcallsign = item.dxcallsign;
|
||||
|
@ -726,9 +724,8 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
obj.filetype = "null";
|
||||
obj.file = "null";
|
||||
|
||||
sendUserData(item.dxcallsign)
|
||||
|
||||
} else if (splitted_data[1] == 'res') {
|
||||
sendUserData(item.dxcallsign);
|
||||
} else if (splitted_data[1] == "res") {
|
||||
obj.uuid = uuidv4().toString();
|
||||
obj.timestamp = Math.floor(Date.now() / 1000);
|
||||
obj.dxcallsign = item.dxcallsign;
|
||||
|
@ -741,8 +738,7 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
obj.filetype = "null";
|
||||
obj.file = "null";
|
||||
|
||||
|
||||
console.log(splitted_data)
|
||||
console.log(splitted_data);
|
||||
let userData = new Object();
|
||||
userData.user_info_image = splitted_data[2];
|
||||
userData.user_info_callsign = config.mycall;
|
||||
|
@ -758,7 +754,6 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
|||
|
||||
addUserToDatabaseIfNotExists(userData);
|
||||
getSetUserInformation(config.mycall);
|
||||
|
||||
}
|
||||
|
||||
add_obj_to_database(obj);
|
||||
|
@ -982,7 +977,6 @@ update_chat = function (obj) {
|
|||
`;
|
||||
}
|
||||
|
||||
|
||||
if (obj.type == "newchat") {
|
||||
var new_message = `
|
||||
<div class="p-0 rounded m-auto mt-1 w-50 bg-light bg-gradient" id="msg-${obj._id}">
|
||||
|
@ -1382,7 +1376,7 @@ update_chat_obj_by_uuid = function (uuid) {
|
|||
};
|
||||
|
||||
add_obj_to_database = function (obj) {
|
||||
console.log(obj)
|
||||
console.log(obj);
|
||||
db.put({
|
||||
_id: obj.uuid,
|
||||
timestamp: parseInt(obj.timestamp),
|
||||
|
@ -1775,9 +1769,7 @@ function getSetUserInformation(selected_callsign) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sendUserData(dxcallsign){
|
||||
function sendUserData(dxcallsign) {
|
||||
const userInfoFields = [
|
||||
"user_info_image",
|
||||
"user_info_callsign",
|
||||
|
@ -1792,7 +1784,7 @@ function sendUserData(dxcallsign){
|
|||
"user_info_comments",
|
||||
];
|
||||
|
||||
let info = '';
|
||||
let info = "";
|
||||
userInfoFields.forEach(function (subelem) {
|
||||
if (subelem !== "user_info_image") {
|
||||
info += document.getElementById(subelem).value;
|
||||
|
@ -1803,15 +1795,11 @@ function sendUserData(dxcallsign){
|
|||
}
|
||||
});
|
||||
|
||||
console.log(info)
|
||||
console.log(info);
|
||||
|
||||
ipcRenderer.send("run-tnc-command", {
|
||||
command: "responseUserInfo",
|
||||
dxcallsign: selected_callsign,
|
||||
userinfo: info
|
||||
userinfo: info,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -2580,7 +2580,6 @@ ipcRenderer.on("run-tnc-command", (event, arg) => {
|
|||
if (arg.command == "requestUserInfo") {
|
||||
sock.sendRequestInfo(arg.dxcallsign);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// IPC ACTION FOR AUTO UPDATER
|
||||
|
|
|
@ -716,7 +716,6 @@ exports.sendResponseInfo = function (dxcallsign, userinfo) {
|
|||
sendRequest(dxcallsign, 255, 1, userinfo, "res");
|
||||
};
|
||||
|
||||
|
||||
//STOP TRANSMISSION
|
||||
exports.stopTransmission = function () {
|
||||
command = '{"type" : "arq", "command": "stop_transmission"}';
|
||||
|
|
Loading…
Reference in a new issue