UI: Escape translated strings in JS (#6373)

Fixes #6370.
This commit is contained in:
d11n 2024-11-12 03:16:56 +01:00 committed by GitHub
parent d0779b88e0
commit e80296fa85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View file

@ -255,15 +255,15 @@ function initCameraScanningApp(title, onDataSubmit, modalId, submitOnScan = fals
if (error.name === 'StreamApiNotSupportedError') {
this.noStreamApiSupport = true;
} else if (error.name === 'NotAllowedError') {
this.errorMessage = @StringLocalizer["A permission to the camera is needed to scan the QR code. Please grant the browser access and then retry."]
this.errorMessage = @Safe.Json(StringLocalizer["A permission to the camera is needed to scan the QR code. Please grant the browser access and then retry."])
} else if (error.name === 'NotFoundError') {
this.errorMessage = @StringLocalizer["A camera was not detected on your device."]
this.errorMessage = @Safe.Json(StringLocalizer["A camera was not detected on your device."])
} else if (error.name === 'NotSupportedError') {
this.errorMessage = @StringLocalizer["This page is served in non-secure context (HTTPS, localhost or file://)"]
this.errorMessage = @Safe.Json(StringLocalizer["This page is served in non-secure context (HTTPS, localhost or file://)"])
} else if (error.name === 'NotReadableError') {
this.errorMessage = @StringLocalizer["Could not access your camera. Is it already in use?"]
this.errorMessage = @Safe.Json(StringLocalizer["Could not access your camera. Is it already in use?"])
} else if (error.name === 'OverconstrainedError') {
this.errorMessage = @StringLocalizer["Constraints do not match any installed camera."]
this.errorMessage = @Safe.Json(StringLocalizer["Constraints do not match any installed camera."])
} else {
this.errorMessage = 'UNKNOWN ERROR: ' + error.message
}

View file

@ -1,4 +1,3 @@
@inject BTCPayServer.Security.ContentSecurityPolicies csp
@using Microsoft.AspNetCore.Mvc.ModelBinding
@using BTCPayServer.Controllers
@using BTCPayServer.Services
@ -12,7 +11,7 @@
var backUrl = Model.BackUrl != null ? $"{Model.BackUrl}?returnUrl={Model.ReturnUrl}" : null;
Layout = "_LayoutWizard";
ViewData.SetActivePage(WalletsNavPages.Send, StringLocalizer["Send {0}", Model.CryptoCode], walletId);
csp.Add("worker-src", "blob:");
Csp.Add("worker-src", "blob:");
Csp.UnsafeEval();
}