asab_webui_shell 27.3.5 → 27.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.escapeHtmlMinimal = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Escapes HTML metacharacters to prevent XSS when interpolated values are rendered
|
|
9
|
+
* in HTML text or attribute contexts. Safe for use with i18next interpolation.
|
|
10
|
+
*
|
|
11
|
+
* Order matters: '&' is replaced first so our own entities are not double-encoded.
|
|
12
|
+
* '/' is intentionally not escaped so paths and URLs remain readable.
|
|
13
|
+
*
|
|
14
|
+
* Covers: & < > " ' and ` (backtick, for attribute context safety).
|
|
15
|
+
* Dont use it this way: dangerouslySetInnerHTML={{ __html: t('some.key') }} as it can lead to XSS vulnerabilities
|
|
16
|
+
*/
|
|
17
|
+
var escapeHtmlMinimal = value => {
|
|
18
|
+
if (value == null) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
var s = String(value);
|
|
22
|
+
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/`/g, '`');
|
|
23
|
+
};
|
|
24
|
+
exports.escapeHtmlMinimal = escapeHtmlMinimal;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes HTML metacharacters to prevent XSS when interpolated values are rendered
|
|
3
|
+
* in HTML text or attribute contexts. Safe for use with i18next interpolation.
|
|
4
|
+
*
|
|
5
|
+
* Order matters: '&' is replaced first so our own entities are not double-encoded.
|
|
6
|
+
* '/' is intentionally not escaped so paths and URLs remain readable.
|
|
7
|
+
*
|
|
8
|
+
* Covers: & < > " ' and ` (backtick, for attribute context safety).
|
|
9
|
+
* Dont use it this way: dangerouslySetInnerHTML={{ __html: t('some.key') }} as it can lead to XSS vulnerabilities
|
|
10
|
+
*/
|
|
11
|
+
export const escapeHtmlMinimal = (value) => {
|
|
12
|
+
if (value == null) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
const s = String(value);
|
|
16
|
+
return s
|
|
17
|
+
.replace(/&/g, '&')
|
|
18
|
+
.replace(/</g, '<')
|
|
19
|
+
.replace(/>/g, '>')
|
|
20
|
+
.replace(/"/g, '"')
|
|
21
|
+
.replace(/'/g, ''')
|
|
22
|
+
.replace(/`/g, '`');
|
|
23
|
+
};
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asab_webui_components = require("asab_webui_components");
|
|
11
11
|
var _axios = _interopRequireDefault(require("axios"));
|
|
12
12
|
var _i18next = _interopRequireDefault(require("i18next"));
|
|
13
13
|
var _i18nextBrowserLanguagedetector = _interopRequireDefault(require("i18next-browser-languagedetector"));
|
|
14
14
|
var _reactI18next = require("react-i18next");
|
|
15
|
+
var _escapeHtmlMinimal = require("./escapeHtmlMinimal.js");
|
|
15
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
18
|
class I18nService extends _asab_webui_components.Service {
|
|
@@ -45,6 +46,12 @@ class I18nService extends _asab_webui_components.Service {
|
|
|
45
46
|
|
|
46
47
|
// Set default key separator
|
|
47
48
|
config.keySeparator = "|";
|
|
49
|
+
|
|
50
|
+
// Keep escaping on
|
|
51
|
+
config.interpolation = _objectSpread(_objectSpread({}, config.interpolation || {}), {}, {
|
|
52
|
+
escapeValue: true,
|
|
53
|
+
escape: _escapeHtmlMinimal.escapeHtmlMinimal
|
|
54
|
+
});
|
|
48
55
|
this.Sources.push(/*#__PURE__*/function () {
|
|
49
56
|
var _ref = (0, _asyncToGenerator2.default)(function* (language, namespace) {
|
|
50
57
|
// This will load locales from the shell application `public/locales` folder
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Custom styling for the browser's find-in-page (Ctrl/Cmd+F) functionality (highlights matches).
|
|
3
|
+
These pseudo-elements are experimental and not supported by all browsers yet. They will silently fail in most browsers.
|
|
4
|
+
(Fully supported by Chrome and Edge as of 02/2026)
|
|
5
|
+
Browser support: https://caniuse.com/mdn-css_selectors_search-text
|
|
6
|
+
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/::search-text
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
@supports selector(::search-text) {
|
|
10
|
+
[data-bs-theme=dark]:root::search-text {
|
|
11
|
+
color: var(--black);
|
|
12
|
+
background-color: rgba(var(--light-honey-rgb), 0.9);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[data-bs-theme=light]:root::search-text {
|
|
16
|
+
color: var(--fiery-sunset);
|
|
17
|
+
background-color: rgba(var(--bright-orange-rgb), 0.25);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// current selected is same in both themes
|
|
21
|
+
:root::search-text:current {
|
|
22
|
+
color: var(--white);
|
|
23
|
+
background-color: rgba(var(--bright-orange-rgb), 0.9);
|
|
24
|
+
text-decoration: underline;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/styles/index.scss
CHANGED