@aimeloic/monkey-tester 5.0.2 → 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.
Files changed (2) hide show
  1. package/htmlTemplate.js +18 -4
  2. 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
- const _decode = `function _decode(b64){return JSON.parse(decodeURIComponent(escape(atob(b64.replace(/\s+/g,'')))));}`;
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
- document.getElementById('__monkey_data__').getAttribute('data-payload')
37
- );
44
+ document.getElementById('__monkey_data__').textContent.trim()
45
+ );
38
46
 
39
47
  let currentKey = null;
40
48
 
@@ -454,8 +462,14 @@ async function handleRegister() {
454
462
 
455
463
  <script>
456
464
  // ── Unicode-safe decode ──────────────────────────────────────────────────────
465
+ // Replace the old _decode function inside UI.dashboard with this:
457
466
  function _decode(b64) {
458
- return JSON.parse(decodeURIComponent(escape(atob(b64.replace(/\s+/g, '')))));
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));
459
473
  }
460
474
 
461
475
  // BEFORE (Broken)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aimeloic/monkey-tester",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "description": "Auto route scanning visual runner dashboard.",
5
5
  "main": "index.js",
6
6
  "type": "module",