1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Added personal notes.

This commit is contained in:
Ylian Saint-Hilaire 2021-03-25 13:28:33 -07:00
parent 4a83318393
commit a53b030345
11 changed files with 1635 additions and 1540 deletions

View file

@ -553,7 +553,7 @@
<Content Include="translate\translate.json" /> <Content Include="translate\translate.json" />
<Content Include="views\agentinvite.handlebars" /> <Content Include="views\agentinvite.handlebars" />
<Content Include="views\default-mobile.handlebars" /> <Content Include="views\default-mobile.handlebars" />
<Content Include="views\default.handlebars" /> <Content Include="views\default2.handlebars" />
<Content Include="views\desktop.handlebars" /> <Content Include="views\desktop.handlebars" />
<Content Include="views\download.handlebars" /> <Content Include="views\download.handlebars" />
<Content Include="views\download2.handlebars" /> <Content Include="views\download2.handlebars" />

Binary file not shown.

Binary file not shown.

View file

@ -1782,9 +1782,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
} }
} }
db.Remove('ws' + deluser._id); // Remove user web state db.Remove('ws' + deluser._id); // Remove user web state
db.Remove('nt' + deluser._id); // Remove notes for this user db.Remove('nt' + deluser._id); // Remove notes for this user
db.Remove('im' + deluser._id); // Remove image for this user db.Remove('ntp' + deluser._id); // Remove personal notes for this user
db.Remove('im' + deluser._id); // Remove image for this user
// Delete all files on the server for this account // Delete all files on the server for this account
try { try {
@ -4289,7 +4290,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var splitid = command.id.split('/'); var splitid = command.id.split('/');
if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
var idtype = splitid[0]; var idtype = splitid[0];
if ((idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return; if ((idtype != 'puser') && (idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if (idtype == 'node') { if (idtype == 'node') {
// Get the node and the rights for this node // Get the node and the rights for this node
@ -4328,6 +4329,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if ((user.groups != null) && (user.groups.length > 0) && ((chguser.groups == null) || (findOne(chguser.groups, user.groups) == false))) break; if ((user.groups != null) && (user.groups.length > 0) && ((chguser.groups == null) || (findOne(chguser.groups, user.groups) == false))) break;
db.Set({ _id: 'nt' + command.id, type: 'note', value: command.notes }); // Set the note for this user db.Set({ _id: 'nt' + command.id, type: 'note', value: command.notes }); // Set the note for this user
} }
} else if (idtype == 'puser') {
// Set the user's personal note, starts with 'ntp' + userid.
if (common.validateString(command.notes, 1) == false) {
db.Remove('ntp' + user._id); // Delete the note for this node
} else {
db.Set({ _id: 'ntp' + user._id, type: 'note', value: command.notes }); // Set the note for this user
}
} }
break; break;
@ -4761,7 +4769,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var splitid = command.id.split('/'); var splitid = command.id.split('/');
if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
var idtype = splitid[0]; var idtype = splitid[0];
if ((idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return; if ((idtype != 'puser') && (idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if (idtype == 'node') { if (idtype == 'node') {
// Get the node and the rights for this node // Get the node and the rights for this node
@ -4799,6 +4807,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value })); ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
} catch (ex) { } } catch (ex) { }
}); });
} else if (idtype == 'puser') {
// Get personal note, starts with 'ntp' + userid
db.Get('ntp' + user._id, function (err, notes) {
try {
if ((notes == null) || (notes.length != 1)) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
} catch (ex) { }
});
} }
break; break;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -2995,6 +2995,13 @@ a {
width: 28px; width: 28px;
} }
.uiSelector6 {
margin: 2px;
background: url(../images/views.png) -392px 0px;
height: 28px;
width: 28px;
}
.backButton { .backButton {
width: 32px; width: 32px;
height: 32px; height: 32px;

View file

@ -357,22 +357,27 @@ function startEx(argv) {
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); } if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; } if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; }
var minifiedOut = minify(inFile, { var minifiedOut = null;
collapseBooleanAttributes: true, try {
collapseInlineTagWhitespace: false, // This is not good. minifiedOut = minify(inFile, {
collapseWhitespace: true, collapseBooleanAttributes: true,
minifyCSS: true, collapseInlineTagWhitespace: false, // This is not good.
minifyJS: true, collapseWhitespace: true,
removeComments: true, minifyCSS: true,
removeOptionalTags: true, minifyJS: true,
removeEmptyAttributes: true, removeComments: true,
removeAttributeQuotes: true, removeOptionalTags: true,
removeRedundantAttributes: true, removeEmptyAttributes: true,
removeScriptTypeAttributes: true, removeAttributeQuotes: true,
removeTagWhitespace: true, removeRedundantAttributes: true,
preserveLineBreaks: false, removeScriptTypeAttributes: true,
useShortDoctype: true removeTagWhitespace: true,
}); preserveLineBreaks: false,
useShortDoctype: true
});
} catch (ex) {
console.log(ex);
}
// Perform minification post-processing // Perform minification post-processing
if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); } if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); }

File diff suppressed because it is too large Load diff

View file

@ -707,6 +707,7 @@
<div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><span id="p2nextPasswordUpdateTime"></span></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><span id="p2nextPasswordUpdateTime"></span></div>
<div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div>
<div style="margin-top:5px"><a onclick="toggleNightMode()" style="cursor:pointer">Set dark mode</a></div> <div style="margin-top:5px"><a onclick="toggleNightMode()" style="cursor:pointer">Set dark mode</a></div>
<div style="margin-top:5px"><a onclick="showNotes(false,encodeURIComponentEx('p'+userinfo._id))" style="cursor:pointer">Personal notes</a></div>
</div> </div>
<br style=clear:both /> <br style=clear:both />
</div> </div>

View file

@ -146,11 +146,20 @@
<div tabindex=0 id=uiMenuButton title="User interface selection" onclick="showUserInterfaceSelectMenu()" onkeypress="if (event.key == 'Enter') showUserInterfaceSelectMenu()"> <div tabindex=0 id=uiMenuButton title="User interface selection" onclick="showUserInterfaceSelectMenu()" onkeypress="if (event.key == 'Enter') showUserInterfaceSelectMenu()">
&diams; &diams;
<div id=uiMenu style="display:none"> <div id=uiMenu style="display:none">
<div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div> <table>
<div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div> <tr>
<div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div> <td>
<div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div> <div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div>
<div tabindex=0 id=uiViewButton5 class=uiSelector onclick=toggleFooterBarMode() title="Toggle footer bar" onkeypress="if (event.key == 'Enter') toggleFooterBarMode()"><div class="uiSelector5"></div></div> <div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div>
<div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div>
</td>
<td>
<div tabindex=0 id=uiViewButton6 class=uiSelector onclick="showNotes(false,encodeURIComponentEx('p'+userinfo._id))" title="Personal Notes" onkeypress="if (event.key == 'Enter') showNotes(false,'p'+encodeURIComponentEx(userinfo._id))"><div class="uiSelector6"></div></div>
<div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div>
<div tabindex=0 id=uiViewButton5 class=uiSelector onclick=toggleFooterBarMode() title="Toggle footer bar" onkeypress="if (event.key == 'Enter') toggleFooterBarMode()"><div class="uiSelector5"></div></div>
</td>
</tr>
</table>
</div> </div>
</div> </div>
<table id=MainMenuSpan cellpadding=0 cellspacing=0 class=style1> <table id=MainMenuSpan cellpadding=0 cellspacing=0 class=style1>

View file

@ -1976,9 +1976,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
} }
} }
obj.db.Remove('ws' + deluser._id); // Remove user web state obj.db.Remove('ws' + deluser._id); // Remove user web state
obj.db.Remove('nt' + deluser._id); // Remove notes for this user obj.db.Remove('nt' + deluser._id); // Remove notes for this user
obj.db.Remove('im' + deluser._id); // Remove image for this user obj.db.Remove('ntp' + deluser._id); // Remove personal notes for this user
obj.db.Remove('im' + deluser._id); // Remove image for this user
// Remove the user // Remove the user
obj.db.Remove(deluser._id); obj.db.Remove(deluser._id);