fix meshctrl shell unable to route and powershell terminal #7700

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Mar 21, 2026 at 16:38 UTC 0305a474de26dfe571cc1a9fc3485a2b255fb71a
1 file changed +3 -2
meshctrl.js
+3 -2
@@ -2132,7 +2132,8 @@ function serverConnect() {
2132 if ((settings.cmd == 'shell') || (settings.cmd == 'upload') || (settings.cmd == 'download')) {
2133 var protocol = 1; // Terminal
2134 if ((settings.cmd == 'upload') || (settings.cmd == 'download')) { protocol = 5; } // Files
2135 - if ((args.id.split('/') != 3) && (settings.currentDomain != null)) { args.id = 'node/' + settings.currentDomain + '/' + args.id; }
2135 + if (args.powershell) { protocol = 6; } // PowerShell
2136 + if ((args.id.split('/').length != 3) && (settings.currentDomain != null)) { args.id = 'node/' + settings.currentDomain + '/' + args.id; }
2137 var id = getRandomHex(6);
2138 ws.send(JSON.stringify({ action: 'msg', nodeid: args.id, type: 'tunnel', usage: 1, value: '*/meshrelay.ashx?p=' + protocol + '&nodeid=' + args.id + '&id=' + id + '&rauth=' + data.rcookie, responseid: 'meshctrl' }));
2139 connectTunnel(url.replace('/control.ashx', '/meshrelay.ashx?browser=1&p=' + protocol + '&nodeid=' + encodeURIComponent(args.id) + '&id=' + id + '&auth=' + data.cookie));
@@ -2756,7 +2757,7 @@ function connectTunnel(url) {
2757 if (typeof process.stdout.getWindowSize == 'function') { termSize = process.stdout.getWindowSize(); }
2758 if (termSize != null) { settings.tunnelws.send(JSON.stringify({ ctrlChannel: '102938', type: 'options', cols: termSize[0], rows: termSize[1] })); }
2759 settings.tunnelwsstate = 1;
2759 - settings.tunnelws.send('1'); // Terminal
2760 + settings.tunnelws.send((args.powershell ? 6 : 1)); // Powershell or Terminal
2761 process.stdin.setEncoding('utf8');
2762 process.stdin.setRawMode(true);
2763 process.stdout.setEncoding('utf8');