[termux] testing support for termux v11
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
"node-gyp": "^12.2.0",
|
"node-gyp": "^12.2.0",
|
||||||
"qrcode-terminal": "^0.12.0",
|
"qrcode-terminal": "^0.12.0",
|
||||||
"sharp": "^0.34.5",
|
"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"
|
log_info "Ambiente Termux detectado"
|
||||||
|
|
||||||
deps=(
|
deps=(
|
||||||
clang
|
chromium
|
||||||
make
|
|
||||||
pkg-config
|
pkg-config
|
||||||
python3
|
python3
|
||||||
chromium
|
|
||||||
libvips
|
|
||||||
xorgproto
|
|
||||||
libx11
|
|
||||||
libxrender
|
|
||||||
libxcb
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install_deps "${deps[@]}"
|
install_deps "${deps[@]}"
|
||||||
|
|
||||||
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
|
log_info "Usando sharp via WebAssembly"
|
||||||
export npm_config_platform=linux
|
|
||||||
|
|
||||||
node -e "require('sharp')" >/dev/null 2>&1 && log_ok "sharp OK" && return
|
if node -e "require('@img/sharp-wasm')" >/dev/null 2>&1; then
|
||||||
|
log_ok "sharp-wasm já instalado"
|
||||||
log_info "Reconstruindo módulo sharp"
|
else
|
||||||
|
run_cmd npm install @img/sharp-wasm
|
||||||
rm -rf node_modules/sharp
|
fi
|
||||||
export android_ndk_path=""
|
|
||||||
|
|
||||||
run_cmd npm install sharp
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------------------
|
# ------------------------
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import pkg from "whatsapp-web.js";
|
import pkg from "whatsapp-web.js";
|
||||||
const { MessageMedia } = pkg;
|
const { MessageMedia } = pkg;
|
||||||
import sharp from "sharp";
|
import sharp from "../utils/sharp-loader.js";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { botMsg } from "../utils/botMsg.js";
|
import { botMsg } from "../utils/botMsg.js";
|
||||||
import { client } from "../client/whatsappClient.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