mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 05:42:13 +03:00
Fixed DbExpire with NeDB.
This commit is contained in:
parent
bbf17e74fe
commit
3079f0185c
6
db.js
6
db.js
@ -681,13 +681,13 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
obj.eventsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day
|
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: '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: '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
|
// Setup the power collection and setup indexes
|
||||||
obj.powerfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-power.db'), autoload: true });
|
obj.powerfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-power.db'), autoload: true });
|
||||||
obj.powerfile.persistence.setAutocompactionInterval(86400000); // Compact once a day
|
obj.powerfile.persistence.setAutocompactionInterval(86400000); // Compact once a day
|
||||||
obj.powerfile.ensureIndex({ fieldName: 'nodeid' });
|
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
|
// Setup the SMBIOS collection
|
||||||
obj.smbiosfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-smbios.db'), autoload: true });
|
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
|
// Setup the server stats collection and setup indexes
|
||||||
obj.serverstatsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-stats.db'), autoload: true });
|
obj.serverstatsfile = new Datastore({ filename: parent.getConfigFilePath('meshcentral-stats.db'), autoload: true });
|
||||||
obj.serverstatsfile.persistence.setAutocompactionInterval(86400000); // Compact once a day
|
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
|
obj.serverstatsfile.ensureIndex({ fieldName: 'expire', expireAfterSeconds: 0 }); // Auto-expire events
|
||||||
|
|
||||||
// Setup plugin info collection
|
// Setup plugin info collection
|
||||||
|
@ -5284,7 +5284,7 @@
|
|||||||
"en": "ChatSession",
|
"en": "ChatSession",
|
||||||
"nl": "Chat sessie",
|
"nl": "Chat sessie",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"messenger.handlebars->13->14"
|
"messenger.handlebars->13->16"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -6522,7 +6522,7 @@
|
|||||||
"ru": "Подключено.",
|
"ru": "Подключено.",
|
||||||
"zh-chs": "連接的。",
|
"zh-chs": "連接的。",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"messenger.handlebars->13->12"
|
"messenger.handlebars->13->14"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -8999,7 +8999,7 @@
|
|||||||
"zh-chs": "下載",
|
"zh-chs": "下載",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"download.handlebars->container->page_content->column_l->1",
|
"download.handlebars->container->page_content->column_l->1",
|
||||||
"messenger.handlebars->13->10"
|
"messenger.handlebars->13->11"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -10675,7 +10675,7 @@
|
|||||||
"ru": "Ошибка: Не указан ключ подключения.",
|
"ru": "Ошибка: Не указан ключ подключения.",
|
||||||
"zh-chs": "錯誤:未指定連接密鑰。",
|
"zh-chs": "錯誤:未指定連接密鑰。",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"messenger.handlebars->13->13"
|
"messenger.handlebars->13->15"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -28593,7 +28593,7 @@
|
|||||||
"ru": "В ожидании другой стороны...",
|
"ru": "В ожидании другой стороны...",
|
||||||
"zh-chs": "正在等待其他用戶...",
|
"zh-chs": "正在等待其他用戶...",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"messenger.handlebars->13->11"
|
"messenger.handlebars->13->13"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -29942,6 +29942,13 @@
|
|||||||
"default.handlebars->27->454"
|
"default.handlebars->27->454"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"en": "bytes",
|
||||||
|
"xloc": [
|
||||||
|
"messenger.handlebars->13->10",
|
||||||
|
"messenger.handlebars->13->12"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cs": "klikněte zde",
|
"cs": "klikněte zde",
|
||||||
"de": "hier klicken",
|
"de": "hier klicken",
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
var webrtcconfiguration = '{{{webrtconfig}}}';
|
var webrtcconfiguration = '{{{webrtconfig}}}';
|
||||||
if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: "' + webrtcconfiguration + '".'); webrtcconfiguration = null; } }
|
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 windowFocus = true;
|
||||||
var chatTestSession = new Date().toString() + '\r\n';
|
var chatTextSession = new Date().toString() + '\r\n';
|
||||||
|
|
||||||
// File transfer state
|
// File transfer state
|
||||||
var fileUploads = [];
|
var fileUploads = [];
|
||||||
@ -121,7 +121,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUserInputFocus(x) { userInputFocus = x; }
|
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
|
// Polyfill FileReader if needed
|
||||||
if (!FileReader.prototype.readAsBinaryString) {
|
if (!FileReader.prototype.readAsBinaryString) {
|
||||||
@ -156,7 +156,7 @@
|
|||||||
|
|
||||||
// Display a control message
|
// Display a control message
|
||||||
function displayControl(msg) {
|
function displayControl(msg) {
|
||||||
chatTestSession += ("Control" + '> ' + msg + '\r\n');
|
chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Control" + '> ' + msg + '\r\n');
|
||||||
QA('xmsg', '<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">' + EscapeHtml(msg) + '</div><div></div></div>');
|
QA('xmsg', '<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">' + EscapeHtml(msg) + '</div><div></div></div>');
|
||||||
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;//Q('xmsg').scrollHeight;
|
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;//Q('xmsg').scrollHeight;
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
// Display a message from the remote user
|
// Display a message from the remote user
|
||||||
function displayRemote(msg) {
|
function displayRemote(msg) {
|
||||||
chatTestSession += ("Remote" + '> ' + msg + '\r\n');
|
chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Remote" + '> ' + msg + '\r\n');
|
||||||
QA('xmsg', '<div style="clear:both"><div class="remoteBubble">' + EscapeHtml(msg) + '</div><div></div></div>');
|
QA('xmsg', '<div style="clear:both"><div class="remoteBubble">' + EscapeHtml(msg) + '</div><div></div></div>');
|
||||||
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
||||||
|
|
||||||
@ -194,7 +194,7 @@
|
|||||||
var outtext = Q('xouttext').value;
|
var outtext = Q('xouttext').value;
|
||||||
if (outtext.length > 0) {
|
if (outtext.length > 0) {
|
||||||
Q('xouttext').value = '';
|
Q('xouttext').value = '';
|
||||||
chatTestSession += ("Local" + '> ' + outtext + '\r\n');
|
chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Local" + '> ' + outtext + '\r\n');
|
||||||
QA('xmsg', '<div style="clear:both"><div class="localBubble">' + EscapeHtml(outtext) + '</div><div></div></div>');
|
QA('xmsg', '<div style="clear:both"><div class="localBubble">' + EscapeHtml(outtext) + '</div><div></div></div>');
|
||||||
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
||||||
send({ action: 'chat', msg: outtext });
|
send({ action: 'chat', msg: outtext });
|
||||||
@ -429,8 +429,7 @@
|
|||||||
if (state != 2) return;
|
if (state != 2) return;
|
||||||
file.id = Math.random();
|
file.id = Math.random();
|
||||||
fileUploads.push(file);
|
fileUploads.push(file);
|
||||||
console.log(file);
|
chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Upload" + '> ' + file.name + ' (' + file.size + ' ' + "bytes" + ')\r\n');
|
||||||
chatTestSession += ("Upload" + '> ' + file.name + '\r\n');
|
|
||||||
QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
|
QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
|
||||||
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
||||||
send({ action: 'file', size: file.size, id: file.id, type: file.type, name: file.name });
|
send({ action: 'file', size: file.size, id: file.id, type: file.type, name: file.name });
|
||||||
@ -440,8 +439,7 @@
|
|||||||
function startFileDownload(file) {
|
function startFileDownload(file) {
|
||||||
if (state != 2) return;
|
if (state != 2) return;
|
||||||
fileDownloads[file.id] = file;
|
fileDownloads[file.id] = file;
|
||||||
console.log(file);
|
chatTextSession += ((new Date()).toLocaleTimeString() + ' - ' + "Download" + '> ' + file.name + ' (' + file.size + ' ' + "bytes" + ')\r\n');
|
||||||
chatTestSession += ("Download" + '> ' + file.name + '\r\n');
|
|
||||||
QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
|
QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
|
||||||
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
Q('xmsgparent').scrollTop = Q('xmsgparent').scrollHeight;
|
||||||
}
|
}
|
||||||
@ -646,7 +644,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveChatSession() {
|
function saveChatSession() {
|
||||||
saveAs(data2blob(chatTestSession), "ChatSession");
|
saveAs(data2blob(chatTextSession), "ChatSession");
|
||||||
}
|
}
|
||||||
|
|
||||||
start();
|
start();
|
||||||
|
Loading…
Reference in New Issue
Block a user