Skip to content

Commit

Permalink
Update to new Verison
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlicheng committed Oct 30, 2019
1 parent aee7c8e commit 7111cb5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-unblockmusic
PKG_VERSION:=v2.2.3
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_LICENSE:=Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion app/luasrc/model/cbi/unblockmusiclog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 20
function t.cfgvalue()
luci.sys.exec(" sed '/MITM/d' /tmp/unblockmusic.log > /tmp/music.log")
luci.sys.exec("cat /tmp/unblockmusic.log | grep http > /tmp/music.log")
return fs.readfile(conffile) or ""
end
t.readonly="readonly"
Expand Down
4 changes: 3 additions & 1 deletion app/root/etc/init.d/unblockmusic
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ add_rule()
$ipt_n -A cloud_music -d 192.168.0.0/16 -j RETURN
$ipt_n -A cloud_music -d 224.0.0.0/4 -j RETURN
$ipt_n -A cloud_music -d 240.0.0.0/4 -j RETURN
$ipt_n -A cloud_music -p tcp -j REDIRECT --to-ports 5200
$ipt_n -A cloud_music -p tcp -j REDIRECT --to-ports 5202
$ipt_n -I PREROUTING -p tcp --dport 80 -m set --match-set music dst -j cloud_music
}

Expand Down Expand Up @@ -83,8 +83,10 @@ start()

if [ $TYPE = "default" ]; then
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5200:5201 >/tmp/unblockmusic.log 2>&1 &
node /usr/share/UnblockNeteaseMusic/app.js -p 5202 >>/tmp/unblockmusic.log 2>&1 &
else
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5200:5201 -o $TYPE >/tmp/unblockmusic.log 2>&1 &
node /usr/share/UnblockNeteaseMusic/app.js -p 5202 -o $TYPE >>/tmp/unblockmusic.log 2>&1 &
fi

set_firewall
Expand Down
7 changes: 6 additions & 1 deletion app/root/usr/share/UnblockNeteaseMusic/logcheck.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/bash

log_max_size="4" #使用KB计算
log_max_size="10" #使用KB计算
log_file="/tmp/unblockmusic.log"

while true
do
sleep 10s
icount=`busybox ps -w | grep app.js |grep -v grep| wc -l`
if [ $icount -ne 2 ] ;then
/etc/init.d/unblockmusic restart
fi
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
(( "${log_size}" >= "${log_max_size}" )) && echo "" > /tmp/unblockmusic.log
sleep 10m
Expand Down

0 comments on commit 7111cb5

Please sign in to comment.