diff --git a/db.js b/db.js index 90d9007c..45e885ba 100644 --- a/db.js +++ b/db.js @@ -681,13 +681,13 @@ module.exports.CreateDB = function (parent, func) { obj.eventsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.eventsfile.ensureIndex({ fieldName: 'ids' }); // TODO: Not sure if this is a good index, this is a array field. obj.eventsfile.ensureIndex({ fieldName: 'nodeid', sparse: true }); - obj.eventsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: 60 * 60 * 24 * 20 }); // Limit the power event log to 20 days (Seconds * Minutes * Hours * Days) + obj.eventsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expireEventsSeconds }); // Setup the power collection and setup indexes obj.powerfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-power.db'), autoload: true }); obj.powerfile.persistence.setAutocompactionInterval(86400000); // Compact once a day obj.powerfile.ensureIndex({ fieldName: 'nodeid' }); - obj.powerfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: 60 * 60 * 24 * 10 }); // Limit the power event log to 10 days (Seconds * Minutes * Hours * Days) + obj.powerfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expirePowerEventsSeconds }); // Setup the SMBIOS collection obj.smbiosfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-smbios.db'), autoload: true }); @@ -695,7 +695,7 @@ module.exports.CreateDB = function (parent, func) { // Setup the server stats collection and setup indexes obj.serverstatsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-stats.db'), autoload: true }); obj.serverstatsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day - obj.serverstatsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: 60 * 60 * 24 * 30 }); // Limit the server stats log to 30 days (Seconds * Minutes * Hours * Days) + obj.serverstatsfile.ensureIndex({ fieldName: 'time', expireAfterSeconds: expireServerStatsSeconds }); obj.serverstatsfile.ensureIndex({ fieldName: 'expire', expireAfterSeconds: 0 }); // Auto-expire events // Setup plugin info collection diff --git a/translate/translate.json b/translate/translate.json index 25453b40..d3681f73 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -5284,7 +5284,7 @@ "en": "ChatSession", "nl": "Chat sessie", "xloc": [ - "messenger.handlebars->13->14" + "messenger.handlebars->13->16" ] }, { @@ -6522,7 +6522,7 @@ "ru": "Подключено.", "zh-chs": "連接的。", "xloc": [ - "messenger.handlebars->13->12" + "messenger.handlebars->13->14" ] }, { @@ -8999,7 +8999,7 @@ "zh-chs": "下載", "xloc": [ "download.handlebars->container->page_content->column_l->1", - "messenger.handlebars->13->10" + "messenger.handlebars->13->11" ] }, { @@ -10675,7 +10675,7 @@ "ru": "Ошибка: Не указан ключ подключения.", "zh-chs": "錯誤:未指定連接密鑰。", "xloc": [ - "messenger.handlebars->13->13" + "messenger.handlebars->13->15" ] }, { @@ -28593,7 +28593,7 @@ "ru": "В ожидании другой стороны...", "zh-chs": "正在等待其他用戶...", "xloc": [ - "messenger.handlebars->13->11" + "messenger.handlebars->13->13" ] }, { @@ -29942,6 +29942,13 @@ "default.handlebars->27->454" ] }, + { + "en": "bytes", + "xloc": [ + "messenger.handlebars->13->10", + "messenger.handlebars->13->12" + ] + }, { "cs": "klikněte zde", "de": "hier klicken", diff --git a/views/messenger.handlebars b/views/messenger.handlebars index 7b6f73db..c1b570d5 100644 --- a/views/messenger.handlebars +++ b/views/messenger.handlebars @@ -62,7 +62,7 @@ var webrtcconfiguration = '{{{webrtconfig}}}'; if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: "' + webrtcconfiguration + '".'); webrtcconfiguration = null; } } var windowFocus = true; - var chatTestSession = new Date().toString() + '\r\n'; + var chatTextSession = new Date().toString() + '\r\n'; // File transfer state var fileUploads = []; @@ -121,7 +121,7 @@ } function onUserInputFocus(x) { userInputFocus = x; } - function displayClear() { chatTestSession = new Date().toString() + '\r\n'; QH('xmsg', ''); cancelAllFileTransfers(); fileUploads = [], fileDownloads = {}; } + function displayClear() { chatTextSession = new Date().toString() + '\r\n'; QH('xmsg', ''); cancelAllFileTransfers(); fileUploads = [], fileDownloads = {}; } // Polyfill FileReader if needed if (!FileReader.prototype.readAsBinaryString) { @@ -156,7 +156,7 @@ // Display a control message function displayControl(msg) { - chatTestSession += ("Control" + '> ' + msg + '\r\n'); + chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Control" + '> ' + msg + '\r\n'); QA('xmsg', '
' + EscapeHtml(msg) + '
'); Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;//Q('xmsg').scrollHeight; } @@ -171,7 +171,7 @@ // Display a message from the remote user function displayRemote(msg) { - chatTestSession += ("Remote" + '> ' + msg + '\r\n'); + chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Remote" + '> ' + msg + '\r\n'); QA('xmsg', '
' + EscapeHtml(msg) + '
'); Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight; @@ -194,7 +194,7 @@ var outtext = Q('xouttext').value; if (outtext.length > 0) { Q('xouttext').value = ''; - chatTestSession += ("Local" + '> ' + outtext + '\r\n'); + chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Local" + '> ' + outtext + '\r\n'); QA('xmsg', '
' + EscapeHtml(outtext) + '
'); Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight; send({ action: 'chat', msg: outtext }); @@ -429,8 +429,7 @@ if (state != 2) return; file.id = Math.random(); fileUploads.push(file); - console.log(file); - chatTestSession += ("Upload" + '> ' + file.name + '\r\n'); + chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Upload" + '> ' + file.name + ' (' + file.size + ' ' + "bytes" + ')\r\n'); QA('xmsg', '
' + file.name + '
 
'); Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight; send({ action: 'file', size: file.size, id: file.id, type: file.type, name: file.name }); @@ -440,8 +439,7 @@ function startFileDownload(file) { if (state != 2) return; fileDownloads[file.id] = file; - console.log(file); - chatTestSession += ("Download" + '> ' + file.name + '\r\n'); + chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Download" + '> ' + file.name + ' (' + file.size + ' ' + "bytes" + ')\r\n'); QA('xmsg', '
' + file.name + '
 
'); Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight; } @@ -646,7 +644,7 @@ } function saveChatSession() { - saveAs(data2blob(chatTestSession), "ChatSession"); + saveAs(data2blob(chatTextSession), "ChatSession"); } start();