mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
luci-app-unblockmusic: fix hotplug.d script
This commit is contained in:
parent
8a2f8c03a6
commit
72d5c16e51
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-unblockmusic
|
||||
PKG_VERSION:=2.3.1
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
@ -20,16 +20,5 @@ PKG_MAINTAINER:=lean
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
( . /etc/uci-defaults/unblockmusic ) && rm -f /etc/uci-defaults/unblockmusic
|
||||
rm -f /tmp/luci-indexcache
|
||||
/bin/sh /etc/ppp/ip-up.d/unblockmusic.sh &
|
||||
/etc/init.d/unblockmusic disable >/dev/null 2>&1
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
|
@ -24,11 +24,6 @@ speedtype:value("kuwo", translate("酷我音乐(高音质推荐)"))
|
||||
speedtype:value("migu", translate("咕咪音乐"))
|
||||
speedtype:value("joox", translate("JOOX音乐"))
|
||||
|
||||
endpoint = s:option(Value, "endpoint", translate("转发HTTPS音源地址"))
|
||||
endpoint.default = "http://music.163.com"
|
||||
endpoint.rmempty = true
|
||||
endpoint.description = translate("默认为 http://music.163.com")
|
||||
|
||||
o = s:option(Button,"certificate",translate("HTTPS 证书"))
|
||||
o.inputtitle = translate("下载 CA 根证书")
|
||||
o.description = translate("新版安卓/iOS客户端可能需要安装 CA根证书并信任<br />苹果系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA )")
|
||||
@ -67,7 +62,7 @@ o.inputtitle = translate("更新核心版本")
|
||||
o.description = string.format(translate("目前运行主程序版本") .. "<strong><font color=\"green\">: %s </font></strong>", ver)
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
luci.sys.exec("bash /usr/share/UnblockNeteaseMusic/update_core.sh 2>&1")
|
||||
luci.sys.exec("/usr/share/UnblockNeteaseMusic/update_core.sh 2>&1")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "unblockmusic"))
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "ifup" ] && {
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
[ "$INTERFACE" = "wan" ] || exit 0
|
||||
|
||||
ipset -! -N music hash:ip
|
||||
sleep 10
|
||||
wget http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com -O- | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset -! add music "$1}' | sh
|
||||
}
|
||||
wget-ssl -t 99 -T 10 http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com -O- | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset -! add music "$1}' | sh
|
||||
|
@ -5,8 +5,6 @@ STOP=10
|
||||
|
||||
enable=$(uci get unblockmusic.@unblockmusic[0].enabled)
|
||||
TYPE=$(uci get unblockmusic.@unblockmusic[0].musicapptype)
|
||||
PROXY=$(uci get unblockmusic.@unblockmusic[0].proxy)
|
||||
ENDPOINT=$(uci get unblockmusic.@unblockmusic[0].endpoint)
|
||||
AUTOUPDATE=$(uci get unblockmusic.@unblockmusic[0].autoupdate)
|
||||
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
@ -82,12 +80,6 @@ start()
|
||||
|
||||
[ $enable -eq "0" ] && exit 0
|
||||
|
||||
endponintset=" ";
|
||||
|
||||
if [ -n "$ENDPOINT" ]; then
|
||||
endponintset="-e ${ENDPOINT}"
|
||||
fi
|
||||
|
||||
rm -f /tmp/unblockmusic.log
|
||||
echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log
|
||||
|
||||
@ -97,7 +89,7 @@ start()
|
||||
musictype="-o $TYPE"
|
||||
fi
|
||||
|
||||
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5200:5201 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
node /usr/share/UnblockNeteaseMusic/app.js -e http://music.163.com -p 5200:5201 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
|
||||
set_firewall
|
||||
add_cron
|
||||
@ -107,7 +99,7 @@ start()
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 $(busybox ps -w | grep UnblockNeteaseMusic/app.js | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
kill -9 $(busybox ps -w | grep UnblockNeteaseMusic/app.js | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
kill -9 $(busybox ps -w | grep logcheck.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
rm -f /tmp/unblockmusic.log
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 10
|
||||
wget http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com -O- | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset -! add music "$1}' | sh
|
@ -1,10 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
log_max_size="10" #使用KB计算
|
||||
log_max_size="100" #使用KB计算
|
||||
log_file="/tmp/unblockmusic.log"
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 10s
|
||||
icount=`busybox ps -w | grep UnblockNeteaseMusic/app.js |grep -v grep| wc -l`
|
||||
if [ $icount -ne 1 ] ;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
|
||||
|
Loading…
Reference in New Issue
Block a user