Fixed web site no localstorage, MongoDB backup with URL.
This commit is contained in:
parent
e9ebb8aa20
commit
90b060016c
|
@ -1230,7 +1230,7 @@ function createMeshCore(agent) {
|
|||
var bash = fs.existsSync('/bin/bash') ? '/bin/bash' : false;
|
||||
var sh = fs.existsSync('/bin/sh') ? '/bin/sh' : false;
|
||||
var script = false;
|
||||
if (this.httprequest.xoptions.script)
|
||||
if (this.httprequest.xoptions && this.httprequest.xoptions.script)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1244,7 +1244,7 @@ function createMeshCore(agent) {
|
|||
}
|
||||
} catch (ex) { }
|
||||
}
|
||||
var python = (this.httprequest.xoptions.python && fs.existsSync('/usr/bin/python')) ? '/usr/bin/python' : false;
|
||||
var python = (this.httprequest.xoptions && this.httprequest.xoptions.python && fs.existsSync('/usr/bin/python')) ? '/usr/bin/python' : false;
|
||||
var shell = bash || sh;
|
||||
|
||||
var env = { HISTCONTROL: 'ignoreboth', TERM: 'xterm' };
|
||||
|
|
4
db.js
4
db.js
|
@ -973,6 +973,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
|
||||
try { parent.fs.mkdirSync(backupPath); } catch (e) { }
|
||||
const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral';
|
||||
const dburl = parent.args.mongodb;
|
||||
const currentDate = new Date();
|
||||
const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2);
|
||||
const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix;
|
||||
|
@ -985,7 +986,8 @@ module.exports.CreateDB = function (parent, func) {
|
|||
var mongoDumpPath = 'mongodump';
|
||||
if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { mongoDumpPath = parent.config.settings.autobackup.mongodumppath; }
|
||||
const child_process = require('child_process');
|
||||
const cmd = '\"' + mongoDumpPath + '\" --db \"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"';
|
||||
const cmd = '\"' + mongoDumpPath + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"';
|
||||
if (dburl) { cmd = '\"' + mongoDumpPath + '\" --url=\"' + dburl + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"'; }
|
||||
var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
|
||||
try {
|
||||
backupProcess = null;
|
||||
|
|
|
@ -1114,7 +1114,7 @@
|
|||
var webState = '{{{webstate}}}';
|
||||
if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
|
||||
for (var i in webState) { localStorage.setItem(i, webState[i]); }
|
||||
if (!webState.loctag) { delete localStorage.removeItem('loctag'); }
|
||||
if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
|
||||
|
||||
var args;
|
||||
var autoReconnect = true;
|
||||
|
@ -1221,6 +1221,7 @@
|
|||
|
||||
// Setup logout control
|
||||
var logoutControl = '';
|
||||
if (logoutControls)
|
||||
if (logoutControls.name != null) { logoutControl = format("Welcome {0}.", logoutControls.name); }
|
||||
if (logoutControls.logoutUrl != null) { logoutControl += format(' <a href=\"' + logoutControls.logoutUrl + '\" style="color:white">' + "Logout" + '</a>'); }
|
||||
if (args.hide & 1) { QH('logoutControlSpan2', logoutControl); } else { QH('logoutControlSpan', logoutControl); }
|
||||
|
@ -1274,9 +1275,11 @@
|
|||
setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
|
||||
|
||||
// Load desktop settings
|
||||
var t = localStorage.getItem('desktopsettings');
|
||||
var t = null;
|
||||
try { t = localStorage.getItem('desktopsettings'); } catch (ex) {}
|
||||
if (t != null) { desktopsettings = JSON.parse(t); }
|
||||
t = localStorage.getItem('multidesktopsettings');
|
||||
t = null;
|
||||
try { t = localStorage.getItem('multidesktopsettings'); } catch (ex) {}
|
||||
if (t != null) { multidesktopsettings = JSON.parse(t); }
|
||||
applyDesktopSettings();
|
||||
|
||||
|
@ -2198,6 +2201,7 @@
|
|||
switch (message.event.action) {
|
||||
case 'userWebState': {
|
||||
// New user web state, update the web page as needed
|
||||
try {
|
||||
if (localStorage != null) {
|
||||
var oldShowRealNames = localStorage.getItem('showRealNames');
|
||||
var oldUiMode = localStorage.getItem('uiMode');
|
||||
|
@ -2214,6 +2218,7 @@
|
|||
if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); masterUpdate(6); }
|
||||
if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); }
|
||||
}
|
||||
} catch (ex) {}
|
||||
break;
|
||||
}
|
||||
case 'servertimelinestats': { addServerTimelineStats(message.event.data); break; }
|
||||
|
@ -10724,9 +10729,11 @@
|
|||
function putstore(name, val) {
|
||||
try {
|
||||
if ((typeof (localStorage) === 'undefined') || (localStorage.getItem(name) == val)) return;
|
||||
if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); } } catch (e) { }
|
||||
if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); }
|
||||
} catch (e) { }
|
||||
if (name[0] != '_') {
|
||||
var s = {};
|
||||
try {
|
||||
for (var i = 0, len = localStorage.length; i < len; ++i) {
|
||||
var k = localStorage.key(i);
|
||||
if (k[0] != '_') {
|
||||
|
@ -10734,6 +10741,7 @@
|
|||
if ((k != 'desktopsettings') && (typeof s[k] == 'string') && (s[k].length > 64)) { delete s[k]; }
|
||||
}
|
||||
}
|
||||
} catch (ex) {}
|
||||
meshserver.send({ action: 'userWebState', state: JSON.stringify(s) });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue