Skip to content

Commit

Permalink
Fix bug and Add support for lite
Browse files Browse the repository at this point in the history
  • Loading branch information
E7KMbb committed Sep 13, 2020
1 parent c0e9b44 commit 937103e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion system/bin/UnblockNeteaseMusic
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ sources="kuwo qq xiami baidu joox kugou"
nodejs=${UnblockNeteaseMusic_path}/node
appjs=${UnblockNeteaseMusic_path}/UnblockNeteaseMusic/app.js
pid_file=${UnblockNeteaseMusic_path}/UnblockNeteaseMusic.pid
boot_start=$(grep boot_start ${UnblockNeteaseMusic_path}/service.sh | head -n 1 | awk -F '=' '{print $2}')
uid=$(grep -m1 -i "com.netease.cloudmusic" /data/system/packages.list | cut -d' ' -f2)
liteuid=$(grep -m1 -i "com.netease.cloudmusic.lite" /data/system/packages.list | cut -d' ' -f2)
port=5464
portssl=2229
ports=$port:$portssl
log=${UnblockNeteaseMusic_path}/日志.log

check() {
boot_start=$(grep boot_start ${UnblockNeteaseMusic_path}/service.sh | head -n 1 | awk -F '=' '{print $2}')
if [ -e ${UnblockNeteaseMusic_path}/UnblockNeteaseMusic.pid ];then
echo "正在运行"
else
Expand All @@ -36,13 +37,17 @@ start() {
echo -n $! > ${pid_file}
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner $uid -m tcp --dport 80 -j DNAT --to 127.0.0.1:${port}
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner $uid -m tcp --dport 443 -j DNAT --to 127.0.0.1:${portssl}
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner $liteuid -m tcp --dport 80 -j DNAT --to 127.0.0.1:${port}
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner $liteuid -m tcp --dport 443 -j DNAT --to 127.0.0.1:${portssl}
echo "已开启服务"
}

stop() {
kill -9 `cat ${pid_file}` || kill `cat ${pid_file}`
iptables -t nat -D OUTPUT -p tcp -m owner --uid-owner $uid -m tcp --dport 80 -j DNAT --to 127.0.0.1:${port}
iptables -t nat -D OUTPUT -p tcp -m owner --uid-owner $uid -m tcp --dport 443 -j DNAT --to 127.0.0.1:${portssl}
iptables -t nat -D OUTPUT -p tcp -m owner --uid-owner $liteuid -m tcp --dport 80 -j DNAT --to 127.0.0.1:${port}
iptables -t nat -D OUTPUT -p tcp -m owner --uid-owner $liteuid -m tcp --dport 443 -j DNAT --to 127.0.0.1:${portssl}
rm -rf ${pid_file}
echo "已关闭服务"
}
Expand Down

0 comments on commit 937103e

Please sign in to comment.