Skip to content

Commit

Permalink
bump release
Browse files Browse the repository at this point in the history
  • Loading branch information
1715173329 committed Jul 29, 2019
1 parent 470093e commit f2d75fe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LUCI_DEPENDS:=+node +bash +dnsmasq-full +ipset
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-unblockmusic
PKG_VERSION:=1.4
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_MAINTAINER:=<https://github.com/project-openwrt/luci-app-unblockmusic>

Expand Down
4 changes: 2 additions & 2 deletions luasrc/model/cbi/unblockmusic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enabled.default = 0
enabled.rmempty = false

enabled = s:option(Flag, "enable_ipset_forward", translate("启用IPSet劫持相关请求"))
enabled.description = translate("开启后,所有网易云音乐流量都会被劫持到UnblockNeteaseMusic进行处理")
enabled.description = translate("开启后,网易云音乐相关请求会被强制劫持到UnblockNeteaseMusic进行处理")
enabled.default = 1
enabled.rmempty = false
enabled:depends("enabled", 1)
Expand Down Expand Up @@ -70,7 +70,7 @@ enabled.rmempty = false
enabled:depends("advanced_mode", 1)

enabled = s:option(Flag, "ipset_forward_nohttps", translate("[IPSet] 不劫持HTTPS请求"))
enabled.description = translate("默认同时劫持HTTP&HTTPS两种请求,如您无相关需求,可勾选此选项")
enabled.description = translate("默认同时劫持HTTP&HTTPS两种请求,如无相关需求,可勾选此选项")
enabled.default = 0
enabled.rmempty = false
enabled:depends("advanced_mode", 1)
Expand Down
19 changes: 16 additions & 3 deletions root/etc/init.d/unblockmusic
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set_firewall(){

mkdir -p /var/etc
lan_addr="$(uci get network.lan.ipaddr)"
[ "$(uci get unblockmusic.@unblockmusic[0].ipset_forward_nohttps)" -eq "0" ] && forward_https="iptables -t nat -A cloud_music -i br-lan -p tcp --dport 443 -j DNAT --to ${lan_addr}:${https_port}"
[ "$(uci get unblockmusic.@unblockmusic[0].ipset_forward_nohttps)" -ne "0" ] || forward_https="iptables -t nat -A cloud_music -i br-lan -p tcp --dport 443 -j DNAT --to ${lan_addr}:${https_port}"
cat > "/var/etc/unblockmusic.include" <<-EOF
if ! ipset list music >/dev/null; then ipset create music hash:ip; fi
iptables -t nat -N cloud_music
Expand Down Expand Up @@ -48,14 +48,27 @@ set_hosts(){
uci set dhcp."${cfg_name}".name='interface.music.163.com'
uci set dhcp."${cfg_name}".ip="$(uci get network.lan.ipaddr)"
uci commit dhcp

cfg_name="$(uci add dhcp domain)"
uci set dhcp."${cfg_name}".name='music.httpdns.c.163.com'
uci set dhcp."${cfg_name}".ip="$(127.0.0.1)"
uci commit dhcp

ip route add 223.252.199.10 dev lo
elif [ "${set_type}" = "stop" ]; then
music_id1="$(uci show dhcp| grep "interface"| grep -Eo "domain\[[0-9]+\]"| grep -Eo "[0-9]+")"
uci delete dhcp.@domain["${music_id1}"]
uci commit dhcp

music_id2="$(uci show dhcp| grep "music"| grep -Eo "domain\[[0-9]+\]"| grep -Eo "[0-9]+")"
music_id2="$(uci show dhcp| grep "httpdns"| grep -Eo "domain\[[0-9]+\]"| grep -Eo "[0-9]+")"
uci delete dhcp.@domain["${music_id2}"]
uci commit dhcp

music_id3="$(uci show dhcp| grep "music"| grep -Eo "domain\[[0-9]+\]"| grep -Eo "[0-9]+")"
uci delete dhcp.@domain["${music_id3}"]
uci commit dhcp

ip route del 223.252.199.10
fi
}

Expand All @@ -72,7 +85,7 @@ start()
else
node /usr/share/unblockmusic/app.js -a ${addr} -p ${http_port}:${https_port} -o ${type} ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >/tmp/unblockmusic.log 2>&1 &
fi

[ "$(uci get unblockmusic.@unblockmusic[0].enable_ipset_forward)" -ne "0" ] && set_type="start" && set_firewall
[ "$(uci get unblockmusic.@unblockmusic[0].use_hosts)" -ne "0" ] && set_type="start" && set_hosts

Expand Down

0 comments on commit f2d75fe

Please sign in to comment.