Skip to content

Commit 00b3306

Browse files
committed
feat: 适配 LiteLoaderQQNT 1.2.3
1 parent d86ade7 commit 00b3306

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

launcher.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,31 @@ else
2121
args="$args --setenv LD_PRELOAD $BASE/libinject.so"
2222
fi
2323

24-
if [ -d "$LITELOADER" ]; then # 支持 LiteLoaderQQNT
24+
if [ -d "$LITELOADER" ]; then
2525
echo "Loading LiteLoaderQQNT..."
2626

27+
# 挂载 LiteLoaderQQNT 目录
2728
mkdir -p "$LITELOADER"
2829
args="$args --bind $LITELOADER $LITELOADER"
2930

30-
entry="$BASE/resources/app/app_launcher/index.js"
31+
# 挂载 package.json
32+
fake_package=$(mktemp)
33+
package_json="$BASE/resources/app/package.json"
34+
sed -e 's/index.js/loader_index.js/g' -e 's/application.asar/./g' "$package_json" > "$fake_package"
35+
args="$args --ro-bind $fake_package $package_json"
36+
37+
# 挂载入口 js
38+
overlay_dir="$BASE/resources/app/app_launcher"
39+
args="$args --tmpfs $overlay_dir"
40+
for file in "$overlay_dir"/*; do
41+
args="$args --bind $file $file"
42+
done
3143
fake_entry=$(mktemp)
32-
33-
echo "require('$LITELOADER');" >> "$fake_entry"
34-
cat "$entry" >> "$fake_entry"
35-
36-
args="$args --bind $LITELOADER/application $BASE/resources/app/application" # 挂载一个可写的 tmpfs
37-
args="$args --bind $fake_entry $entry" # 挂载假入口
44+
echo "require('$LITELOADER');" > "$fake_entry"
45+
args="$args --ro-bind $fake_entry $BASE/resources/app/app_launcher/loader_index.js"
3846
fi
3947

40-
args="$args --chdir $HOME $BASE/main" # 启动主程序
48+
args="$args --chdir $HOME $BASE/main"
4149

4250
# shellcheck disable=SC2086
4351
exec bwrap $args

0 commit comments

Comments
 (0)