refix placeholder {0}{1} #7037

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2025-05-20 23:29:32 +01:00
parent 4afe0fe3f9
commit fc32e1c261

View File

@ -2314,11 +2314,11 @@ function terminal_end()
function terminal_consent_ask(ws) { function terminal_consent_ask(ws) {
ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 }));
var consentMessage = currentTranslation['terminalConsent'].replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); var consentMessage = currentTranslation['terminalConsent'].replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username);
var consentTitle = 'MeshCentral'; var consentTitle = 'MeshCentral';
if (ws.httprequest.soptions != null) { if (ws.httprequest.soptions != null) {
if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; }
if (ws.httprequest.soptions.consentMsgTerminal != null) { consentMessage = ws.httprequest.soptions.consentMsgTerminal.replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); } if (ws.httprequest.soptions.consentMsgTerminal != null) { consentMessage = ws.httprequest.soptions.consentMsgTerminal.replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username); }
} }
if (process.platform == 'win32') { if (process.platform == 'win32') {
var enhanced = false; var enhanced = false;
@ -2417,12 +2417,12 @@ function terminal_promise_connection_resolved(term)
if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 2)) if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 2))
{ {
// User Notifications is required // User Notifications is required
var notifyMessage = currentTranslation['terminalNotify'].replaceAll('{0}', this.ws.httprequest.realname ? this.ws.httprequest.realname : this.ws.httprequest.username); var notifyMessage = currentTranslation['terminalNotify'].replace(/\{0\}/g, this.ws.httprequest.realname ? this.ws.httprequest.realname : this.ws.httprequest.username);
var notifyTitle = "MeshCentral"; var notifyTitle = "MeshCentral";
if (this.ws.httprequest.soptions != null) if (this.ws.httprequest.soptions != null)
{ {
if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; }
if (this.ws.httprequest.soptions.notifyMsgTerminal != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgTerminal.replaceAll('{0}', this.ws.httprequest.realname).replaceAll('{1}', this.ws.httprequest.username); } if (this.ws.httprequest.soptions.notifyMsgTerminal != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgTerminal.replace(/\{0\}/g, this.ws.httprequest.realname).replace(/\{1\}/g, this.ws.httprequest.username); }
} }
try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { }
} }
@ -2646,7 +2646,7 @@ function tunnel_kvm_end()
this.httprequest.desktop.kvm.users.splice(i, 1); this.httprequest.desktop.kvm.users.splice(i, 1);
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
this.httprequest.desktop.kvm.connectionBar.close(); this.httprequest.desktop.kvm.connectionBar.close();
this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replaceAll('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replaceAll('{1}', this.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace(/\{0\}/g, this.httprequest.desktop.kvm.rusers.join(', ')).replace(/\{1\}/g, this.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options);
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest; this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
this.httprequest.desktop.kvm.connectionBar.on('close', function () this.httprequest.desktop.kvm.connectionBar.on('close', function ()
{ {
@ -2682,11 +2682,11 @@ function kvm_consent_ok(ws) {
if (ws.httprequest.consent && (ws.httprequest.consent & 1)){ if (ws.httprequest.consent && (ws.httprequest.consent & 1)){
// User Notifications is required // User Notifications is required
MeshServerLogEx(35, null, "Started remote desktop with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); MeshServerLogEx(35, null, "Started remote desktop with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest);
var notifyMessage = currentTranslation['desktopNotify'].replaceAll('{0}', ws.httprequest.realname); var notifyMessage = currentTranslation['desktopNotify'].replace(/\{0\}/g, ws.httprequest.realname);
var notifyTitle = "MeshCentral"; var notifyTitle = "MeshCentral";
if (ws.httprequest.soptions != null) { if (ws.httprequest.soptions != null) {
if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; } if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; }
if (ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = ws.httprequest.soptions.notifyMsgDesktop.replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); } if (ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = ws.httprequest.soptions.notifyMsgDesktop.replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username); }
} }
try { require('toaster').Toast(notifyTitle, notifyMessage, ws.tsid); } catch (ex) { } try { require('toaster').Toast(notifyTitle, notifyMessage, ws.tsid); } catch (ex) { }
} else { } else {
@ -2699,7 +2699,7 @@ function kvm_consent_ok(ws) {
ws.httprequest.desktop.kvm.connectionBar.close(); ws.httprequest.desktop.kvm.connectionBar.close();
} }
try { try {
ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(ws.httprequest.privacybartext.replaceAll('{0}', ws.httprequest.desktop.kvm.rusers.join(', ')).replaceAll('{1}', ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(ws.httprequest.privacybartext.replace(/\{0\}/g, ws.httprequest.desktop.kvm.rusers.join(', ')).replace(/\{1\}/g, ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options);
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + ws.httprequest.remoteaddr + ")", ws.httprequest); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + ws.httprequest.remoteaddr + ")", ws.httprequest);
} catch (ex) { } catch (ex) {
MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + ws.httprequest.remoteaddr + ")", ws.httprequest); MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + ws.httprequest.remoteaddr + ")", ws.httprequest);
@ -2733,11 +2733,11 @@ function kvm_consent_ok(ws) {
function kvm_consent_ask(ws){ function kvm_consent_ask(ws){
// Send a console message back using the console channel, "\n" is supported. // Send a console message back using the console channel, "\n" is supported.
ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 }));
var consentMessage = currentTranslation['desktopConsent'].replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); var consentMessage = currentTranslation['desktopConsent'].replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username);
var consentTitle = 'MeshCentral'; var consentTitle = 'MeshCentral';
if (ws.httprequest.soptions != null) { if (ws.httprequest.soptions != null) {
if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; }
if (ws.httprequest.soptions.consentMsgDesktop != null) { consentMessage = ws.httprequest.soptions.consentMsgDesktop.replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); } if (ws.httprequest.soptions.consentMsgDesktop != null) { consentMessage = ws.httprequest.soptions.consentMsgDesktop.replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username); }
} }
var pr; var pr;
if (process.platform == 'win32') { if (process.platform == 'win32') {
@ -2794,12 +2794,12 @@ function kvm_consentpromise_resolved(always)
if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 1)) if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 1))
{ {
// User Notifications is required // User Notifications is required
var notifyMessage = currentTranslation['desktopNotify'].replaceAll('{0}', this.ws.httprequest.realname); var notifyMessage = currentTranslation['desktopNotify'].replace(/\{0\}/g, this.ws.httprequest.realname);
var notifyTitle = "MeshCentral"; var notifyTitle = "MeshCentral";
if (this.ws.httprequest.soptions != null) if (this.ws.httprequest.soptions != null)
{ {
if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; }
if (this.ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgDesktop.replaceAll('{0}', this.ws.httprequest.realname).replaceAll('{1}', this.ws.httprequest.username); } if (this.ws.httprequest.soptions.notifyMsgDesktop != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgDesktop.replace(/\{0\}/g, this.ws.httprequest.realname).replace(/\{1\}/g, this.ws.httprequest.username); }
} }
try { require('toaster').Toast(notifyTitle, notifyMessage, tsid); } catch (ex) { } try { require('toaster').Toast(notifyTitle, notifyMessage, tsid); } catch (ex) { }
} }
@ -2813,7 +2813,7 @@ function kvm_consentpromise_resolved(always)
} }
try try
{ {
this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replaceAll('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replaceAll('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options); this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace(/\{0\}/g, this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace(/\{1\}/g, this.ws.httprequest.desktop.kvm.users.join(', ')).replace(/'/g, "\\'\\"), require('MeshAgent')._tsid, color_options);
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
} catch (ex) } catch (ex)
{ {
@ -2856,11 +2856,11 @@ function files_consent_ok(ws){
if (ws.httprequest.consent && (ws.httprequest.consent & 4)) { if (ws.httprequest.consent && (ws.httprequest.consent & 4)) {
// User Notifications is required // User Notifications is required
MeshServerLogEx(42, null, "Started remote files with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest); MeshServerLogEx(42, null, "Started remote files with toast notification (" + ws.httprequest.remoteaddr + ")", ws.httprequest);
var notifyMessage = currentTranslation['fileNotify'].replaceAll('{0}', ws.httprequest.realname); var notifyMessage = currentTranslation['fileNotify'].replace(/\{0\}/g, ws.httprequest.realname);
var notifyTitle = "MeshCentral"; var notifyTitle = "MeshCentral";
if (ws.httprequest.soptions != null) { if (ws.httprequest.soptions != null) {
if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; } if (ws.httprequest.soptions.notifyTitle != null) { notifyTitle = ws.httprequest.soptions.notifyTitle; }
if (ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = ws.httprequest.soptions.notifyMsgFiles.replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); } if (ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = ws.httprequest.soptions.notifyMsgFiles.replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username); }
} }
try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { }
} else { } else {
@ -2872,12 +2872,12 @@ function files_consent_ok(ws){
function files_consent_ask(ws){ function files_consent_ask(ws){
// Send a console message back using the console channel, "\n" is supported. // Send a console message back using the console channel, "\n" is supported.
ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 })); ws.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: "Waiting for user to grant access...", msgid: 1 }));
var consentMessage = currentTranslation['fileConsent'].replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); var consentMessage = currentTranslation['fileConsent'].replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username);
var consentTitle = 'MeshCentral'; var consentTitle = 'MeshCentral';
if (ws.httprequest.soptions != null) { if (ws.httprequest.soptions != null) {
if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; } if (ws.httprequest.soptions.consentTitle != null) { consentTitle = ws.httprequest.soptions.consentTitle; }
if (ws.httprequest.soptions.consentMsgFiles != null) { consentMessage = ws.httprequest.soptions.consentMsgFiles.replaceAll('{0}', ws.httprequest.realname).replaceAll('{1}', ws.httprequest.username); } if (ws.httprequest.soptions.consentMsgFiles != null) { consentMessage = ws.httprequest.soptions.consentMsgFiles.replace(/\{0\}/g, ws.httprequest.realname).replace(/\{1\}/g, ws.httprequest.username); }
} }
var pr; var pr;
if (process.platform == 'win32') { if (process.platform == 'win32') {
@ -2923,12 +2923,12 @@ function files_consentpromise_resolved(always)
if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 4)) if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 4))
{ {
// User Notifications is required // User Notifications is required
var notifyMessage = currentTranslation['fileNotify'].replaceAll('{0}', this.ws.httprequest.realname); var notifyMessage = currentTranslation['fileNotify'].replace(/\{0\}/g, this.ws.httprequest.realname);
var notifyTitle = "MeshCentral"; var notifyTitle = "MeshCentral";
if (this.ws.httprequest.soptions != null) if (this.ws.httprequest.soptions != null)
{ {
if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; } if (this.ws.httprequest.soptions.notifyTitle != null) { notifyTitle = this.ws.httprequest.soptions.notifyTitle; }
if (this.ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgFiles.replaceAll('{0}', this.ws.httprequest.realname).replaceAll('{1}', this.ws.httprequest.username); } if (this.ws.httprequest.soptions.notifyMsgFiles != null) { notifyMessage = this.ws.httprequest.soptions.notifyMsgFiles.replace(/\{0\}/g, this.ws.httprequest.realname).replace(/\{1\}/g, this.ws.httprequest.username); }
} }
try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { } try { require('toaster').Toast(notifyTitle, notifyMessage); } catch (ex) { }
} }