@aimeloic/monkey-tester 1.0.2 → 1.0.3
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/htmlTemplate.js +9 -6
- package/package.json +1 -1
package/htmlTemplate.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export function getHtmlTemplate(endpoints) {
|
|
2
|
+
// Safe stringification for HTML attribute encoding
|
|
3
|
+
const safeJsonString = Buffer.from(JSON.stringify(endpoints)).toString('base64');
|
|
4
|
+
|
|
2
5
|
return `
|
|
3
6
|
<!DOCTYPE html>
|
|
4
7
|
<html lang="en">
|
|
@@ -79,6 +82,8 @@ export function getHtmlTemplate(endpoints) {
|
|
|
79
82
|
</head>
|
|
80
83
|
<body>
|
|
81
84
|
|
|
85
|
+
<div id="endtester-data-vault" data-payload="${safeJsonString}" style="display: none;"></div>
|
|
86
|
+
|
|
82
87
|
<header>
|
|
83
88
|
<div class="logo">Endtester <span>Application Runtime Sandbox</span></div>
|
|
84
89
|
<div class="header-right">
|
|
@@ -96,7 +101,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
96
101
|
<div class="layout">
|
|
97
102
|
<aside id="sidebar-nav">
|
|
98
103
|
<div class="section-label">Discovered Endpoints</div>
|
|
99
|
-
|
|
104
|
+
</aside>
|
|
100
105
|
|
|
101
106
|
<main id="main-panel"></main>
|
|
102
107
|
|
|
@@ -112,12 +117,12 @@ export function getHtmlTemplate(endpoints) {
|
|
|
112
117
|
<div id="toast"></div>
|
|
113
118
|
|
|
114
119
|
<script>
|
|
115
|
-
//
|
|
116
|
-
const
|
|
120
|
+
// Extract data directly from DOM safe-vault container
|
|
121
|
+
const rawPayload = document.getElementById('endtester-data-vault').getAttribute('data-payload');
|
|
122
|
+
const ENDPOINTS = JSON.parse(atob(rawPayload));
|
|
117
123
|
|
|
118
124
|
let currentEp = '';
|
|
119
125
|
|
|
120
|
-
// Setup host variables contextually on layout initialization
|
|
121
126
|
document.getElementById('base-url').value = window.location.origin;
|
|
122
127
|
|
|
123
128
|
function buildSidebar() {
|
|
@@ -146,7 +151,6 @@ function buildSidebar() {
|
|
|
146
151
|
sidebar.appendChild(div);
|
|
147
152
|
});
|
|
148
153
|
|
|
149
|
-
// Render first item initially
|
|
150
154
|
if(keys.length > 0) renderPanel(keys[0]);
|
|
151
155
|
}
|
|
152
156
|
|
|
@@ -281,7 +285,6 @@ function showToast(msg) {
|
|
|
281
285
|
setTimeout(() => t.classList.remove('show'), 2500);
|
|
282
286
|
}
|
|
283
287
|
|
|
284
|
-
// Initial script activation
|
|
285
288
|
buildSidebar();
|
|
286
289
|
</script>
|
|
287
290
|
</body>
|