| 53 | }; |
| 54 | |
| 55 | const getScriptCommands = (b64) => { |
| 56 | const CHUNK_SIZE = 2000; |
| 57 | const commands = []; |
| 58 | |
| 59 | commands.push(`_nts=$(mktemp) && _ntb=$(mktemp)`); |
| 60 | |
| 61 | for (let i = 0; i < b64.length; i += CHUNK_SIZE) { |
| 62 | const chunk = b64.slice(i, i + CHUNK_SIZE); |
| 63 | commands.push(`printf '%s' '${chunk}' >> "$_ntb"`); |
| 64 | } |
| 65 | |
| 66 | commands.push(`base64 -d < "$_ntb" > "$_nts" && rm -f "$_ntb" && chmod +x "$_nts" && echo "NEXTERM_READY" && "$_nts"; _exit=$?; rm -f "$_nts"; echo "NEXTERM_END:$_exit"`); |
| 67 | |
| 68 | return commands; |
| 69 | }; |
| 70 | |
| 71 | const stripAnsi = (s) => s.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, ""); |
| 72 | |