Made changes needed to support Android agent.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-18 01:09:33 -08:00
parent e2368bf7ff
commit e1804bce97
3 changed files with 39 additions and 35 deletions

View File

@ -5058,7 +5058,7 @@
"ru": "Android",
"tr": "Android",
"zh-chs": "Android",
"zh-cht": "Android"
"zh-cht": "Android",
"xloc": [
"default-mobile.handlebars->11->20",
"default.handlebars->31->22",
@ -11727,9 +11727,11 @@
"default.handlebars->31->611"
]
},
{
"en": "Desktop, Alleen kijken"
},
{
"en": "Desktop, View only",
"en": "Desktop, Alleen kijken",
"xloc": [
"default.handlebars->31->750"
]

View File

@ -3848,7 +3848,7 @@
function p13gotFiles(data) {
if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; } // This is ok because 4 first bytes is a control value.
//console.log('p13gotFiles', data);
data = JSON.parse(decode_utf8(data));
try { data = JSON.parse(decode_utf8(data)); } catch (ex) { data = JSON.parse(data); }
if (data.action == 'download') { p13gotDownloadCommand(data); return; }
// Process file upload commands
@ -3960,6 +3960,7 @@
}
function p13setActions() {
var advancedFeatures = (currentNode.agent.id != 14); // Reduct file feature on some devices.
if (p13filetree == null) {
QE('p13DeleteFileButton', false);
QE('p13NewFolderButton', false);
@ -3974,16 +3975,16 @@
} else {
var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13DeleteFileButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', advancedFeatures && (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All");
QE('p13RefreshButton', true);
QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
}
}

View File

@ -4357,9 +4357,7 @@
if (xxdialogMode) return false;
var mesh = meshes[meshid], x = '', installType = 0, moreoptions = '';
var opts = '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=5>' + "Linux / BSD / macOS Binary Installer" + '</option><option value=2>' + "Apple macOS" + '</option>';
if (debugmode > 0) { opts += '<option value=6>' + "Mobile device" + '</option>'; }
opts += '<option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option></select>';
var opts = '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=5>' + "Linux / BSD / macOS Binary Installer" + '</option><option value=2>' + "Apple macOS" + '</option><option value=6>' + "Mobile device" + '</option><option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option></select>';
x += addHtmlValue("Operating System", opts);
var servername = serverinfo.name;
@ -4424,13 +4422,11 @@
setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');
// Create the QR code
if (debugmode > 0) {
var servername = serverinfo.name;
if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
new QRCode(Q('agins_qrimage'), { text: 'mc://' + servername + portStr + domainUrlNoSlash + ',' + serverinfo.agentCertHash + ',' + meshid.split('/')[2], width: 180, height: 180, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.M });
}
if (serverinfo.https == true)
{
@ -8308,7 +8304,7 @@
function p13gotFiles(data) {
if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; } // This is ok because 4 first bytes is a control value.
//console.log('p13gotFiles', data);
data = JSON.parse(decode_utf8(data));
try { data = JSON.parse(decode_utf8(data)); } catch (ex) { data = JSON.parse(data); }
if (data.action == 'download') { p13gotDownloadCommand(data); return; }
// Find file result
@ -8397,7 +8393,11 @@
// Figure out the date
var fdatestr = '';
if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + '&nbsp;'; }
if (f.d != null) {
var fdate = new Date(f.d);
if (typeof f.d == 'number') { fdate = new Date(f.d * 1000); }
var fdatestr = printDateTime(fdate) + '&nbsp;';
}
// Figure out the size
var fsize = '';
@ -8492,6 +8492,7 @@
}
function p13setActions() {
var advancedFeatures = (currentNode.agent.id != 14); // Reduct file feature on some devices.
if (p13filetree == null) {
QE('p13DeleteFileButton', false);
QE('p13NewFolderButton', false);
@ -8509,19 +8510,19 @@
} else {
var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ViewFileButton', (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13DeleteFileButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', advancedFeatures && (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ViewFileButton', advancedFeatures && (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? "Select None" : "Select All");
QE('p13RefreshButton', true);
QE('p13FindButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ZipButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
QE('p13FindButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ZipButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
}
}
@ -8605,7 +8606,7 @@
haltEvent(e);
QV('p13bigfail', false);
QV('p13bigok', false);
if (e.dataTransfer == null || e.dataTransfer.files.length == 0 || p13filetree == null) return;
if ((e.dataTransfer == null) || (e.dataTransfer.files.length == 0) || (p13filetree == null) || (currentNode.agent.id == 14)) return;
// Check if these are files we can upload, remove all folders.
var files = [];
@ -8619,7 +8620,7 @@
function p13fileDragOver(e) {
haltEvent(e);
if (p13dragtimer != null) { clearTimeout(p13dragtimer); p13dragtimer = null; }
var ac = (p13filetree != null); // Set to true if we can accept the file
var ac = (p13filetree != null) && (currentNode.agent.id != 14); // Set to true if we can accept the file
QV('p13bigok', ac);
QV('p13bigfail', !ac);
}