Skip to content

Commit bae001d

Browse files
authored
Merge pull request #23 from powerAn2020/dev
管理页面打包
2 parents 8b2063d + 02e383b commit bae001d

31 files changed

+1694
-2309
lines changed

.github/workflows/dev_build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
required: false
1010
type: string
1111
default: ''
12-
push:
13-
branches:
14-
- dev
12+
# push:
13+
# branches:
14+
# - dev
1515

1616
permissions:
1717
contents: write
@@ -40,12 +40,13 @@ jobs:
4040
# 将zt最新版写入到环境变量
4141
echo "VERSION=$zerotier_latest_version" >> $GITHUB_ENV
4242
43-
download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-${latest_version}.tar.xz"
43+
download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-musl-${latest_version}.tar.xz"
4444
echo ${download_link}
4545
wget -O curl.tar.xz ${download_link}
46-
wget -O curl32.tar.xz https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-armv7-${latest_version}.tar.xz
46+
wget -O curl32.tar.xz https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-armv7-musl-${latest_version}.tar.xz
4747
tar -xJf curl.tar.xz -C $PWD/bin curl
4848
tar -xJf curl32.tar.xz curl
49+
wget -O $PWD/bin/cacert.pem https://curl.se/ca/cacert.pem
4950
mkdir $PWD/toolchain
5051
wget -O arm64.tar.xz "https://mirror-us-sea1.armbian.airframes.io/dl/_toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz"
5152
wget -O arm.tar.xz "https://mirror-us-sea1.armbian.airframes.io/dl/_toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz"
@@ -64,9 +65,9 @@ jobs:
6465
echo "new_module_version=$versionCode" >> $GITHUB_ENV
6566
echo 'id=ZeroTierForKSU' >module.prop
6667
echo 'name=ZeroTier For KernelSU' >>module.prop
67-
echo "version=${{ env.VERSION }}" >>module.prop
68+
echo "version=ZeroTier Version->${{ env.VERSION }} & module Version->${versionCode}" >>module.prop
6869
echo "versionCode=${versionCode}" >>module.prop
69-
echo 'author=powerAn' >>module.prop
70+
echo 'author=powerAn2020' >>module.prop
7071
echo 'description=ZeroTier(${{ env.VERSION }}) with UI interface (DEV)' >>module.prop
7172
git config --global user.email "action@example.com"
7273
MESSAGE=$(git log -1 --pretty=%B)

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ jobs:
3333
exit 0
3434
fi
3535
echo "VERSION=$zerotier_latest_version" >> $GITHUB_ENV
36-
download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-${latest_version}.tar.xz"
36+
download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-musl-${latest_version}.tar.xz"
3737
echo ${download_link}
3838
wget -O curl.tar.xz ${download_link}
39-
wget -O curl32.tar.xz https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-armv7-${latest_version}.tar.xz
39+
wget -O curl32.tar.xz https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-armv7-musl-${latest_version}.tar.xz
4040
tar -xJf curl.tar.xz -C $PWD/bin curl
4141
tar -xJf curl32.tar.xz curl
42+
wget -O $PWD/bin/cacert.pem https://curl.se/ca/cacert.pem
4243
mkdir $PWD/toolchain
4344
wget -O arm64.tar.xz "https://mirror-us-sea1.armbian.airframes.io/dl/_toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz"
4445
wget -O arm.tar.xz "https://mirror-us-sea1.armbian.airframes.io/dl/_toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz"
@@ -59,9 +60,9 @@ jobs:
5960
echo '{"version":"${{ env.VERSION }}","versionCode":'${versionCode}',"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/${{env.VERSION}}/ZeroTierForKSU-arm-${{ env.VERSION }}.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}' >update_arm.json
6061
echo 'id=ZeroTierForKSU' >module.prop
6162
echo 'name=ZeroTier For KernelSU' >>module.prop
62-
echo "version=${{ env.VERSION }}" >>module.prop
63+
echo "version=ZeroTier Version->${{ env.VERSION }} & module Version->${versionCode}" >>module.prop
6364
echo "versionCode=${versionCode}" >>module.prop
64-
echo 'author=powerAn' >>module.prop
65+
echo 'author=powerAn2020' >>module.prop
6566
echo 'description=ZeroTier(${{ env.VERSION }}) with UI interface' >>module.prop
6667
git config --global user.email "action@example.com"
6768
git config --global user.name "github action"

README.md

Lines changed: 127 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
感谢以下连接提供的帮助,顺序不分先后
66

7-
- [是否有可能 Zerotier-One 直接在 Android 设备上运行 - V2EX](https://v2ex.com/t/863131)
7+
- [是否有可能 Zerotier-One 直接在 Android 设备上运行? - V2EX](https://v2ex.com/t/863131)
88
- [Android以太网和WIFI完美共存](https://blog.csdn.net/G_Rookie/article/details/109679262)
99
- [Network Management in Android: Routing](https://yotam.net/posts/network-management-in-android-routing/)
1010
- [vant-ui/vant-demo](https://github.com/vant-ui/vant-demo/tree/master/vant/vite)
@@ -14,113 +14,151 @@
1414
- [taamarin/box_for_magisk](https://github.com/taamarin/box_for_magisk/blob/master/box/scripts/box.inotify)
1515
- [stunnel/static-curl](https://github.com/stunnel/static-curl)
1616
- [tiann/KernelSU](https://github.com/tiann/KernelSU)
17+
- [shell脚本如何优雅的打印帮助信息](https://blog.csdn.net/lhl_blog/article/details/107409694)
1718

18-
# BUGS
19+
## BUG
1920

2021
- [x] ~~通过UI启动的zerotier进程会随着KSU Manager的结束而退出~~
2122
- [ ] 在模块禁用的情况下依然可以操作服务启用和停用(实际上不应该能操作,毕竟都禁用了),这将导致下次启用模块的时候要启停服务两次才能使用zerotier进程正确启动。**ps:模块禁用功能是特地保留的,我不想在停用模块的情况下还占用系统资源。**
2223
- [ ] 服务停止的情况下,有概率会在首页显示已经禁用的节点。这是不一样的,我都强制弹框让开启服务再操作了,有空再找
23-
24-
# 已知问题
2524
- ~~[zt切换网络导致全局断网的问题](https://github.com/eventlOwOp/zerotier-magisk/issues/7#issuecomment-2069526989)~~ ZerotierOne 1.14.0版本已修复
25+
- [ ] 管理页在处理Member的时候需要等待处理完才能展开下一个Member的信息,否则后一个会覆盖前一个的配置,导致第一个Member修改的配置不生效。可以提前缓存下要修改的信息,一次发送请求,下次再改。
2626

27-
# TODO
27+
## TODO
2828

2929
1. [ ] UI增加一个开发版和稳定版切换,现在测试好麻烦。
3030
2. [x] 流水线增加自定义zerotier版本编译。[~~据说1.8.9版本没有zt切换网络导致全局断网的问题~~](https://github.com/eventlOwOp/zerotier-magisk/issues/7#issuecomment-2069526989),经过测试,依然复现,而且还有漏洞,官方推荐1.12.x版本以上有安全补丁,别降级了。
31-
3. [ ] 新建zerotier路由规则表,~~因为提升main表优先级导致无法与box_for_magisk共存。。~~(没学会。先放着吧)
32-
33-
# 免责声明
31+
3. [ ] 新建zerotier路由规则表(没学会。先放着吧)
32+
4. [X] 增加管理页面,需要自行准备[API Token](https://docs.zerotier.com/api/tokens/#zerotier-central-token)
33+
5. [ ] 国际化
34+
6. [ ] 等待新版KSU发布后,重新发版,现在是以补丁的形式提前用上了KSU的某些未修复的API
35+
## 免责声明
3436

3537
本项目不对以下情况负责:设备变砖、SD 卡损坏或 SoC 烧毁。
3638

37-
# 使用方法
39+
## 使用方法
3840

3941
用UI界面
4042

4143
![List](https://github.com/powerAn2020/ZeroTierOneForKSU/assets/25736019/a20e0eeb-2813-40dd-892c-c3f44fff77c2)
4244
![Peers](https://github.com/powerAn2020/ZeroTierOneForKSU/assets/25736019/61040bcb-8b51-4521-a35a-a2e793df3bb1)
4345
![Setting](https://github.com/powerAn2020/ZeroTierOneForKSU/assets/25736019/05f3e070-6fd7-48a3-9afb-22fb4cfff56a)
4446

45-
# 一些可选操作说明
46-
47-
## 文件说明
48-
49-
### Zerotier数据目录:`/data/adb/zerotier`;虽然UI都实现了,但是还是说明下,给自己备忘下;在该目录下创建以下文件可以做到
50-
51-
创建文件`/data/adb/zerotier/KEEP_ON_UNINSTALL`,卸载模块可保留数据目录
52-
创建文件`/data/adb/zerotier/MANMANUAL`,关闭开机自启
53-
创建文件`/data/adb/zerotier/ALLOW_9993`,iptables放行UDP 9993入端口
54-
创建文件`/data/adb/zerotier/ROUTER_RULE_NEW`,zerotier流量路由模式改为新建路由规则表,删除该文件则是提升main表优先级模式
55-
56-
## 执行脚本说明
57-
58-
### 执行所有脚本都需要带全路径
59-
60-
```shell
61-
sh /data/adb/modules/ZeroTierForKSU/zerotier.sh $1 ...
62-
start)
63-
start_service 1
64-
启动服务
65-
;;
66-
stop)
67-
stop_service 1
68-
停止服务
69-
;;
70-
restart)
71-
重启服务
72-
;;
73-
status)
74-
return 模块页面用的状态信息
75-
;;
76-
token)
77-
获取webapi token
78-
;;
79-
inotifyd)
80-
监听 /data/adb/zerotier/state,用于启动服务
81-
82-
```
83-
84-
```shell
47+
## 一些可选操作说明
48+
49+
### 文件说明
50+
51+
#### Zerotier数据目录:`/data/adb/zerotier`;虽然UI都实现了,但是还是说明下,给自己备忘下;在该目录下创建以下文件可以做到
52+
53+
创建文件`/data/adb/zerotier/KEEP_ON_UNINSTALL`,卸载模块可保留数据目录
54+
创建文件`/data/adb/zerotier/MANMANUAL`,关闭开机自启
55+
创建文件`/data/adb/zerotier/ALLOW_9993`,iptables放行UDP 9993入端口
56+
创建文件`/data/adb/zerotier/ROUTER_RULE_NEW`,zerotier流量路由模式改为新建路由规则表,删除该文件则是提升main表优先级模式
57+
58+
### 执行脚本说明
59+
60+
### **执行所有脚本都需要带全路径/Executing all scripts requires a full path**
61+
62+
```Shell
63+
sh /data/adb/modules/ZeroTierForKSU/zerotier-cli # 同官方
64+
sh /data/adb/modules/ZeroTierForKSU/zerotier-idtool # 同官方
65+
sh /data/adb/modules/ZeroTierForKSU/zerotier.inotify # 监听/data/adb/zerotier/state目录,用于启动服务。
66+
```
67+
68+
```markdown
69+
ZeroTier for KSU - zerotier.sh
70+
71+
Usage:
72+
zerotier.sh options
73+
74+
Options:
75+
-h -- Show this message.
76+
start -- Start Zerotier Service
77+
restart -- Retart Zerotier Service
78+
stop -- Stop Zerotier Service
79+
status -- Show Node Status
80+
token -- Show Local Service Token
81+
apiToken -- Show Remote Service apiToken
82+
inotifyd -- Start inotifyd Service
83+
84+
Example:
85+
help
86+
sh zerotier.sh -h
87+
sh zerotier.sh start
88+
sh zerotier.sh restart
89+
sh zerotier.sh stop
90+
sh zerotier.sh status
91+
sh zerotier.sh token
92+
sh zerotier.sh apiToken
93+
sh zerotier.sh inotifyd
8594

8695
# 通过webapi接口调用zerotier服务
87-
sh /data/adb/modules/ZeroTierForKSU/api.sh $1 other(可选参数如下)
88-
status)
89-
status
90-
return 自定义的状态接口,放回给页面用的参数
91-
;;
92-
networks)
93-
return 查询网络详情,如果传入具体的网络id,则返回单个详情,不传就返回所有已加入的节点详情
94-
networks $2
95-
;;
96-
leaveNetwork)
97-
离开网络,传具体的网络ID
98-
leaveNetwork $2
99-
;;
100-
joinOrUpdateNetwork)
101-
加入网络或者更新网络,第一个参数是网络ID,第二个参数json对象,'{"allowDNS": false,"allowDefault": false,"allowManaged": true,"allowGlobal": false }'
102-
joinOrUpdateNetwork $2 "$3"
103-
;;
104-
peer)
105-
返回成员列表
106-
peer
107-
;;
108-
firewall)
109-
防火墙规则,能传 A(增加) 和 D(删除)
110-
firewall $2
111-
;;
112-
router)
113-
zerotier路由模式 ,能传两个参数, 第一个参数 0 (没实现)新建zerotier ip rule 表,1提升main表优先级,第二个参数 add 新增,del 删除
114-
router $@
115-
;;
116-
orbit)
117-
加入自建的moon,需要一个参数,自建moon的网络id
118-
orbit $@
119-
;;
120-
```
121-
122-
```shell
123-
sh /data/adb/modules/ZeroTierForKSU/zerotier-cli #同官方
124-
sh /data/adb/modules/ZeroTierForKSU/zerotier-idtool#同官方
125-
sh /data/adb/modules/ZeroTierForKSU/zerotier.inotify # 监听/data/adb/zerotier/state目录,用于启动服务。
126-
```
96+
ZeroTier for KSU - api.sh
97+
98+
Usage:
99+
api.sh <api_type> [options]
100+
101+
Options:
102+
-h -- Show this message.
103+
<api_type> local/central
104+
local
105+
status -- Show Node Status
106+
network -- When the action is "list", "networkid" and "bodydata" are optional. When the action is "leave", "bodydata" is optional. When the action is "join", "networkid" and "bodydata" are required.
107+
action value:[ list | leave | join ]
108+
networkid value:[ networkid ](optional)
109+
bodydata value:[ JSON object ](optional)
110+
peer -- All the nodes your node knows about
111+
firewall -- Control the firewall to allow traffic into port 9993
112+
action value:[ A | D ]
113+
router -- Set the Zerotier traffic routing method
114+
router value:[ routing (unrealized) | main ]
115+
action value:[ A | D ]
116+
orbit -- Join Private Root Servers
117+
moonid value:[ moonid ]
118+
central
119+
status -- Show Center Status
120+
network -- When the action is "list", "networkid" and "bodydata" are optional. When the action is "remove", "bodydata" is optional. When the action is "add", No parameters are required. When the action is "modify", "networkid" and "bodydata" are required.
121+
action value:[ list | remove | add | modify ]
122+
networkid value:[ networkid ](optional)
123+
bodydata value:[ JSON object ](optional)
124+
member -- When the action is "list", "bodydata" and "memberID" are optional. When the action is "remove", "bodydata" is optional. When the action is "modify", "networkid", "memberID" and "bodydata" are required.
125+
action value:[ list | remove | modify ]
126+
networkid value:[ networkid ] (optional)
127+
memberID value:[ memberID ] (optional)
128+
bodydata value:[ JSON object ] (optional)
129+
apiToken -- Manage the tokenAuth for accessing the central API
130+
action value:[ show | update ]
131+
key value:[ apiToken ]
132+
133+
Example:
134+
help
135+
sh api.sh -h
136+
137+
local
138+
sh api.sh local status
139+
sh api.sh local peer
140+
sh api.sh local firewall A
141+
sh api.sh local firewall D
142+
sh api.sh local router routing A (unrealized)
143+
sh api.sh local router routing D (unrealized)
144+
sh api.sh local router main A
145+
sh api.sh local router main D
146+
sh api.sh local orbit yourMoonid
147+
sh api.sh local network list
148+
sh api.sh local network leave yourNetworkid (suggest: use command `zerotier-cli leave yourNetworkid`)
149+
sh api.sh local network join yourNetworkid {} (suggest: use command `zerotier-cli join yourNetworkid`)
150+
151+
central
152+
sh api.sh central status
153+
sh api.sh central network list
154+
sh api.sh central network remove yourNetworkid
155+
sh api.sh central network add
156+
sh api.sh central network modify yourNetworkid {}
157+
sh api.sh central member list yourNetworkid
158+
sh api.sh central member remove yourNetworkid memberID
159+
sh api.sh central member modify yourNetworkid memberID '{"hidden":false,"config":{"authorized":true}}'
160+
161+
apiToken
162+
sh api.sh apiToken show
163+
sh api.sh apiToken update xxxxxxxxx
164+
```

0 commit comments

Comments
 (0)