Improved utf8 support
Ylian Saint-Hilaire committed
Jul 9, 2018 at 14:12 UTC
5949c7456c1d4771ba0c3f089ec5298a21879d95
9 files changed
+18
-20
agents/MeshCmd-signed.exe
Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ
agents/MeshService-signed.exe
Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.1.8-l",
3
+ "version": "0.1.8-m",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
views/default-mobile.handlebars
+15
-16
@@ -1092,7 +1092,7 @@
1092
QE('p5UploadButton', filetreelocation.length > 0);
1093
QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0));
1094
QE('p5SelectAllButton', tc > 0);
1095
- Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
1095
+ Q('p5SelectAllButton').value = (cc > 0 ? 'None' : 'All');
1096
QE('p5CutButton', (sfc > 0) && (cc == sfc));
1097
QE('p5CopyButton', (sfc > 0) && (cc == sfc));
1098
QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
@@ -2084,7 +2084,7 @@
2084
break;
2085
case 3:
2086
p13targetpath = '';
2087
- files.send(JSON.stringify({ action: 'ls', reqid: 1, path: '' }));
2087
+ files.sendText({ action: 'ls', reqid: 1, path: '' });
2088
break;
2089
}
2090
}
@@ -2128,7 +2128,7 @@
2128
//console.log('p13gotFiles', data);
2129
if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; }
2130
//console.log('p13gotFiles', data);
2131
- data = JSON.parse(data);
2131
+ data = JSON.parse(decode_utf8(data));
2132
if (data.action == 'download') { p13gotDownloadCommand(data); return; }
2133
data.path = data.path.replace(/\//g, "\\");
2134
if ((p13filetree != null) && (data.path == p13filetree.path)) {
@@ -2138,8 +2138,7 @@
2138
p13updateFiles(checkedNames);
2139
} else {
2140
// Make both paths use the same seperator not start with /
2141
- var x1 = data.path.replace(/\//g, "\\");
2142
- var x2 = p13targetpath.replace(/\//g, "\\");
2141
+ var x1 = data.path.replace(/\//g, "\\"), x2 = p13targetpath.replace(/\//g, "\\");
2142
while ((x1.length > 0) && (x1[0] == '\\')) { x1 = x1.substring(1); }
2143
while ((x2.length > 0) && (x2[0] == '\\')) { x2 = x2.substring(1); }
2144
if ((x1 == x2) || ((data.path == '\\') && (p13targetpath == ''))) {
@@ -2210,13 +2209,13 @@
2209
2210
function p13folderset(x) {
2211
p13targetpath = joinPaths(p13filetree.path, p13filetree.dir[x].n).split('\\').join('/');
2213
- files.send(JSON.stringify({ action: 'ls', reqid: 1, path: p13targetpath }));
2212
+ files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
2213
}
2214
2215
function p13folderup(x) {
2216
if (x == null) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
2217
p13targetpath = p13filetreelocation.join('/');
2219
- files.send(JSON.stringify({ action: 'ls', reqid: 1, path: p13targetpath }));
2218
+ files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
2219
}
2220
2221
var p13sortorder;
@@ -2267,11 +2266,11 @@
2266
function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; }
2267
function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); }
2268
function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />'); focusTextBox('p13renameinput'); p13fileNameCheck(); }
2270
- function p13createfolderEx() { files.send(JSON.stringify({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value })); p13folderup(999); }
2269
+ function p13createfolderEx() { files.sendText({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value }); p13folderup(999); }
2270
function p13deletefile() { var cc = getFileSelCount(); setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1)?('Delete ' + cc + ' selected items?'):('Delete selected item?')); }
2272
- function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.send(JSON.stringify({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles })); p13folderup(999); }
2271
+ function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles }); p13folderup(999); }
2272
function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = p13filetree.dir[checkboxes[i].value].n; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="' + renamefile + '" />', { action: 'rename', path: p13filetreelocation.join('/'), oldname: renamefile}); focusTextBox('p13renameinput'); p13fileNameCheck(); }
2274
- function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.send(JSON.stringify(t)); p13folderup(999); }
2273
+ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); }
2274
function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } }
2275
function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, '<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p13uploadinput\')" />'); updateUploadDialogOk('p13uploadinput'); }
2276
function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); }
@@ -2279,7 +2278,7 @@
2278
var p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0;
2279
function p13copyFile(cut) { var checkboxes = document.getElementsByName('fd'); p13clipboard = []; p13clipboardCut = cut, p13clipboardFolder = p13targetpath; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p13clipboard.push(p13filetree.dir[checkboxes[i].value].n); } } p13updateClipview(); }
2280
function p13pasteFile() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Confim ' + (p13clipboardCut == 0?'copy':'move') + ' of ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' to this location?' } setDialogMode(2, "Paste", 3, p13pasteFileEx, x); }
2282
- function p13pasteFileEx() { files.send(JSON.stringify({ action: (p13clipboardCut == 0?'copy':'move'), reqid: 1, scpath: p13clipboardFolder, dspath: p13targetpath, names: p13clipboard })); p13folderup(999); if (p13clipboardCut == 1) { p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; p13updateClipview(); } }
2281
+ function p13pasteFileEx() { files.sendText({ action: (p13clipboardCut == 0?'copy':'move'), reqid: 1, scpath: p13clipboardFolder, dspath: p13targetpath, names: p13clipboard }); p13folderup(999); if (p13clipboardCut == 1) { p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; p13updateClipview(); } }
2282
function p13updateClipview() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Holding ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' for ' + (p13clipboardCut == 0?'copy':'move') + ', <a onclick=p13clearClip() style=cursor:pointer>Clear</a>.' } QH('p13bottomstatus', x); p13setActions(); }
2283
function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); }
2284
function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); }
@@ -2297,18 +2296,18 @@
2296
if (xxdialogMode || downloadFile || !files) return;
2297
downloadFile = { path: decodeURIComponent(x), file: decodeURIComponent(y), size: z, tsize: 0, data: '', state: 0, id: Math.random() }
2298
//console.log('p13downloadFileCancel', downloadFile);
2300
- files.send(JSON.stringify({ action: 'download', sub: 'start', id: downloadFile.id, path: downloadFile.path }));
2299
+ files.sendText({ action: 'download', sub: 'start', id: downloadFile.id, path: downloadFile.path });
2300
setDialogMode(2, "Download File", 10, p13downloadFileCancel, '<div>' + downloadFile.file + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
2301
}
2302
2303
// Called by the html page to cancel the download
2305
- function p13downloadFileCancel() { setDialogMode(0); files.send(JSON.stringify({ action: 'download', sub: 'cancel', id: downloadFile.id })); downloadFile = null; }
2304
+ function p13downloadFileCancel() { setDialogMode(0); files.sendText({ action: 'download', sub: 'cancel', id: downloadFile.id }); downloadFile = null; }
2305
2306
// Called by the transport when download control command is received
2307
function p13gotDownloadCommand(cmd) {
2308
//console.log('p13gotDownloadCommand', cmd);
2309
if ((downloadFile == null) || (cmd.id != downloadFile.id)) return;
2311
- if (cmd.sub == 'start') { downloadFile.state = 1; files.send(JSON.stringify({ action: 'download', sub: 'startack', id: downloadFile.id })); }
2310
+ if (cmd.sub == 'start') { downloadFile.state = 1; files.sendText({ action: 'download', sub: 'startack', id: downloadFile.id }); }
2311
else if (cmd.sub == 'cancel') { downloadFile = null; setDialogMode(0); }
2312
}
2313
@@ -2323,7 +2322,7 @@
2322
if ((ReadInt(data, 0) & 1) != 0) { // Check end flag
2323
saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file
2324
} else {
2326
- files.send(JSON.stringify({ action: 'download', sub: 'ack', id: downloadFile.id })); // Send the ACK
2325
+ files.sendText({ action: 'download', sub: 'ack', id: downloadFile.id }); // Send the ACK
2326
}
2327
}
2328
@@ -2434,7 +2433,7 @@
2433
uploadFile.xreader = new FileReader();
2434
uploadFile.xreader.onload = function() {
2435
uploadFile.xdata = uploadFile.xreader.result;
2437
- uploadFile.ws.send(JSON.stringify({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength }));
2436
+ uploadFile.ws.sendText({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength });
2437
};
2438
uploadFile.xreader.readAsArrayBuffer(file);
2439
} else {
views/default.handlebars
+2
-3
@@ -3916,8 +3916,7 @@
3916
p13updateFiles(checkedNames);
3917
} else {
3918
// Make both paths use the same seperator not start with /
3919
- var x1 = data.path.replace(/\//g, "\\");
3920
- var x2 = p13targetpath.replace(/\//g, "\\");
3919
+ var x1 = data.path.replace(/\//g, "\\"), x2 = p13targetpath.replace(/\//g, "\\");
3920
while ((x1.length > 0) && (x1[0] == '\\')) { x1 = x1.substring(1); }
3921
while ((x2.length > 0) && (x2[0] == '\\')) { x2 = x2.substring(1); }
3922
if ((x1 == x2) || ((data.path == '\\') && (p13targetpath == ''))) {
@@ -4240,7 +4239,7 @@
4239
uploadFile.xreader = new FileReader();
4240
uploadFile.xreader.onload = function() {
4241
uploadFile.xdata = uploadFile.xreader.result;
4243
- uploadFile.ws.send(JSON.stringify({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength }));
4242
+ uploadFile.ws.sendText(JSON.stringify({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength }));
4243
};
4244
uploadFile.xreader.readAsArrayBuffer(file);
4245
} else {