@ntlab/sipd-tu-bridge-ui 1.6.0 → 1.6.1
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.
- package/package.json +1 -1
- package/views/ui/error.ejs +1 -1
- package/views/ui/util.ejs +10 -1
package/package.json
CHANGED
package/views/ui/error.ejs
CHANGED
|
@@ -96,7 +96,7 @@ $.error.handle = function(el) {
|
|
|
96
96
|
size = 'fullscreen';
|
|
97
97
|
}
|
|
98
98
|
if (pre.length) {
|
|
99
|
-
content = \`<div class="ui fluid scrolling container"><pre>\${pre.text()}</pre></div>\`;
|
|
99
|
+
content = \`<div class="ui fluid scrolling container"><pre>\${$.safeStr(pre.text())}</pre></div>\`;
|
|
100
100
|
}
|
|
101
101
|
const dlg = $.ntdlg.create('err-view-dlg', el.data('title'), content, {
|
|
102
102
|
size,
|
package/views/ui/util.ejs
CHANGED
|
@@ -74,11 +74,20 @@ $.hidePayload = function(message) {
|
|
|
74
74
|
$.isPayload = function(data) {
|
|
75
75
|
return Array.isArray(data) || typeof data === 'object' && data.constructor.name === 'Object';
|
|
76
76
|
}
|
|
77
|
+
$.safeStr = function(s) {
|
|
78
|
+
if (s !== '') {
|
|
79
|
+
const tn = document.createTextNode(s);
|
|
80
|
+
const pn = document.createElement('p');
|
|
81
|
+
pn.appendChild(tn);
|
|
82
|
+
s = pn.innerHTML;
|
|
83
|
+
}
|
|
84
|
+
return s;
|
|
85
|
+
}
|
|
77
86
|
$.toStr = function(o) {
|
|
78
87
|
if ($.isPayload(o)) {
|
|
79
88
|
return JSON.stringify(o, null, ' ');
|
|
80
89
|
} else if (o !== undefined && o !== null) {
|
|
81
|
-
return o.toString();
|
|
90
|
+
return $.safeStr(o.toString());
|
|
82
91
|
}
|
|
83
92
|
return '';
|
|
84
93
|
}
|