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

View File

@ -3848,7 +3848,7 @@
function p13gotFiles(data) { 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. 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); //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; } if (data.action == 'download') { p13gotDownloadCommand(data); return; }
// Process file upload commands // Process file upload commands
@ -3960,6 +3960,7 @@
} }
function p13setActions() { function p13setActions() {
var advancedFeatures = (currentNode.agent.id != 14); // Reduct file feature on some devices.
if (p13filetree == null) { if (p13filetree == null) {
QE('p13DeleteFileButton', false); QE('p13DeleteFileButton', false);
QE('p13NewFolderButton', false); QE('p13NewFolderButton', false);
@ -3974,16 +3975,16 @@
} else { } 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 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)); var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13DeleteFileButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13UploadButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13RenameFileButton', advancedFeatures && (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13SelectAllButton', tc > 0); QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All"); Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All");
QE('p13RefreshButton', true); QE('p13RefreshButton', true);
QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0))); QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
} }
} }

View File

@ -4357,9 +4357,7 @@
if (xxdialogMode) return false; if (xxdialogMode) return false;
var mesh = meshes[meshid], x = '', installType = 0, moreoptions = ''; 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>'; 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>';
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>';
x += addHtmlValue("Operating System", opts); x += addHtmlValue("Operating System", opts);
var servername = serverinfo.name; var servername = serverinfo.name;
@ -4424,13 +4422,11 @@
setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload'); setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');
// Create the QR code // Create the QR code
if (debugmode > 0) { var servername = serverinfo.name;
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.
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 domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1); var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
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 });
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) if (serverinfo.https == true)
{ {
@ -8308,7 +8304,7 @@
function p13gotFiles(data) { 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. 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); //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; } if (data.action == 'download') { p13gotDownloadCommand(data); return; }
// Find file result // Find file result
@ -8397,7 +8393,11 @@
// Figure out the date // Figure out the date
var fdatestr = ''; 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 // Figure out the size
var fsize = ''; var fsize = '';
@ -8492,6 +8492,7 @@
} }
function p13setActions() { function p13setActions() {
var advancedFeatures = (currentNode.agent.id != 14); // Reduct file feature on some devices.
if (p13filetree == null) { if (p13filetree == null) {
QE('p13DeleteFileButton', false); QE('p13DeleteFileButton', false);
QE('p13NewFolderButton', false); QE('p13NewFolderButton', false);
@ -8509,19 +8510,19 @@
} else { } 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 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)); var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13DeleteFileButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13UploadButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13RenameFileButton', advancedFeatures && (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ViewFileButton', (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13ViewFileButton', advancedFeatures && (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13SelectAllButton', tc > 0); QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? "Select None" : "Select All"); Q('p13SelectAllButton').value = (cc > 0 ? "Select None" : "Select All");
QE('p13RefreshButton', true); QE('p13RefreshButton', true);
QE('p13FindButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13FindButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13ZipButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13ZipButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0))); QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
} }
} }
@ -8605,7 +8606,7 @@
haltEvent(e); haltEvent(e);
QV('p13bigfail', false); QV('p13bigfail', false);
QV('p13bigok', 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. // Check if these are files we can upload, remove all folders.
var files = []; var files = [];
@ -8619,7 +8620,7 @@
function p13fileDragOver(e) { function p13fileDragOver(e) {
haltEvent(e); haltEvent(e);
if (p13dragtimer != null) { clearTimeout(p13dragtimer); p13dragtimer = null; } 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('p13bigok', ac);
QV('p13bigfail', !ac); QV('p13bigfail', !ac);
} }