deploy-to-phone.sh
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# deploy-to-phone.sh — 把 wechat 服务代码推送到 Pixel 手机
#
# 用法:
# ./deploy-to-phone.sh [手机目标目录]
# 默认目标: /data/data/com.termux/files/home/hermes-wechat/
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PHONE_DIR="${1:-/data/data/com.termux/files/home/hermes-wechat}"
echo "=== Deploying wechat services to phone ==="
echo "Source: $SCRIPT_DIR"
echo "Target: $PHONE_DIR"
echo ""
# 确保手机目录存在
adb shell "su -c 'mkdir -p $PHONE_DIR'"
# 推送所有 js 文件和 SKILL.md
for f in \
android-wechat-sender.js \
android-wechat-tracker.js \
wechat-sender.js \
wechat-tracker.js \
wechat-reader.js \
wechat-importer.js \
index.js \
test-phone.js \
SKILL.md
do
if [ -f "$SCRIPT_DIR/$f" ]; then
echo "Pushing $f ..."
adb push "$SCRIPT_DIR/$f" "$PHONE_DIR/$f" >/dev/null
fi
done
echo ""
echo "=== Deploy complete ==="
echo "Files in $PHONE_DIR:"
adb shell "su -c 'ls -la $PHONE_DIR'"
echo ""
echo "Quick test:"
echo " adb shell \"su -c 'cd $PHONE_DIR && node -e \\\\\"
const {sendTextMessageBroadcast} = require('./android-wechat-sender');
sendTextMessageBroadcast('filehelper', 'hermes phone test').then(r=>console.log(r));
\\\\\"'\""