[termux] testing support for termux v11
This commit is contained in:
@@ -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
25
setup
@@ -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
|
||||
|
||||
# ------------------------
|
||||
|
||||
@@ -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"
|
||||
|
||||
9
src/utils/sharp-loader.js
Normal file
9
src/utils/sharp-loader.js
Normal file
@@ -0,0 +1,9 @@
|
||||
let sharp;
|
||||
|
||||
try {
|
||||
sharp = (await import("sharp")).default;
|
||||
} catch {
|
||||
sharp = (await import("@img/sharp-wasm")).default;
|
||||
}
|
||||
|
||||
export default sharp;
|
||||
Reference in New Issue
Block a user