mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
show server config for admins
Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
parent
2d8c3cfc64
commit
eb8df307ec
@ -5292,6 +5292,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
'serverclearerrorlog': serverCommandServerClearErrorLog,
|
||||
'serverconsole': serverCommandServerConsole,
|
||||
'servererrors': serverCommandServerErrors,
|
||||
'serverconfig': serverCommandServerConfig,
|
||||
'serverstats': serverCommandServerStats,
|
||||
'servertimelinestats': serverCommandServerTimelineStats,
|
||||
'serverupdate': serverCommandServerUpdate,
|
||||
@ -6504,6 +6505,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { obj.send({ action: 'servererrors', data: data }); });
|
||||
}
|
||||
|
||||
function serverCommandServerConfig(command) {
|
||||
// Load the server config
|
||||
var configFilePath = common.joinPath(parent.parent.datapath, (parent.parent.args.configfile ? parent.parent.args.configfile : 'config.json'));
|
||||
if (userHasSiteUpdate())
|
||||
fs.readFile(configFilePath, 'utf8', function (err, data) { obj.send({ action: 'serverconfig', data: data }); });
|
||||
}
|
||||
|
||||
function serverCommandServerStats(command) {
|
||||
// Only accept if the "My Server" tab is allowed for this domain
|
||||
if (domain.myserver === false) return;
|
||||
|
@ -574,6 +574,7 @@
|
||||
<div id="p2ServerActionsGoogleBackup" style="display:none"><div class="p2AccountActions"><span id="p2ServerActionsGoogleBackupCheck" style="display:none"><strong>✓</strong></span></div><span><a href=# onclick="return server_setupGoogleDriveBackup()">Google Drive backup</a><br /></span></div>
|
||||
<div id="p2ServerActionsVersion"><div class="p2AccountActions"><span style="display:none"><strong>✓</strong></span></div><a href=# onclick="return server_showVersionDlg()">Check server version</a></div>
|
||||
<div id="p2ServerActionsErrors"><div class="p2AccountActions"><span style="display:none"><strong>✓</strong></span></div><a href=# onclick="return server_showErrorsDlg()">Show server error log</a></div>
|
||||
<div id="p2ServerActionsConfig"><div class="p2AccountActions"><span style="display:none"><strong>✓</strong></span></div><a href=# onclick="return server_showConfigDlg()">Show server config</a></div>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
@ -2157,6 +2158,7 @@
|
||||
QV('p2ServerActionsRestore', (siteRights & 4) && ((serverFeatures & 2) != 0));
|
||||
QV('p2ServerActionsVersion', (siteRights & 16) && ((serverFeatures & 4) != 0));
|
||||
QV('p2ServerActionsErrors', (siteRights & 16) && ((serverFeatures & 8) != 0));
|
||||
QV('p2ServerActionsConfig', (siteRights & 16) && ((serverFeatures & 8) != 0));
|
||||
QV('MainMenuMyFiles', siteRights & 8);
|
||||
QV('LeftMenuMyFiles', siteRights & 8);
|
||||
if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); }
|
||||
@ -2755,6 +2757,18 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'serverconfig': {
|
||||
if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerConfig')) {
|
||||
if (message.data == null) {
|
||||
setDialogMode(2, "MeshCentral Server Config", 1, null, "Server has no config file.");
|
||||
} else {
|
||||
var x = '<div class="dialogText dialogTextLog"><pre id=d2ServerConfigPre style=overflow:auto>' + EscapeHtml(message.data) + '</pre></div>';
|
||||
x += '<br /><div style=float:right><img src=images/link4.png height=10 width=10 title="' + "Download server config" + '" style=cursor:pointer onclick=d2CopyServerConfigToClip()></div>';
|
||||
setDialogMode(2, "MeshCentral Server Config", 3, null, x);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'serverconsole': {
|
||||
p15consoleReceive('serverconsole', message.value);
|
||||
break;
|
||||
@ -12612,6 +12626,14 @@
|
||||
function server_showErrorsDlgEx() { meshserver.send({ action: 'serverclearerrorlog' }); }
|
||||
function d2CopyServerErrorsToClip() { saveAs(new Blob([Q('d2ServerErrorsLogPre').innerText], { type: 'application/octet-stream' }), "servererrors.txt"); }
|
||||
|
||||
function server_showConfigDlg() {
|
||||
if (xxdialogMode) return false;
|
||||
setDialogMode(2, "MeshCentral Config", 1, null, "Loading...", 'MeshCentralServerConfig');
|
||||
meshserver.send({ action: 'serverconfig' });
|
||||
return false;
|
||||
}
|
||||
function d2CopyServerConfigToClip() { saveAs(new Blob([Q('d2ServerConfigPre').innerText], { type: 'application/octet-stream' }), "config.json"); }
|
||||
|
||||
//
|
||||
// MY MESHS
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user