UnblockNeteaseMusic-Go: bump to 0.1.6
This commit is contained in:
parent
2ed5e9be67
commit
6babbadc9d
@ -1,72 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic-Go
|
||||
PKG_VERSION:=snapshot
|
||||
PKG_RELEASE:=r35-07453d1
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_amd64
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_386
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_mipsle
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_mips
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
ifeq ($(BOARD),kirkwood)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_arm5
|
||||
else ifeq ($(BOARD),bcm53xx)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_arm5
|
||||
else
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_arm7
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH_UnblockNeteaseMusic:=linux_arm64
|
||||
endif
|
||||
|
||||
PKG_SOURCE:=UnblockNeteaseMusic_$(PKG_ARCH_UnblockNeteaseMusic).tar.gz
|
||||
PKG_SOURCE_URL:=https://package.project-openwrt.eu.org/utils/UnblockNeteaseMusic-Go/$(PKG_RELEASE)/
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
|
||||
PKG_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/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
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
tar -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
chmod 0755 $(PKG_BUILD_DIR)/UnblockNeteaseMusic
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/UnblockNeteaseMusic $(1)/usr/bin/UnblockNeteaseMusic
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusic-Go
|
||||
$(INSTALL_CONF) ./cert/server.crt $(1)/usr/share/UnblockNeteaseMusic-Go/server.crt
|
||||
$(INSTALL_CONF) ./cert/server.key $(1)/usr/share/UnblockNeteaseMusic-Go/server.key
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -1,21 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDfTCCAmWgAwIBAgIJAKTlW9B59i1HMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV
|
||||
BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb
|
||||
BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTE5MDUxODE2MDYxOFoXDTIw
|
||||
MDUxNzE2MDYxOFowezELMAkGA1UEBhMCQ04xETAPBgNVBAcMCEhhbmd6aG91MSww
|
||||
KgYDVQQKDCNOZXRFYXNlIChIYW5nemhvdSkgTmV0d29yayBDby4sIEx0ZDERMA8G
|
||||
A1UECwwISVQgRGVwdC4xGDAWBgNVBAMMDyoubXVzaWMuMTYzLmNvbTCCASIwDQYJ
|
||||
KoZIhvcNAQEBBQADggEPADCCAQoCggEBALobECypwEoe8VqM/FJvBRR3p2T+ZWdi
|
||||
MSPrwfiRJr5p7OMtWBlLveCBV85+R3feidYbQTXlvVTdToY+GN6mFE1x6zG2dvLD
|
||||
s4UuRnipmvGcFYhIRTX8J4AJiN8VMtW0TNXscRMudpz/FAVtsRrggRaThYg4f/rI
|
||||
oAPMqKMsS4JoYhxs9ED6E6/tpj3XmSg1ekaXhgacYSYHeyxizZwoOFVCLH3TG5sF
|
||||
sD6CYNnukYol8bR+VRpvHftIYss5Yz+DyyhYEAMJm1CfQo+xoGR3D0ozbT3hUnzm
|
||||
fEoOhmSp3sALrFVE4iJSuajoh2/3xhmcyi3xZdWyq4F8hpb+URyaoW0CAwEAAaMt
|
||||
MCswKQYDVR0RBCIwIIINbXVzaWMuMTYzLmNvbYIPKi5tdXNpYy4xNjMuY29tMA0G
|
||||
CSqGSIb3DQEBCwUAA4IBAQB32SVz5jHUYv3ZG7SNF/LFJ904/LI8QlTe9R+Abb9z
|
||||
bpXmQeo4pvNNOk3LgcTyuSIPQSHEFn32hk/MedB6Q2cKaGVKQq7Usne1jsV0JirG
|
||||
wMx3PTcKPnX+XexRY8s6v6cNKSx5YlMQNFeH7p8MgKqdM/UX/dNCxT04X/ClmP1K
|
||||
/rKqonXn4i3wmWprl7Q7Z1wqt0ygQRkNJKqdYKTu4oQcPON8/dRcseYdJzSoK2/G
|
||||
H6cOJwKrRLzuUqQlphe6wyUsyTIbIJiFu1a1Gml6zB4lhLZhL89H2lYwdS8wWlc+
|
||||
M+wYi+XTM/ylNHEIoKsOe2nscnwi/hTfHJOPPchHbEuM
|
||||
-----END CERTIFICATE-----
|
||||
@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEAuhsQLKnASh7xWoz8Um8FFHenZP5lZ2IxI+vB+JEmvmns4y1Y
|
||||
GUu94IFXzn5Hd96J1htBNeW9VN1Ohj4Y3qYUTXHrMbZ28sOzhS5GeKma8ZwViEhF
|
||||
NfwngAmI3xUy1bRM1exxEy52nP8UBW2xGuCBFpOFiDh/+sigA8yooyxLgmhiHGz0
|
||||
QPoTr+2mPdeZKDV6RpeGBpxhJgd7LGLNnCg4VUIsfdMbmwWwPoJg2e6RiiXxtH5V
|
||||
Gm8d+0hiyzljP4PLKFgQAwmbUJ9Cj7GgZHcPSjNtPeFSfOZ8Sg6GZKnewAusVUTi
|
||||
IlK5qOiHb/fGGZzKLfFl1bKrgXyGlv5RHJqhbQIDAQABAoIBAEmAvtalBMlBh1mY
|
||||
LV/xcTQwPfDpeOtoILhrOOUPjxnNhD4FfrIe9BNjgmaQAXIadp4VjZ/X6PtHnOfw
|
||||
RqpJNeOQhq/PvRMMsC59pF+rvQKH/wkgYhV8Ta2IFoLlQHqfB2nGRLKquzYumJ28
|
||||
QSK4YMOl6CtxBTrrWiemAUTRDdGm8tARiipJH1SEJrS6d/NoRoJx2vixFgD2eS6X
|
||||
bjnhGjIzvX/w5FWjctqj+SFITP1UI62b6DyWsPOkoosKNteK+Ulz+K6ZFvOx7day
|
||||
XgUoTcVpwCVr2dVGhJtOrbKPcl1jYCYHJAHwzUZND4x4yftm1mnnsi3bthYqbtHQ
|
||||
vxLE9YECgYEA9hiZxwiVvLjSe1xT/D75HbB8S1XSnwzpMmqgzStguxCQ0Qg5yiLI
|
||||
UKRDY8UZvEDV4i2bQGy7mk8lFvX1q2z7Q30+dtT9r2N9a6ujMk5RMfo2BZg/poI6
|
||||
yDWe2tKUg9cTwfgni4TutLOYkpz3VDPIQHs3k2mpNh7f+8X4RIybDqkCgYEAwZhp
|
||||
uWMV38Bb0WytswHXL1dRuwBskKqALUBY61dtXkyBuocj8AuRRxfxfZpgJRrHFxDX
|
||||
O9bQ2nxpVlwKsR6DJDUdxU3+kvwyPfseU5XUBey8WdkuAKD7cKZOHMhFVWccks0U
|
||||
YJzykNrxB+rGTiwVKa0MOhipuJ7boerwwaN2SyUCgYBP9Ow5o4tq9q3EUNoksZ0k
|
||||
zUuE+oxlCr/VlplKL9bM0HQMxlxoVWa59LTEfKyA4pvbUbAIfYtydlZ5oE5CdTUp
|
||||
105tM4R88Jk2W1y5ooJ093OH29CKW/OXSvyi4hpIv592vRa0GOupoFRpBkDBhdWB
|
||||
RcdnyMOmht+FIOwp8XkLiQKBgAUK3j4Y6ZnxXbLfvMp70soF4TgYs7s05a/IDEjc
|
||||
9xlMrthX6sS22GrcocqeucBdqS/dnW2Ok9QNB4VbUl/4pnvL8mGQPYBAl2Jr5wdQ
|
||||
ULxyxRkmAf+8MbBmdIRlZwDpdaIRO2Wk0OCbA0osgEvK9CYovrfIqqsHYDsgbnLs
|
||||
ugkNAoGBAJok06BN05caPXXLQ2pMwI/7mjcZFjcOMxSloYi7LFkxlyvoTqReAeSa
|
||||
yOb6W/7obS1X8ms/EAkqiyzJuPtNZJCW/nvV0iCoZ/NxLuyHnFaO344GBAweol+S
|
||||
Jx0MY8KuDCyeGErc2xdz/yr3ld2PSTq71dhBluGyba2YX+peJ2Yv
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@ -1,21 +0,0 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is a free software, use it under GNU General Public License v3.0.
|
||||
#
|
||||
# Created By [CTCGFW]Project-OpenWrt
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic-Go
|
||||
LUCI_DEPENDS:=+bash +busybox +coreutils-nohup +curl +dnsmasq-full +ipset +UnblockNeteaseMusic-Go
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-unblockneteasemusic-go
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@ -1,25 +0,0 @@
|
||||
-- This is a free software, use it under GNU General Public License v3.0.
|
||||
-- Created By [CTCGFW]Project OpenWRT
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
module("luci.controller.unblockneteasemusic-go", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/unblockneteasemusic-go") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic-go"},firstchild(), _("解除网易云音乐播放限制 (Golang)"), 50).dependent = false
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic-go", "general"},cbi("unblockneteasemusic-go"), _("基本设定"), 1)
|
||||
entry({"admin", "services", "unblockneteasemusic-go", "log"},form("unblockneteasemusicgo_log"), _("日志"), 2)
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic-go", "status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pidof UnblockNeteaseMusic >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@ -1,51 +0,0 @@
|
||||
mp = Map("unblockneteasemusic-go", translate("解除网易云音乐播放限制 (Golang)"))
|
||||
mp.description = translate("原理:采用 [酷我/酷狗/咕咪] 音源,替换网易云音乐 无版权/收费 歌曲链接<br/>具体使用方法参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic-go")
|
||||
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic-go/unblockneteasemusic_go_status"
|
||||
|
||||
s = mp:section(TypedSection, "unblockneteasemusic-go")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
enable = s:option(Flag, "enable", translate("启用本插件"))
|
||||
enable.description = translate("启用本插件以解除网易云音乐播放限制")
|
||||
enable.default = 0
|
||||
enable.rmempty = false
|
||||
|
||||
http_port = s:option(Value, "http_port", translate("[HTTP] 监听端口"))
|
||||
http_port.description = translate("本插件监听的HTTP端口,不可与其他程序/HTTPS共用一个端口")
|
||||
http_port.placeholder = "5210"
|
||||
http_port.default = "5210"
|
||||
http_port.datatype = "port"
|
||||
http_port.rmempty = false
|
||||
|
||||
https_port = s:option(Value, "https_port", translate("[HTTPS] 监听端口"))
|
||||
https_port.description = translate("本插件监听的HTTPS端口,不可与其他程序/HTTP共用一个端口")
|
||||
https_port.placeholder = "5211"
|
||||
https_port.default = "5211"
|
||||
https_port.datatype = "port"
|
||||
https_port.rmempty = false
|
||||
|
||||
music_source = s:option(ListValue, "music_source", translate("音源接口"))
|
||||
music_source:value("default", translate("默认"))
|
||||
music_source:value("kuwo", translate("酷我音乐"))
|
||||
music_source:value("kugou", translate("酷狗音乐"))
|
||||
music_source:value("migu", translate("咕咪音乐"))
|
||||
music_source.description = translate("音源调用接口")
|
||||
music_source.default = "default"
|
||||
music_source.rmempty = false
|
||||
|
||||
hijack = s:option(ListValue, "hijack_ways", translate("劫持方法"))
|
||||
hijack:value("dont_hijack", translate("不开启劫持"))
|
||||
hijack:value("use_ipset", translate("使用IPSet劫持"))
|
||||
hijack:value("use_hosts", translate("使用Hosts劫持"))
|
||||
hijack.description = translate("如果使用Hosts劫持,请将HTTP/HTTPS端口设置为80/443")
|
||||
hijack.default = "dont_hijack"
|
||||
hijack.rmempty = false
|
||||
|
||||
daemon_enable = s:option(Flag, "daemon_enable", translate("启用进程守护"))
|
||||
daemon_enable.description = translate("开启后,附属程序会自动检测主程序运行状态,在主程序退出时自动重启")
|
||||
daemon_enable.default = 0
|
||||
daemon_enable.rmempty = false
|
||||
|
||||
return mp
|
||||
@ -1,14 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/tmp/unblockneteasemusic-go.log"
|
||||
|
||||
f = SimpleForm("logview")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 15
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
||||
return f
|
||||
@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[unblockneteasemusic-go]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('unblockneteasemusic_go_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>UnblockNeteaseMusic-Go <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic-Go <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="unblockneteasemusic_go_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
@ -1,8 +0,0 @@
|
||||
|
||||
config unblockneteasemusic-go
|
||||
option enable '0'
|
||||
option http_port '5210'
|
||||
option https_port '5211'
|
||||
option music_source 'default'
|
||||
option hijack_ways 'use_ipset'
|
||||
option daemon_enable '0'
|
||||
@ -1,118 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
|
||||
lan_addr="$(uci get network.lan.ipaddr)"
|
||||
|
||||
enable="$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].enable)"
|
||||
http_port="$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].http_port)"
|
||||
https_port="$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].https_port)"
|
||||
music_source="$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].music_source)"
|
||||
hijack_ways="$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].hijack_ways)"
|
||||
|
||||
set_ipset(){
|
||||
if [ "${set_type}" = "start" ]; then
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
cat <<-EOF > "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
ipset=/.music.163.com/musicgo
|
||||
ipset=/interface.music.163.com/musicgo
|
||||
ipset=/interface3.music.163.com/musicgo
|
||||
ipset=/apm.music.163.com/musicgo
|
||||
ipset=/apm3.music.163.com/musicgo
|
||||
EOF
|
||||
/etc/init.d/dnsmasq reload > "/dev/null" 2>&1
|
||||
|
||||
if ! ipset list musicgo > "/dev/null"; then ipset create musicgo hash:ip; fi
|
||||
curl -s "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" |grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' |sort |uniq |awk '{print "ipset add musicgo "$1}' |bash > "/dev/null" 2>&1
|
||||
iptables -t nat -N cloud_music_go
|
||||
iptables -t nat -A cloud_music_go -d 0.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 10.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 127.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 169.254.0.0/16 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 172.16.0.0/12 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 192.168.0.0/16 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -d 240.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A cloud_music_go -p tcp --dport 80 -j REDIRECT --to-ports "${http_port}"
|
||||
iptables -t nat -A cloud_music_go -p tcp --dport 443 -j REDIRECT --to-ports "${https_port}"
|
||||
iptables -t nat -I PREROUTING -p tcp -m set --match-set musicgo dst -j cloud_music_go
|
||||
|
||||
mkdir -p /var/etc
|
||||
cat <<-EOF >> "/var/etc/unblockneteasemusic-go.include"
|
||||
/etc/init.d/unblockneteasemusic-go restart
|
||||
EOF
|
||||
elif [ "${set_type}" = "stop" ]; then
|
||||
iptables -t nat -D PREROUTING -p tcp -m set --match-set musicgo dst -j cloud_music_go
|
||||
iptables -t nat -F cloud_music_go
|
||||
iptables -t nat -X cloud_music_go
|
||||
ipset destroy musicgo
|
||||
|
||||
echo "" > "/var/etc/unblockneteasemusic-go.include"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
/etc/init.d/dnsmasq reload > "/dev/null" 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
set_hosts(){
|
||||
if [ "${set_type}" = "start" ]; then
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
cat <<-EOF > "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
address=/music.163.com/${lan_addr}
|
||||
address=/interface.music.163.com/${lan_addr}
|
||||
address=/interface3.music.163.com/${lan_addr}
|
||||
address=/apm.music.163.com/${lan_addr}
|
||||
address=/apm3.music.163.com/${lan_addr}
|
||||
address=/music.httpdns.c.163.com/0.0.0.0
|
||||
EOF
|
||||
/etc/init.d/dnsmasq reload > "/dev/null" 2>&1
|
||||
|
||||
ip route add 223.252.199.10 dev lo
|
||||
elif [ "${set_type}" = "stop" ]; then
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-go.conf"
|
||||
/etc/init.d/dnsmasq reload > "/dev/null" 2>&1
|
||||
|
||||
ip route del 223.252.199.10
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
if [ "${music_source}" = "default" ]; then
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -m "0" -c "/usr/share/UnblockNeteaseMusic-Go/server.crt" -k "/usr/share/UnblockNeteaseMusic-Go/server.key" > "/tmp/unblockneteasemusic-go.log" 2>&1 &
|
||||
else
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -o "${music_source}" -m "0" -c "/usr/share/UnblockNeteaseMusic-Go/server.crt" -k "/usr/share/UnblockNeteaseMusic-Go/server.key" > "/tmp/unblockneteasemusic-go.log" 2>&1 &
|
||||
fi
|
||||
|
||||
set_type="start"
|
||||
if [ "${hijack_ways}" = "use_ipset" ]; then
|
||||
set_ipset > "/dev/null" 2>&1
|
||||
elif [ "${hijack_ways}" = "use_hosts" ]; then
|
||||
set_hosts > "/dev/null" 2>&1
|
||||
fi
|
||||
|
||||
sed -i '/UnblockNeteaseMusic-Go/d' /etc/crontabs/root
|
||||
echo "*/5 * * * * /usr/share/UnblockNeteaseMusic-Go/log_check.sh" >> "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart > "/dev/null" 2>&1
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
killall -9 "UnblockNeteaseMusic" > "/dev/null" 2>&1
|
||||
|
||||
sed -i '/UnblockNeteaseMusic-Go/d' "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart > "/dev/null" 2>&1
|
||||
|
||||
rm -f "/tmp/unblockneteasemusic-go.log"
|
||||
|
||||
set_type="stop"
|
||||
set_ipset > "/dev/null" 2>&1
|
||||
set_hosts > "/dev/null" 2>&1
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 10
|
||||
curl -s "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" |grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' |sort |uniq |awk '{print "ipset add music "$1}' |bash > "/dev/null" 2>&1
|
||||
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@unblockneteasemusic-go[-1]
|
||||
add ucitrack unblockneteasemusic-go
|
||||
set ucitrack.@unblockneteasemusic-go[-1].init=unblockneteasemusic-go
|
||||
commit ucitrack
|
||||
delete firewall.unblockneteasemusic_go
|
||||
set firewall.unblockneteasemusic_go=include
|
||||
set firewall.unblockneteasemusic_go.type=script
|
||||
set firewall.unblockneteasemusic_go.path=/var/etc/unblockneteasemusic-go.include
|
||||
set firewall.unblockneteasemusic_go.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
log_max_size="4" #使用KB计算
|
||||
log_file="/tmp/unblockneteasemusic-go.log"
|
||||
|
||||
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
|
||||
(( "${log_size}" >= "${log_max_size}" )) && echo "" > "${log_file}"
|
||||
|
||||
[ "*$(uci get unblockneteasemusic-go.@unblockneteasemusic-go[0].daemon_enable)*" == "*1*" ] && { [ -z "$(ps |grep "UnblockNeteaseMusic-Go" |grep -v "grep")" ] && /etc/init.d/unblockneteasemusic-go restart; }
|
||||
@ -1,12 +1,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusicGo
|
||||
PKG_VERSION:=0.1.3
|
||||
PKG_RELEASE:=2
|
||||
PKG_NAME:=UnblockNeteaseMusic-Go
|
||||
PKG_VERSION:=0.1.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/cnsilvan/UnblockNeteaseMusic.git
|
||||
PKG_SOURCE_VERSION:=07453d1e938d7f6a284224ff68fbb89423d9c2c1
|
||||
PKG_SOURCE_VERSION:=4785d416e4ba33e38e446fa15f6791534d0ac182
|
||||
PKG_MAINTAINER:=Silvan <cnsilvan@gmail.com>
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
@ -1,3 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<input type="submit" class="cbi-button cbi-input-apply" name="download" value="<%:Download%>" />
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 10
|
||||
curl -s "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" |grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' |sort |uniq |awk '{print "ipset add unblockneteasemusic "$1}' |bash > "/dev/null" 2>&1
|
||||
@ -2,11 +2,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic Go
|
||||
LUCI_DEPENDS:=+coreutils-nohup +dnsmasq-full +ipset +UnblockNeteaseMusicGo
|
||||
LUCI_DEPENDS:=+bash +coreutils-nohup +curl +dnsmasq-full +ipset +UnblockNeteaseMusic-Go
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-unblockmusic-go
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=2
|
||||
PKG_NAME:=luci-app-unblockneteasemusic-go
|
||||
PKG_VERSION:=1.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=https://github.com/cnsilvan/luci-app-unblockneteasemusic
|
||||
|
||||
@ -2,7 +2,7 @@ local fs = require "luci.fs"
|
||||
local http = luci.http
|
||||
|
||||
mp = Map("unblockneteasemusic", translate("解除网易云音乐播放限制 (Golang)"))
|
||||
mp.description = translate("原理:采用 [酷我/酷狗/咕咪] 音源(后续有空补充),替换网易云音乐 灰色 歌曲链接<br/>具体使用方法参见:https://github.com/cnsilvan/luci-app-unblockneteasemusic<br/>首次使用会自动生成证书,所以较慢")
|
||||
mp.description = translate("原理:采用 [酷我/酷狗/咕咪] 音源(后续有空补充),替换网易云音乐 灰色 歌曲链接<br/>具体使用方法参见:https://github.com/cnsilvan/luci-app-unblockneteasemusic<br/>首次使用会自动生成证书,可能较慢")
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic/unblockneteasemusic_status"
|
||||
|
||||
s = mp:section(TypedSection, "unblockneteasemusic")
|
||||
@ -54,11 +54,25 @@ daemon_enable.description = translate("开启后,附属程序会自动检测
|
||||
daemon_enable.default = 0
|
||||
daemon_enable.rmempty = false
|
||||
|
||||
download = s:option(FileUpload,"", translate("下载根证书"))
|
||||
endpoint_enable = s:option(Flag, "endpoint_enable", translate("启用地址转换"))
|
||||
endpoint_enable.description = translate("开启后,设备需要信任证书,经测试ios设备需要开启,其他设备无法使用时再开启尝试")
|
||||
endpoint_enable.default = 0
|
||||
endpoint_enable.rmempty = false
|
||||
|
||||
delete = s:option(Button,"_delete", translate("删除根证书"))
|
||||
delete.description = translate("删除证书,以便下次启动时生成,可用于解决过期证书等问题")
|
||||
delete.inputstyle = "reload"
|
||||
delete.write = function()
|
||||
delete_()
|
||||
end
|
||||
download = s:option(Button,"_download", translate("下载根证书"))
|
||||
download.description = translate("请在客户端信任该证书。该证书由你设备自动生成,安全可靠")
|
||||
download.rmempty = false
|
||||
download.template = "unblockneteasemusic/unblockneteasemusic_download"
|
||||
function Download()
|
||||
download.inputstyle = "reload"
|
||||
download.write = function()
|
||||
download_()
|
||||
end
|
||||
|
||||
function download_()
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/UnblockNeteaseMusic/ca.crt"
|
||||
sFile = nixio.fs.basename(sPath)
|
||||
@ -86,7 +100,14 @@ function Download()
|
||||
fd:close()
|
||||
http.close()
|
||||
end
|
||||
if luci.http.formvalue("download") then
|
||||
Download()
|
||||
function delete_()
|
||||
local sPath, fd
|
||||
sPath = "/usr/share/UnblockNeteaseMusic/server.crt"
|
||||
fd = os.remove(sPath)
|
||||
if not fd then
|
||||
delete.description = string.format('删除证书,以便下次启动时生成,可用于解决过期证书等问题<br/><span style="color: red">%s</span>', translate("Couldn't delete file: ") .. sPath)
|
||||
return
|
||||
end
|
||||
delete.description = translate("删除证书,以便下次启动时生成,可用于解决过期证书等问题")
|
||||
end
|
||||
return mp
|
||||
@ -11,6 +11,7 @@ https_port="$(uci get unblockneteasemusic.@unblockneteasemusic[0].https_port)"
|
||||
music_source="$(uci get unblockneteasemusic.@unblockneteasemusic[0].music_source)"
|
||||
music_customize_source="$(uci get unblockneteasemusic.@unblockneteasemusic[0].music_customize_source)"
|
||||
hijack_ways="$(uci get unblockneteasemusic.@unblockneteasemusic[0].hijack_ways)"
|
||||
endpoint="$(uci get unblockneteasemusic.@unblockneteasemusic[0].endpoint_enable)"
|
||||
extFile="/usr/share/UnblockNeteaseMusic/extFile.txt"
|
||||
serverCrt="/usr/share/UnblockNeteaseMusic/server.crt"
|
||||
serverKey="/usr/share/UnblockNeteaseMusic/server.key"
|
||||
@ -18,6 +19,7 @@ serverCsr="/usr/share/UnblockNeteaseMusic/server.csr"
|
||||
caCrt="/usr/share/UnblockNeteaseMusic/ca.crt"
|
||||
caKey="/usr/share/UnblockNeteaseMusic/ca.key"
|
||||
logFile="/tmp/unblockneteasemusic.log"
|
||||
exArgs=" "
|
||||
set_ipset() {
|
||||
if [ "${set_type}" = "start" ]; then
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
@ -30,9 +32,11 @@ set_ipset() {
|
||||
ipset=/apm3.music.163.com/unblockneteasemusic
|
||||
EOF
|
||||
/etc/init.d/dnsmasq reload >"/dev/null" 2>&1
|
||||
if ! ipset list unblockneteasemusic >"/dev/null"; then ipset create unblockneteasemusic list:set; fi
|
||||
|
||||
if ! ipset list unblockneteasemusic >"/dev/null"; then ipset create unblockneteasemusic hash:ip; fi
|
||||
curl -s "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" | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset add unblockneteasemusic "$1}' | bash >"/dev/null" 2>&1
|
||||
if ! ipset list unblockneteasemusic4 >"/dev/null"; then ipset create unblockneteasemusic4 hash:ip family inet; fi
|
||||
curl -s "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" | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset add unblockneteasemusic4 "$1}' | bash >"/dev/null" 2>&1
|
||||
ipset add unblockneteasemusic unblockneteasemusic4
|
||||
iptables -t nat -N cloud_unblockneteasemusic
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 0.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 10.0.0.0/8 -j RETURN
|
||||
@ -45,7 +49,22 @@ set_ipset() {
|
||||
iptables -t nat -A cloud_unblockneteasemusic -p tcp --dport 80 -j REDIRECT --to-ports "${http_port}"
|
||||
iptables -t nat -A cloud_unblockneteasemusic -p tcp --dport 443 -j REDIRECT --to-ports "${https_port}"
|
||||
iptables -t nat -I PREROUTING -p tcp -m set --match-set unblockneteasemusic dst -j cloud_unblockneteasemusic
|
||||
|
||||
# ipv6
|
||||
if ! ipset list unblockneteasemusic6 >"/dev/null"; then ipset create unblockneteasemusic6 hash:ip family inet6; fi
|
||||
domains="music.163.com"
|
||||
for domain in $domains; do
|
||||
ip=$(ping6 ${domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')
|
||||
ipset add unblockneteasemusic6 $ip
|
||||
done
|
||||
ipset add unblockneteasemusic unblockneteasemusic6
|
||||
ip6tables -t nat -N cloud_unblockneteasemusic
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -d ::/8 -j RETURN
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -d FE80::/10 -j RETURN
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -d FC00::/7 -j RETURN
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -d FEC0::/10 -j RETURN
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -p tcp --dport 80 -j REDIRECT --to-ports "${http_port}"
|
||||
ip6tables -t nat -A cloud_unblockneteasemusic -p tcp --dport 443 -j REDIRECT --to-ports "${https_port}"
|
||||
ip6tables -t nat -I PREROUTING -p tcp -m set --match-set unblockneteasemusic dst -j cloud_unblockneteasemusic
|
||||
mkdir -p /var/etc
|
||||
cat <<-EOF >>"/var/etc/unblockneteasemusic.include"
|
||||
/etc/init.d/unblockneteasemusic restart
|
||||
@ -54,8 +73,12 @@ set_ipset() {
|
||||
iptables -t nat -D PREROUTING -p tcp -m set --match-set unblockneteasemusic dst -j cloud_unblockneteasemusic
|
||||
iptables -t nat -F cloud_unblockneteasemusic
|
||||
iptables -t nat -X cloud_unblockneteasemusic
|
||||
ip6tables -t nat -D PREROUTING -p tcp -m set --match-set unblockneteasemusic dst -j cloud_unblockneteasemusic
|
||||
ip6tables -t nat -F cloud_unblockneteasemusic
|
||||
ip6tables -t nat -X cloud_unblockneteasemusic
|
||||
ipset destroy unblockneteasemusic
|
||||
|
||||
ipset destroy unblockneteasemusic4
|
||||
ipset destroy unblockneteasemusic6
|
||||
echo "" >"/var/etc/unblockneteasemusic.include"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic.conf"
|
||||
/etc/init.d/dnsmasq reload >"/dev/null" 2>&1
|
||||
@ -87,15 +110,19 @@ createCertificate() {
|
||||
# 生成 CA 私钥
|
||||
openssl genrsa -out "${caKey}" 2048
|
||||
# 生成 CA 证书
|
||||
openssl req -x509 -new -nodes -key "${caKey}" -sha256 -days 1825 -out "${caCrt}" -subj "/C=CN/CN=UnblockNeteaseMusic Root CA/O=UnblockNeteaseMusic"
|
||||
openssl req -x509 -new -nodes -key "${caKey}" -sha256 -days 825 -out "${caCrt}" -subj "/C=CN/CN=UnblockNeteaseMusic Root CA/O=UnblockNeteaseMusic"
|
||||
# 生成服务器私钥
|
||||
openssl genrsa -out "${serverKey}" 2048
|
||||
# 生成证书签发请求
|
||||
openssl req -new -sha256 -key "${serverKey}" -out "${serverCsr}" -subj "/C=CN/L=Hangzhou/O=NetEase (Hangzhou) Network Co., Ltd/OU=IT Dept./CN=*.music.163.com"
|
||||
# 使用 CA 签发服务器证书
|
||||
touch "${extFile}"
|
||||
echo "subjectAltName=DNS:music.163.com,DNS:*.music.163.com" > "${extFile}"
|
||||
openssl x509 -req -extfile "${extFile}" -days 1825 -in "${serverCsr}" -CA "${caCrt}" -CAkey "${caKey}" -CAcreateserial -out "${serverCrt}"
|
||||
echo "authorityKeyIdentifier=keyid,issuer
|
||||
basicConstraints=CA:FALSE
|
||||
keyUsage=digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
|
||||
extendedKeyUsage=serverAuth,OCSPSigning
|
||||
subjectAltName=DNS:music.163.com,DNS:*.music.163.com" >"${extFile}"
|
||||
openssl x509 -req -extfile "${extFile}" -days 825 -in "${serverCsr}" -CA "${caCrt}" -CAkey "${caKey}" -CAcreateserial -out "${serverCrt}"
|
||||
}
|
||||
start() {
|
||||
stop >>"${logFile}" 2>&1
|
||||
@ -103,10 +130,13 @@ start() {
|
||||
if [ ! -f "$serverCrt" ]; then
|
||||
createCertificate >>"${logFile}" 2>&1
|
||||
fi
|
||||
if [ "${endpoint}" = "1" ]; then
|
||||
exArgs="-e"
|
||||
fi
|
||||
if [ "${music_source}" = "default" ]; then
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -m 0 -c "${serverCrt}" -k "${serverKey}" >>"${logFile}" 2>&1 &
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -m 0 -c "${serverCrt}" -k "${serverKey}" ${exArgs} >>"${logFile}" 2>&1 &
|
||||
else
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -o "${music_customize_source}" -m 0 -c "${serverCrt}" -k "${serverKey}" >>"${logFile}" 2>&1 &
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -o "${music_customize_source}" -m 0 -c "${serverCrt}" -k "${serverKey}" ${exArgs} >>"${logFile}" 2>&1 &
|
||||
fi
|
||||
|
||||
set_type="start"
|
||||
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
sleep 10
|
||||
curl -s "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" | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset add unblockneteasemusic4 "$1}' | bash >"/dev/null" 2>&1
|
||||
domains="music.163.com"
|
||||
for domain in $domains; do
|
||||
ip=$(ping6 ${domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')
|
||||
ipset add unblockneteasemusic6 $ip
|
||||
done
|
||||
Loading…
Reference in New Issue
Block a user