Fixed SFTP Connect button and SSH/SFTP connection on non-default domains.
Ylian Saint-Hilaire committed
Jul 15, 2022 at 13:24 UTC
cd99f810648d1e6b00776a1a8f86a1707e9108f8
2 files changed
+6
-2
apprelays.js
+4
@@ -414,6 +414,7 @@ module.exports.CreateWebRelay = function (parent, db, args, domain) {
414
var domainadd = '';
415
if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' }
416
const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=14&auth=' + cookie; // Protocol 14 is Web-TCP
417
+ if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument.
418
parent.parent.parent.debug('relay', 'TCP: Connection websocket to ' + url);
419
obj.wsClient = new WebSocket(url, options);
420
obj.wsClient.on('open', function () { parent.parent.parent.debug('relay', 'TCP: Relay websocket open'); });
@@ -1156,6 +1157,7 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) {
1157
var domainadd = '';
1158
if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' }
1159
const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + obj.xcookie; // Protocol 11 is Web-SSH
1160
+ if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument.
1161
parent.parent.debug('relay', 'SSH: Connection websocket to ' + url);
1162
obj.wsClient = new WebSocket(url, options);
1163
obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); });
@@ -1494,6 +1496,7 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u
1496
var domainadd = '';
1497
if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' }
1498
const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=11&auth=' + authCookie // Protocol 11 is Web-SSH
1499
+ if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument.
1500
parent.parent.debug('relay', 'SSH: Connection websocket to ' + url);
1501
obj.wsClient = new WebSocket(url, options);
1502
obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); });
@@ -1847,6 +1850,7 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user
1850
var domainadd = '';
1851
if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' }
1852
const url = protocol + '://localhost:' + args.port + '/' + domainadd + (((obj.mtype == 3) && (obj.relaynodeid == null)) ? 'local' : 'mesh') + 'relay.ashx?p=13&auth=' + authCookie // Protocol 13 is Web-SSH-Files
1853
+ if (domain.id != '') { url += '&domainid=' + domain.id; } // Since we are using "localhost", we are going to signal what domain we are on using a URL argument.
1854
parent.parent.debug('relay', 'SSH: Connection websocket to ' + url);
1855
obj.wsClient = new WebSocket(url, options);
1856
obj.wsClient.on('open', function () { parent.parent.debug('relay', 'SSH: Relay websocket open'); });
views/default.handlebars
+2
-2
@@ -10182,7 +10182,7 @@
10182
QE('p13Connect', online);
10183
QE('p13Connects', online);
10184
QV('p13Connect', (files == null) && (filesNode.mtype == 2));
10185
- QV('p13Connects', (features2 & 0x200) && (files == null) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4) && ((features2 & 0x800000) == 0));
10185
+ QV('p13Connects', ((features2 & 0x200) != 0) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4) && ((features2 & 0x800000) == 0));
10186
QV('p13Disconnect', files != null);
10187
if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
10188
p13setActions();
@@ -10190,7 +10190,7 @@
10190
10191
function onFilesStateChange(xfiles, state) {
10192
QV('p13Connect', (state == 0) && (files == null) && (filesNode.mtype == 2));
10193
- QV('p13Connects', (state == 0) && (files == null) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4));
10193
+ QV('p13Connects', (state == 0) && (features2 & 0x200) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4) && ((features2 & 0x800000) == 0));
10194
QV('p13Disconnect', state != 0);
10195
var str = StatusStrs[state];
10196
if (state == 3) {