Added batch upload folder creation.
Ylian Saint-Hilaire committed
Nov 9, 2020 at 15:28 UTC
d833ac2472adceec6615bd43057c6222b207fc2a
5 files changed
+12
-8
agents/meshcore.js
+2
@@ -1148,7 +1148,9 @@ function createMeshCore(agent) {
1148
if (data.pipe == true) { delete data.pipe; delete data.action; data.cmd = 'meshToolInfo'; broadcastToRegisteredApps(data); }
1149
break;
1150
case 'wget': // Server uses this command to tell the agent to download a file using HTTPS/GET and place it in a given path. This is used for one-to-many file uploads.
1151
+ sendConsoleText(JSON.stringify(data));
1152
if ((data.overwrite !== true) && fs.existsSync(data.path)) break; // Don't overwrite an existing file.
1153
+ if (data.createFolder) { try { fs.mkdirSync(data.folder); } catch (ex) { } } // If requested, create the local folder.
1154
data.url = 'http' + getServerTargetUrlEx('*/').substring(2);
1155
var agentFileHttpOptions = http.parseUri(data.url);
1156
agentFileHttpOptions.path = data.urlpath;
translate/translate.json
+2
-2
@@ -190,7 +190,7 @@
190
{
191
"cs": " Je možné zadat i nápovědu pro heslo, ale nedoporučuje se to.",
192
"de": " Passwort-Hinweis kann verwendet werden, wird jedoch nicht empfohlen.",
193
- "en": " Password hint can be used but is not recommanded.",
193
+ "en": " Password hint can be used but is not recommended.",
194
"es": "La sugerencia de contraseña se puede usar pero no se recomienda.",
195
"fi": " Salasanavihjeitä voidaan käyttää, mutta niitä ei suositella.",
196
"fr": " Un indice de mot de passe peut être utilisé mais n'est pas recommandé.",
@@ -35687,7 +35687,7 @@
35687
"zh-cht": "這是不安全政策,因為將用代理執行啟動。"
35688
},
35689
{
35690
- "en": "This is the recommanded policy. Intel® AMT activation and management is completely automated and the server will attempt to make best possible use of hardware management.",
35690
+ "en": "This is the recommended policy. Intel® AMT activation and management is completely automated and the server will attempt to make best possible use of hardware management.",
35691
"nl": "Dit is het aanbevolen beleid. Activering en beheer van Intel® AMT is volledig geautomatiseerd en de server zal proberen om optimaal gebruik te maken van hardwarebeheer.",
35692
"xloc": [
35693
"default.handlebars->29->1400"
views/default-mobile.handlebars
+1
-1
@@ -1963,7 +1963,7 @@
1963
1964
var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0;
1965
function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); }
1966
- function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confim {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0 ? 'copy' : 'move'), p5clipboard.length, ((p5clipboard.length > 1) ? 's' : '')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); }
1966
+ function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confirm {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0 ? 'copy' : 'move'), p5clipboard.length, ((p5clipboard.length > 1) ? 's' : '')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); }
1967
function p5pasteFileEx() { meshserver.send({ action: 'fileoperation', fileop: (p5clipboardCut == 0 ? 'copy' : 'move'), scpath: p5clipboardFolder, path: filetreelocation, names: p5clipboard }); p5folderup(999); if (p5clipboardCut == 1) { p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; p5updateClipview(); } }
1968
function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Holding {0} entrie{1} for {2}", p5clipboard.length, ((p5clipboard.length > 1) ? 's' : ''), (p5clipboardCut == 0 ? "copy" : "move")) + ', <a href=# onclick="return p5clearClip()" style=cursor:pointer>' + "Clear" + '</a>.' } QH('p5bottomstatus', x); p5setActions(); }
1969
function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); return false; }
views/default.handlebars
+5
-4
@@ -4530,7 +4530,8 @@
4530
x += '<input type=file name=files id=d2uploadinput style=width:100% multiple=multiple onchange="d2batchUploadValidate()" /><br /><br />';
4531
if (wintype) { x += addHtmlValue("Windows Path", '<input style=width:250px type=text onchange="d2batchUploadValidate()" onkeyup="d2batchUploadValidate()" name=winpath id=d2winuploadpath placeholder="C:\\temp" value="" />'); }
4532
if (linuxtype) { x += addHtmlValue("Linux Path", '<input style=width:250px type=text onchange="d2batchUploadValidate()" onkeyup="d2batchUploadValidate()" name=linuxpath id=d2linuxuploadpath placeholder="/tmp" value="" />'); }
4533
- x += '<br /><label><input type=checkbox name=overwriteFiles />' + "Overwrite if file exists?" + '</label></form>';
4533
+ x += '<br /><label><input type=checkbox name=createFolder />' + "Create folder if it does not exists?" + '</label></form>';
4534
+ x += '<label><input type=checkbox name=overwriteFiles />' + "Overwrite if file exists?" + '</label></form>';
4535
setDialogMode(2, "Batch File Upload", 3, d2batchUploadValidateOk, x);
4536
d2batchUploadValidate();
4537
} else {
@@ -9260,7 +9261,7 @@
9261
function account_showChangePassword() {
9262
if (xxdialogMode) return false;
9263
var x = "Change your account password by entering the old password and new password twice in the boxes below.";
9263
- if (features & 0x00010000) { " Password hint can be used but is not recommanded."; }
9264
+ if (features & 0x00010000) { " Password hint can be used but is not recommended."; }
9265
x += '<br /><br />';
9266
//x += "<form action='" + domainUrl + "changepassword' method=post>";
9267
x += '<table style=margin-left:60px>';
@@ -9713,7 +9714,7 @@
9714
}
9715
if (ptype == 0) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/rcheckbox60.png width=60 height=60><td>' + "When this policy is selected, Intel® AMT is not managed by this server. Intel AMT can still be used by manually activating and configuring it." + '</table>'; }
9716
if (ptype == 1) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/rcheckbox60.png width=60 height=60><td>' + "When this policy is selected, any Intel® AMT in Client Control Mode (CCM) will be deactivated. Other devices will have CIRA cleared and can still be managed manually." + '</table>'; }
9716
- if (ptype == 4) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/checkbox60.png width=60 height=60><td>' + "This is the recommanded policy. Intel® AMT activation and management is completely automated and the server will attempt to make best possible use of hardware management." + '</table>'; }
9717
+ if (ptype == 4) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/checkbox60.png width=60 height=60><td>' + "This is the recommended policy. Intel® AMT activation and management is completely automated and the server will attempt to make best possible use of hardware management." + '</table>'; }
9718
QH('dp20amtpolicydiv', x);
9719
setTimeout(dp20amtValidatePolicy, 500);
9720
}
@@ -10720,7 +10721,7 @@
10721
}
10722
p5updateClipview();
10723
}
10723
- function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confim {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0?'copy':'move'), p5clipboard.length, ((p5clipboard.length > 1)?'s':'')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); }
10724
+ function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confirm {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0?'copy':'move'), p5clipboard.length, ((p5clipboard.length > 1)?'s':'')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); }
10725
function p5pasteFileEx() { meshserver.send({ action: 'fileoperation', fileop: (p5clipboardCut == 0?'copy':'move'), scpath: p5clipboardFolder, path: filetreelocation, names: p5clipboard }); p5folderup(999); if (p5clipboardCut == 1) { p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; p5updateClipview(); } }
10726
function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Holding {0} entrie{1} for {2}", p5clipboard.length, ((p5clipboard.length > 1)?'s':''), (p5clipboardCut == 0?"copy":"move")) + ', <a href=# onclick="return p5clearClip()" style=cursor:pointer>' + "Clear" + '</a>.' } QH('p5bottomstatus', x); p5setActions(); }
10727
function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); return false; }
webserver.js
+2
-1
@@ -3196,6 +3196,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3196
if ((fields.winpath != null) && (fields.winpath.length == 1)) { cmd.windowsPath = fields.winpath[0]; }
3197
if ((fields.linuxpath != null) && (fields.linuxpath.length == 1)) { cmd.linuxPath = fields.linuxpath[0]; }
3198
if ((fields.overwriteFiles != null) && (fields.overwriteFiles.length == 1) && (fields.overwriteFiles[0] == 'on')) { cmd.overwrite = true; }
3199
+ if ((fields.createFolder != null) && (fields.createFolder.length == 1) && (fields.createFolder[0] == 'on')) { cmd.createFolder = true; }
3200
3201
// Get server temporary path
3202
var serverpath = obj.path.join(obj.filespath, 'tmp')
@@ -3230,7 +3231,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3231
if ((node == null) || ((rights & 8) == 0) || (visible == false)) return; // We don't have remote control rights to this device
3232
var agentPath = ((node.agent.id > 0) && (node.agent.id < 5)) ? cmd.windowsPath : cmd.linuxPath;
3233
for (var f in cmd.files) {
3233
- const acmd = { action: 'wget', overwrite: cmd.overwrite, urlpath: '/agentdownload.ashx?c=' + obj.parent.encodeCookie({ a: 'tmpdl', d: cmd.domain.id, nid: node._id, f: cmd.files[f].target }, obj.parent.loginCookieEncryptionKey), path: obj.path.join(agentPath, cmd.files[f].name), servertlshash: tlsCertHash };
3234
+ const acmd = { action: 'wget', overwrite: cmd.overwrite, createFolder: cmd.createFolder, urlpath: '/agentdownload.ashx?c=' + obj.parent.encodeCookie({ a: 'tmpdl', d: cmd.domain.id, nid: node._id, f: cmd.files[f].target }, obj.parent.loginCookieEncryptionKey), path: obj.path.join(agentPath, cmd.files[f].name), folder: agentPath, servertlshash: tlsCertHash };
3235
var agent = obj.wsagents[node._id];
3236
if (agent != null) { try { agent.send(JSON.stringify(acmd)); } catch (ex) { } }
3237
// TODO: Add support for peer servers.