MeshCtrl.js devicesharing improvements.

Ylian Saint-Hilaire committed Oct 8, 2021 at 19:03 UTC 1aacef0b522c601a45e6cd3e9698cf0e184ffd39
2 files changed +10 -1
meshctrl.js
+9 -1
@@ -1870,7 +1870,6 @@ function serverConnect() {
1870 case 'addusertousergroup':
1871 case 'removeuserfromusergroup':
1872 case 'removeDeviceShare':
1873 - case 'createDeviceShareLink':
1873 case 'userbroadcast': { // BROADCAST
1874 if ((settings.cmd == 'shell') || (settings.cmd == 'upload') || (settings.cmd == 'download')) return;
1875 if ((settings.multiresponse != null) && (settings.multiresponse > 1)) { settings.multiresponse--; break; }
@@ -1882,6 +1881,15 @@ function serverConnect() {
1881 }
1882 break;
1883 }
1884 + case 'createDeviceShareLink':
1885 + if (data.result == 'OK') {
1886 + if (data.publicid) { console.log('ID: ' + data.publicid); }
1887 + console.log('URL: ' + data.url);
1888 + } else {
1889 + console.log(data.result);
1890 + }
1891 + process.exit();
1892 + break;
1893 case 'createInviteLink':
1894 if (data.responseid == 'meshctrl') {
1895 if (data.url) { console.log(data.url); }
meshuser.js
+1
@@ -4718,6 +4718,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
4718 var url = 'https://' + serverName + ':' + httpsPort + '/' + xdomain + 'sharing?c=' + inviteCookie;
4719 if (serverName.split('.') == 1) { url = '/' + xdomain + page + '?c=' + inviteCookie; }
4720 command.url = url;
4721 + command.publicid = publicid;
4722 if (command.responseid != null) { command.result = 'OK'; }
4723 try { ws.send(JSON.stringify(command)); } catch (ex) { }
4724