| 111 | throw new Error("No system unzip tool found (unzip/7z/busybox). Git mode is recommended on this panel."); |
| 112 | } |
| 113 | function copyRecursive(src, dest, ignore = [], relative = '', outList = []) { |
| 114 | if (!fs.existsSync(dest)) |
| 115 | fs.mkdirSync(dest, { recursive: true }); |
| 116 | for (const entry of fs.readdirSync(src)) { |
| 117 | if (ignore.includes(entry)) |
| 118 | continue; |
| 119 | const s = path.join(src, entry); |
| 120 | const d = path.join(dest, entry); |
| 121 | const stat = fs.lstatSync(s); |
| 122 | if (stat.isDirectory()) { |
| 123 | copyRecursive(s, d, ignore, path.join(relative, entry), outList); |
| 124 | } |
| 125 | else { |
| 126 | fs.copyFileSync(s, d); |
| 127 | if (outList) |
| 128 | outList.push(path.join(relative, entry).replace(/\\/g, '/')); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | async function updateViaZip(sock, chatId, message, zipOverride) { |
| 133 | const zipUrl = (zipOverride || config.updateZipUrl || process.env.UPDATE_ZIP_URL || '').trim(); |
| 134 | if (!zipUrl) { |