@aimeloic/monkey-tester 5.0.1 → 5.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 +25 -7
- package/package.json +1 -1
package/htmlTemplate.js
CHANGED
|
@@ -17,7 +17,15 @@ function encodePayload(obj) {
|
|
|
17
17
|
// The reciprocal decode runs inside each HTML template (see _decode below).
|
|
18
18
|
// It is injected as a one-liner so every template is self-contained.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
// Replace line 18 with this version:
|
|
21
|
+
const _decode = `function _decode(b64) {
|
|
22
|
+
const binStr = atob(b64.replace(/\\s+/g, ''));
|
|
23
|
+
const bytes = new Uint8Array(binStr.length);
|
|
24
|
+
for (let i = 0; i < binStr.length; i++) {
|
|
25
|
+
bytes[i] = binStr.charCodeAt(i);
|
|
26
|
+
}
|
|
27
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
28
|
+
}`;
|
|
21
29
|
|
|
22
30
|
// ─── Runtime sandbox (injected into tester page) ─────────────────────────────
|
|
23
31
|
function runtimeClientSandbox() {
|
|
@@ -33,8 +41,8 @@ function runtimeClientSandbox() {
|
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
const ENDPOINTS = _decode(
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
document.getElementById('__monkey_data__').textContent.trim()
|
|
45
|
+
);
|
|
38
46
|
|
|
39
47
|
let currentKey = null;
|
|
40
48
|
|
|
@@ -260,7 +268,8 @@ const UI = {
|
|
|
260
268
|
</style>
|
|
261
269
|
</head>
|
|
262
270
|
<body>
|
|
263
|
-
|
|
271
|
+
<!-- Replace the old hidden div with this -->
|
|
272
|
+
<script id="__monkey_data__" type="text/plain">${endpointsJsonB64}</script>
|
|
264
273
|
<header>
|
|
265
274
|
<div class="logo">🐒 Endtester <span>Interactive API Hub</span></div>
|
|
266
275
|
<div class="header-right">
|
|
@@ -420,7 +429,8 @@ async function handleRegister() {
|
|
|
420
429
|
</style>
|
|
421
430
|
</head>
|
|
422
431
|
<body>
|
|
423
|
-
|
|
432
|
+
<!-- Replace the old hidden div with this -->
|
|
433
|
+
<script id="__monkey_data__" type="text/plain">${endpointsJsonB64}</script>
|
|
424
434
|
|
|
425
435
|
<header>
|
|
426
436
|
<h1>Universal Management Dashboard</h1>
|
|
@@ -452,12 +462,20 @@ async function handleRegister() {
|
|
|
452
462
|
|
|
453
463
|
<script>
|
|
454
464
|
// ── Unicode-safe decode ──────────────────────────────────────────────────────
|
|
465
|
+
// Replace the old _decode function inside UI.dashboard with this:
|
|
455
466
|
function _decode(b64) {
|
|
456
|
-
|
|
467
|
+
const binStr = atob(b64.replace(/\s+/g, ''));
|
|
468
|
+
const bytes = new Uint8Array(binStr.length);
|
|
469
|
+
for (let i = 0; i < binStr.length; i++) {
|
|
470
|
+
bytes[i] = binStr.charCodeAt(i);
|
|
471
|
+
}
|
|
472
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
457
473
|
}
|
|
458
474
|
|
|
475
|
+
// BEFORE (Broken)
|
|
476
|
+
// AFTER (Safe from HTML parsing artifacts)
|
|
459
477
|
const ENDPOINTS = _decode(
|
|
460
|
-
document.getElementById('__monkey_data__').
|
|
478
|
+
document.getElementById('__monkey_data__').textContent.trim()
|
|
461
479
|
);
|
|
462
480
|
|
|
463
481
|
const token = localStorage.getItem('__auth_token__');
|