add oldStyle to consentMessages as workaround for win-userconsent crashing #6290
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Sep 10, 2024 at 11:01 UTC
1d04a13a6417fec53c44ec8d7c81d4fb391f9d29
6 files changed
+23
-4
agents/meshcore.js
+10
-3
@@ -1158,6 +1158,7 @@ function handleServerCommand(data) {
1158
tunnel.soptions = data.soptions;
1159
tunnel.consentTimeout = (tunnel.soptions && tunnel.soptions.consentTimeout) ? tunnel.soptions.consentTimeout : 30;
1160
tunnel.consentAutoAccept = (tunnel.soptions && (tunnel.soptions.consentAutoAccept === true));
1161
+ tunnel.oldStyle = (tunnel.soptions && tunnel.soptions.oldStyle) ? tunnel.soptions.oldStyle : false;
1162
tunnel.tcpaddr = data.tcpaddr;
1163
tunnel.tcpport = data.tcpport;
1164
tunnel.udpaddr = data.udpaddr;
@@ -2836,7 +2837,9 @@ function onTunnelData(data)
2837
if (process.platform == 'win32')
2838
{
2839
var enhanced = false;
2839
- try { require('win-userconsent'); enhanced = true; } catch (ex) { }
2840
+ if (this.httprequest.oldStyle === false) {
2841
+ try { require('win-userconsent'); enhanced = true; } catch (ex) { }
2842
+ }
2843
if (enhanced)
2844
{
2845
var ipr = server_getUserImage(this.httprequest.userid);
@@ -3000,7 +3003,9 @@ function onTunnelData(data)
3003
if (process.platform == 'win32')
3004
{
3005
var enhanced = false;
3003
- try { require('win-userconsent'); enhanced = true; } catch (ex) { }
3006
+ if (this.httprequest.oldStyle === false) {
3007
+ try { require('win-userconsent'); enhanced = true; } catch (ex) { }
3008
+ }
3009
if (enhanced)
3010
{
3011
var ipr = server_getUserImage(this.httprequest.userid);
@@ -3153,7 +3158,9 @@ function onTunnelData(data)
3158
if (process.platform == 'win32')
3159
{
3160
var enhanced = false;
3156
- try { require('win-userconsent'); enhanced = true; } catch (ex) { }
3161
+ if (this.httprequest.oldStyle === false) {
3162
+ try { require('win-userconsent'); enhanced = true; } catch (ex) { }
3163
+ }
3164
if (enhanced)
3165
{
3166
var ipr = server_getUserImage(this.httprequest.userid);
meshcentral-config-schema.json
+5
@@ -1870,6 +1870,11 @@
1870
"type": "boolean",
1871
"default": false,
1872
"description": "If true, user consent is accepted after the timeout."
1873
+ },
1874
+ "oldStyle": {
1875
+ "type": "boolean",
1876
+ "default": false,
1877
+ "description": "If true, user consent will be shown in an old style prompt box rather than the new style consent-box."
1878
}
1879
}
1880
},
meshdesktopmultiplex.js
+1
@@ -1347,6 +1347,7 @@ function CreateMeshRelayEx2(parent, ws, req, domain, user, cookie) {
1347
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
1348
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
1349
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
1350
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
1351
}
1352
if (typeof domain.notificationmessages == 'object') {
1353
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
meshrelay.js
+4
@@ -893,6 +893,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
893
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
894
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
895
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
896
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
897
}
898
if (typeof domain.notificationmessages == 'object') {
899
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
@@ -930,6 +931,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
931
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
932
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
933
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
934
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
935
}
936
if (typeof domain.notificationmessages == 'object') {
937
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
@@ -948,6 +950,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
950
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
951
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
952
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
953
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
954
}
955
if (typeof domain.notificationmessages == 'object') {
956
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
@@ -999,6 +1002,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
1002
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
1003
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
1004
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
1005
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
1006
}
1007
if (typeof domain.notificationmessages == 'object') {
1008
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
meshuser.js
+1
@@ -997,6 +997,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
997
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
998
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
999
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
1000
+ if (domain.consentmessages.oldstyle === true) { command.soptions.oldStyle = true; }
1001
}
1002
if (typeof domain.notificationmessages == 'object') {
1003
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
sample-config-advanced.json
+2
-1
@@ -338,7 +338,8 @@
338
"terminal": "{0} requesting remote terminal access. Grant access?",
339
"files": "{0} requesting remote files access. Grant access?",
340
"consentTimeout": 30,
341
- "autoAcceptOnTimeout": false
341
+ "autoAcceptOnTimeout": false,
342
+ "oldStyle": true
343
},
344
"_notificationMessages": {
345
"title": "MeshCentral",