added timestamp to chat msg

This commit is contained in:
DJ2LS 2022-11-10 10:21:54 +01:00
parent 5de436e4f3
commit 9a2711fe3f

View file

@ -267,7 +267,8 @@ db.post({
if (filetype == ''){ if (filetype == ''){
filetype = 'plain/text' filetype = 'plain/text'
} }
var data_with_attachment = chatmessage + split_char + filename + split_char + filetype + split_char + file; var timestamp = Math.floor(Date.now() / 1000);
var data_with_attachment = chatmessage + split_char + filename + split_char + filetype + split_char + file + split_char + timestamp;
document.getElementById('selectFilesButton').innerHTML = ``; document.getElementById('selectFilesButton').innerHTML = ``;
@ -285,7 +286,7 @@ db.post({
ipcRenderer.send('run-tnc-command', Data); ipcRenderer.send('run-tnc-command', Data);
db.post({ db.post({
_id: uuid, _id: uuid,
timestamp: Math.floor(Date.now() / 1000), timestamp: timestamp,
dxcallsign: dxcallsign, dxcallsign: dxcallsign,
dxgrid: 'null', dxgrid: 'null',
msg: chatmessage, msg: chatmessage,
@ -419,7 +420,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
} else if (item.arq == 'transmission' && item.status == 'received') { } else if (item.arq == 'transmission' && item.status == 'received') {
var encoded_data = atob(item.data); var encoded_data = atob(item.data);
var splitted_data = encoded_data.split(split_char); var splitted_data = encoded_data.split(split_char);
obj.timestamp = item.timestamp; obj.timestamp = splitted_data[8];
obj.dxcallsign = item.dxcallsign; obj.dxcallsign = item.dxcallsign;
obj.dxgrid = item.dxgrid; obj.dxgrid = item.dxgrid;
obj.command = splitted_data[1]; obj.command = splitted_data[1];
@ -776,7 +777,7 @@ update_chat = function(obj) {
console.log(blob) console.log(blob)
var data_with_attachment = doc.msg + split_char + filename + split_char + filetype + split_char + file; var data_with_attachment = doc.msg + split_char + filename + split_char + filetype + split_char + file + split_char + doc.timestamp;
let Data = { let Data = {
command: "send_message", command: "send_message",
dxcallsign: doc.dxcallsign, dxcallsign: doc.dxcallsign,