fix autoAcceptOnTimeout with oldStyle #7036
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
May 20, 2025 at 23:55 UTC
45ec1998392ef83643298c5f26a6c6d58ea84767
1 file changed
+21
-5
agents/meshcore.js
+21
-5
@@ -2431,11 +2431,19 @@ function terminal_promise_connection_resolved(term)
2431
function terminal_promise_consent_rejected(e)
2432
{
2433
// DO NOT start terminal
2434
- this.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 }));
2435
- this.that.end();
2436
-
2437
- this.that = null;
2438
- this.httprequest = null;
2434
+ if (this.that) {
2435
+ if(this.that.httprequest){ // User Consent Denied
2436
+ if ((this.that.httprequest.oldStyle === true) && (this.that.httprequest.consentAutoAccept === true) && (e.toString() != "7")) {
2437
+ terminal_promise_consent_resolved.call(this); // oldStyle prompt timed out and User Consent is not required so connect anyway
2438
+ return;
2439
+ }
2440
+ } else { } // Connection was closed server side, maybe log some messages somewhere?
2441
+ this.that.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString(), msgid: 2 }));
2442
+ this.that.end();
2443
+
2444
+ this.that = null;
2445
+ this.httprequest = null;
2446
+ } else { } // no websocket, maybe log some messages somewhere?
2447
}
2448
function promise_init(res, rej) { this._res = res; this._rej = rej; }
2449
function terminal_userpromise_resolved(u)
@@ -2776,6 +2784,10 @@ function kvm_consentpromise_rejected(e)
2784
{
2785
if (this.ws) {
2786
if(this.ws.httprequest){ // User Consent Denied
2787
+ if ((this.ws.httprequest.oldStyle === true) && (this.ws.httprequest.consentAutoAccept === true) && (e.toString() != "7")) {
2788
+ kvm_consentpromise_resolved.call(this); // oldStyle prompt timed out and User Consent is not required so connect anyway
2789
+ return;
2790
+ }
2791
MeshServerLogEx(34, null, "Failed to start remote desktop after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
2792
} else { } // Connection was closed server side, maybe log some messages somewhere?
2793
this.ws._consentpromise = null;
@@ -2939,6 +2951,10 @@ function files_consentpromise_rejected(e)
2951
{
2952
if (this.ws) {
2953
if(this.ws.httprequest){ // User Consent Denied
2954
+ if ((this.ws.httprequest.oldStyle === true) && (this.ws.httprequest.consentAutoAccept === true) && (e.toString() != "7")) {
2955
+ files_consentpromise_resolved.call(this); // oldStyle prompt timed out and User Consent is not required so connect anyway
2956
+ return;
2957
+ }
2958
MeshServerLogEx(41, null, "Failed to start remote files after local user rejected (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
2959
} else { } // Connection was closed server side, maybe log some messages somewhere?
2960
this.ws._consentpromise = null;