[termux] testing support for termux v11

This commit is contained in:
synt-xerror
2026-03-14 02:33:13 -03:00
parent f2e5ed5aeb
commit 9cb575760d
4 changed files with 19 additions and 20 deletions

View File

@@ -7,6 +7,7 @@
"node-gyp": "^12.2.0",
"qrcode-terminal": "^0.12.0",
"sharp": "^0.34.5",
"whatsapp-web.js": "^1.24.0"
"whatsapp-web.js": "^1.24.0",
"@img/sharp-wasm": "^0.34.5"
}
}

25
setup
View File

@@ -141,31 +141,20 @@ if [[ "$PREFIX" == *"com.termux"* ]]; then
log_info "Ambiente Termux detectado"
deps=(
clang
make
chromium
pkg-config
python3
chromium
libvips
xorgproto
libx11
libxrender
libxcb
)
install_deps "${deps[@]}"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export npm_config_platform=linux
log_info "Usando sharp via WebAssembly"
node -e "require('sharp')" >/dev/null 2>&1 && log_ok "sharp OK" && return
log_info "Reconstruindo módulo sharp"
rm -rf node_modules/sharp
export android_ndk_path=""
run_cmd npm install sharp
if node -e "require('@img/sharp-wasm')" >/dev/null 2>&1; then
log_ok "sharp-wasm já instalado"
else
run_cmd npm install @img/sharp-wasm
fi
fi
# ------------------------

View File

@@ -1,6 +1,6 @@
import pkg from "whatsapp-web.js";
const { MessageMedia } = pkg;
import sharp from "sharp";
import sharp from "../utils/sharp-loader.js";
import fs from "fs";
import { botMsg } from "../utils/botMsg.js";
import { client } from "../client/whatsappClient.js"

View File

@@ -0,0 +1,9 @@
let sharp;
try {
sharp = (await import("sharp")).default;
} catch {
sharp = (await import("@img/sharp-wasm")).default;
}
export default sharp;