Skip to content

Commit

Permalink
Change the default option to whitelist mode (#166)
Browse files Browse the repository at this point in the history
* Create 待办.md
* Delete 待办.md

* Create package.list.cfg

添加黑白名单模式选择,以及包名配置

* Delete box/package.list.ini

使用.cfg,移除.ini

* Optimizing details and adding black / white list configuration options to support custom comments

Optimizing details and adding black / white list configuration options to support custom comments

* Replace the configuration file path to get the method

* 更新 settings.ini

Move options that do not require manual configuration to the bottom of the file

* 更新 package.list.cfg

Change the default option to whitelist mode
  • Loading branch information
moexiyuki authored Dec 6, 2024
1 parent 7236198 commit 5ff94d0
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 34 deletions.
26 changes: 26 additions & 0 deletions box/package.list.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 黑/白名单模式;black/white list mode.
mode:white
# 你可以在这里写注释;,但是要确保格式正确:"pkg 包名"
# You can write notes here,
# But make sure you write in the correct format.
# example : pkg $pkgname

# Tiktok
pkg com.zhiliaoapp.musically
# Magisk
pkg com.topjohnwu.magisk
# Via
pkg mark.via
pkg com.android.shell
pkg xyz.blueskyweb.app
pkg com.pikcloud.pikpak
pkg com.termux
pkg com.android.vending
pkg com.google.android.gms
pkg com.github.android
pkg ceui.lisa.pixiv
pkg com.google.android.gsf
pkg com.android.chrome

# gid $gid 画饼,暂未考虑;Painted cake, not considered yet
# 😂
13 changes: 0 additions & 13 deletions box/package.list.ini

This file was deleted.

48 changes: 27 additions & 21 deletions box/settings.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
#!/system/bin/sh

# define the settings and paths
# define the settings and path
settings="/data/adb/box/settings.ini"

get_pkg_list(){
p=0
for pkg in $(cat $(dirname $settings)/package.list.ini)
do
pkgs[$p]=$pkg
((p++))
done
echo ${pkgs[@]}
}

if ! command -v busybox &> /dev/null; then
export PATH="/data/adb/magisk:/data/adb/ksu/bin:/data/adb/ap/bin:$PATH:/system/bin"
fi
Expand Down Expand Up @@ -49,16 +39,6 @@ box_user_group="root:net_admin"
# tun: tcp + udp (auto-route)
network_mode="tproxy"

# blacklist / whitelist
proxy_mode="blacklist"

# list of package names to be proxied
# android Package Name,
# For example: ("com.android.captiveportallogin" "com.tencent.mm")
# Please edit the configuration file : package.list.ini

packages_list=($(get_pkg_list))

# The gid in the list will be bypassed or proxied according to the proxy_mode configuration, and the gid can be arbitrarily specified by the busybox setuidgid command
gid_list=()

Expand Down Expand Up @@ -130,6 +110,32 @@ green="\033[1;32m"
yellow="\033[1;33m"
blue="\033[1;34m"

# define the package.list.cfg path
pkg_config=$(dirname "$settings")/package.list.cfg

# check pkg config file
[ -d ${pkg_config} ]&&rm -rf ${pkg_config}
[ ! -f ${pkg_config} ]&&cat>${pkg_config}<<init
# mode black/whitelist
mode:whitelist
# example : pkg pkgname
init

pkg_list=$(sed -n 's/^pkg \([^ ]*\).*/\1/p' ${pkg_config})

load_pkg_list() {
p=0
for pkg in ${pkg_list}
do
pkgs[$p]=$pkg
((p++))
done
echo ${pkgs[@]}
}
packages_list=($(load_pkg_list))
# blacklist / whitelist
proxy_mode=$(sed -n 's/^mode:\([^ ]*\).*/\1/p' ${pkg_config})

# eg: notify $title $content
notify() {
# using Xposed edge app toast
Expand Down

0 comments on commit 5ff94d0

Please sign in to comment.