Merge Lean's source
This commit is contained in:
parent
b890508f6f
commit
235cdfeaae
@ -28,13 +28,14 @@ include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Revive unavailable songs for Netease Cloud Music (Golang)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
TITLE:=Revive Netease Cloud Music (Golang)
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
SUBMENU:=NeteaseMusic
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Revive unavailable songs for Netease Cloud Music (Golang)
|
||||
Revive Netease Cloud Music (Golang)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
||||
@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic
|
||||
PKG_VERSION:=0.24.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nondanee/UnblockNeteaseMusic.git
|
||||
PKG_SOURCE_VERSION:=436046c63b1d985c62e6695beaa21672423a747a
|
||||
PKG_SOURCE_VERSION:=0bc075540bca3c41bb6243cecdb5fc8a7c13a986
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz
|
||||
@ -27,14 +27,14 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Revive unavailable songs for Netease Cloud Music
|
||||
DEPENDS:=+node +libopenssl
|
||||
TITLE:=Revive Netease Cloud Music (NodeJS)
|
||||
DEPENDS:=+node +libopenssl
|
||||
URL:=https://github.com/nondanee/UnblockNeteaseMusic/releases
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Revive unavailable songs for Netease Cloud Music
|
||||
Revive Netease Cloud Music (NodeJS)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
||||
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-unblockmusic
|
||||
PKG_VERSION:=2.3.1
|
||||
PKG_RELEASE:=30
|
||||
PKG_RELEASE:=32
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_UnblockNeteaseMusic_Go \
|
||||
|
||||
@ -21,7 +21,7 @@ end
|
||||
if nixio.fs.access("/usr/share/UnblockNeteaseMusic/app.js") then
|
||||
apptype:value("nodejs", translate("NodeJS 版本"))
|
||||
end
|
||||
apptype:value("cloud", translate("云解锁([CTCGFW]Project OpenWrt 服务器)"))
|
||||
apptype:value("cloud", translate("云解锁( [CTCGFW] 云服务器)"))
|
||||
|
||||
speedtype = s:option(Value, "musicapptype", translate("音源选择"))
|
||||
speedtype:value("default", translate("默认"))
|
||||
@ -42,13 +42,13 @@ cloudserver:value("cdn-shanghai.service.project-openwrt.eu.org:30000:30001", tra
|
||||
cloudserver:value("hyird.xyz:30000:30001", translate("[hyird] 阿里云北京(高音质)"))
|
||||
cloudserver:value("39.96.56.58:30000:30000", translate("[Sunsky] 阿里云北京(高音质)"))
|
||||
cloudserver:value("cdn-henan.service.project-openwrt.eu.org:33221:33222",translate("[CTCGFW] 移动河南(无损音质)"))
|
||||
cloudserver.description = translate("自定义服务器格式为 IP[域名]:HTTP端口:HTTPS端口")
|
||||
cloudserver.description = translate("自定义服务器格式为 IP[域名]:HTTP端口:HTTPS端口<br />如果服务器为LAN内网IP,需要将这个服务器IP放入例外客户端 (不代理HTTP和HTTPS)")
|
||||
cloudserver.default = "cdn-shanghai.service.project-openwrt.eu.org:30000:30001"
|
||||
cloudserver.rmempty = true
|
||||
cloudserver:depends("apptype", "cloud")
|
||||
|
||||
download_certificate=s:option(DummyValue,"opennewwindow",translate("HTTPS 证书"))
|
||||
download_certificate.description = translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"下载CA根证书\" onclick=\"window.open('https://raw.githubusercontent.com/nondanee/UnblockNeteaseMusic/master/ca.crt')\" /><br />Mac/iOS客户端需要安装 CA根证书并信任<br />iOS系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA <br />Linux 设备请在启用时加入 --ignore-certificate-errors 参数 )")
|
||||
download_certificate.description = translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"下载CA根证书\" onclick=\"window.open('https://raw.githubusercontent.com/nondanee/UnblockNeteaseMusic/master/ca.crt')\" /><br />Mac/iOS客户端需要安装 CA根证书并信任<br />iOS系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA <br />Linux 设备请在启用时加入 --ignore-certificate-errors 参数")
|
||||
|
||||
o = s:option(Flag, "autoupdate")
|
||||
o.title = translate("自动检查更新主程序")
|
||||
@ -69,4 +69,29 @@ o.write = function()
|
||||
end
|
||||
o:depends("apptype", "nodejs")
|
||||
|
||||
t=mp:section(TypedSection,"acl_rule",translate("例外客户端规则"),
|
||||
translate("可以为局域网客户端分别设置不同的例外模式,默认无需设置"))
|
||||
t.template="cbi/tblsection"
|
||||
t.sortable=true
|
||||
t.anonymous=true
|
||||
t.addremove=true
|
||||
|
||||
e=t:option(Value,"ipaddr",translate("IP Address"))
|
||||
e.width="40%"
|
||||
e.datatype="ip4addr"
|
||||
e.placeholder="0.0.0.0/0"
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
e:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
|
||||
e=t:option(ListValue,"filter_mode",translate("例外协议"))
|
||||
e.width="40%"
|
||||
e.default="disable"
|
||||
e.rmempty=false
|
||||
e:value("disable",translate("不代理HTTP和HTTPS"))
|
||||
e:value("http",translate("不代理HTTP"))
|
||||
e:value("https",translate("不代理HTTPS"))
|
||||
|
||||
return mp
|
||||
|
||||
@ -10,6 +10,16 @@ uci_get_by_type() {
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_get_by_name() {
|
||||
local index=0
|
||||
if [ -n $4 ]; then
|
||||
|
||||
index=$4
|
||||
fi
|
||||
local ret=$(uci get $NAME.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
check_host() {
|
||||
local host=$1
|
||||
if echo $host | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
||||
@ -27,6 +37,30 @@ check_host() {
|
||||
echo -e $hostip
|
||||
}
|
||||
|
||||
ip_rule()
|
||||
{
|
||||
local icount=$(uci show unblockmusic | grep 'filter_mode' | wc -l)
|
||||
let icount=icount-1
|
||||
for i in $(seq 0 $icount)
|
||||
do
|
||||
local ip=$(uci_get_by_name acl_rule ipaddr '' $i)
|
||||
local mode=$(uci_get_by_name acl_rule filter_mode '' $i)
|
||||
echo $i $ip $mode
|
||||
case "$mode" in
|
||||
http)
|
||||
ipset -! add music_http $ip
|
||||
;;
|
||||
https)
|
||||
ipset -! add music_https $ip
|
||||
;;
|
||||
disable)
|
||||
ipset -! add music_http $ip
|
||||
ipset -! add music_https $ip
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
ENABLE=$(uci_get_by_type unblockmusic enabled 0)
|
||||
TYPE=$(uci_get_by_type unblockmusic musicapptype default)
|
||||
AUTOUPDATE=$(uci_get_by_type unblockmusic autoupdate 0)
|
||||
@ -46,6 +80,8 @@ ipt_n="iptables -t nat"
|
||||
add_rule()
|
||||
{
|
||||
ipset -! -N music hash:ip
|
||||
ipset -! -N music_http hash:ip
|
||||
ipset -! -N music_https hash:ip
|
||||
$ipt_n -N CLOUD_MUSIC
|
||||
$ipt_n -A CLOUD_MUSIC -d 0.0.0.0/8 -j RETURN
|
||||
$ipt_n -A CLOUD_MUSIC -d 10.0.0.0/8 -j RETURN
|
||||
@ -56,14 +92,16 @@ add_rule()
|
||||
$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
|
||||
if [ "$APPTYPE" != "cloud" ]; then
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp --dport 80 -j REDIRECT --to-ports 5200
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp --dport 443 -j REDIRECT --to-ports 5201
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_http src --dport 80 -j REDIRECT --to-ports 5200
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_https src --dport 443 -j REDIRECT --to-ports 5201
|
||||
else
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp --dport 80 -j DNAT --to $cloudip:$cloudhttp
|
||||
$ipt_n -A CLOUD_MUSIC -p tcp --dport 443 -j DNAT --to $cloudip:$cloudhttps
|
||||
fi
|
||||
$ipt_n -I PREROUTING -p tcp -m set --match-set music dst -j CLOUD_MUSIC
|
||||
iptables -I OUTPUT -d 223.252.199.10 -j DROP
|
||||
|
||||
ip_rule
|
||||
}
|
||||
|
||||
del_rule(){
|
||||
@ -72,6 +110,9 @@ del_rule(){
|
||||
$ipt_n -X CLOUD_MUSIC 2>/dev/null
|
||||
iptables -D OUTPUT -d 223.252.199.10 -j DROP 2>/dev/null
|
||||
|
||||
ipset -X music_http 2>/dev/null
|
||||
ipset -X music_https 2>/dev/null
|
||||
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
/etc/init.d/dnsmasq reload >/dev/null 2>&1
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user