mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-17 21:03:30 +00:00
luci-app-unblockneteasemusic: 3in1 newversion (Go,NodeJS,Cloud)
This commit is contained in:
parent
43722f400c
commit
e74da1e2ef
13
package/lean/UnblockNeteaseMusicGo/001-endpoint.patch
Normal file
13
package/lean/UnblockNeteaseMusicGo/001-endpoint.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- a/processor/processor.go
|
||||
+++ b/processor/processor.go
|
||||
@@ -390,7 +390,7 @@
|
||||
//data["url"] = uri.Scheme + "://" + uri.Host + uri.EscapedPath()
|
||||
//data["url"] = uri.String()
|
||||
if *config.EndPoint{
|
||||
- data["url"]="https://music.163.com/unblockmusic/"+uri.String()
|
||||
+ data["url"]="http://music.163.com/unblockmusic/"+uri.String()
|
||||
}else{
|
||||
data["url"] = uri.String()
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusicGo
|
||||
PKG_VERSION:=0.1.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/cnsilvan/UnblockNeteaseMusic.git
|
||||
@ -30,16 +30,17 @@ define Package/$(PKG_NAME)
|
||||
CATEGORY:=Network
|
||||
TITLE:=Revive unavailable songs for Netease Cloud Music (Golang)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
DEPENDS:=@!HAS_FPU $(GO_ARCH_DEPENDS)
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Revive unavailable songs for Netease Cloud Music (Golang)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
# tar -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)
|
||||
# unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||
# $(call Build/Prepare/Default)
|
||||
tar -zxvf $(DL_DIR)/$(PKG_SOURCE) -C $(BUILD_DIR)/$(PKG_NAME) --strip-components 1
|
||||
$(CP) ./001-endpoint.patch $(BUILD_DIR)/$(PKG_NAME)/
|
||||
patch -d $(BUILD_DIR)/$(PKG_NAME) -p1 < 001-endpoint.patch
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
@ -57,7 +58,8 @@ endef
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic $(1)/usr/bin/UnblockNeteaseMusic
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusic
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusicGo
|
||||
$(CP) ./files/* $(1)/usr/share/UnblockNeteaseMusicGo/
|
||||
|
||||
endef
|
||||
$(eval $(call GoBinPackage,$(PKG_NAME)))
|
||||
|
21
package/lean/UnblockNeteaseMusicGo/files/ca.crt
Normal file
21
package/lean/UnblockNeteaseMusicGo/files/ca.crt
Normal file
@ -0,0 +1,21 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDdzCCAl+gAwIBAgIJAKX8LdIETDklMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV
|
||||
BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb
|
||||
BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTE5MDUxODE2MDU0NVoXDTI0
|
||||
MDUxNjE2MDU0NVowUjELMAkGA1UEBhMCQ04xJDAiBgNVBAMMG1VuYmxvY2tOZXRl
|
||||
YXNlTXVzaWMgUm9vdCBDQTEdMBsGA1UECgwUR2l0SHViLmNvbSBAbm9uZGFuZWUw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD23K6Ti2TfLJToCmpCAVgE
|
||||
Xb8+qTMfrifCpnKlJ+hrL+4KI1j4vSqTOOatqmxGSXZdF/j2kJuI40YThaokcgYx
|
||||
GFcPcEftSCYGWy8o20u2hzTkkW3KW9wlsDRIXICFXVIsHeSDwz+aVSudkyJHjfaS
|
||||
aLNb5pPovE7MRj8tDbp55scaSqhEcOe3m1ZlwlCeeXvD7RLKr3xhBKbGEqlJAjFq
|
||||
RNGzuqylqyJVBLScNHC7Lcf4n6pKr1yPGOeLePOUrIwtj0ynHUcBfeMuCVCsIKL8
|
||||
vy/oNwlDrZaAMfu5QQslzEf87KY1QgtI6Ppii+tzbmVx1ZxnlaCKqiuwlgBoi/5r
|
||||
AgMBAAGjUDBOMB0GA1UdDgQWBBRDhbGjnXEUouE9wNFS2k9PtgYYjDAfBgNVHSME
|
||||
GDAWgBRDhbGjnXEUouE9wNFS2k9PtgYYjDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3
|
||||
DQEBCwUAA4IBAQDRUh5+JFLEALXQkhPfwrVf4sCXTwLMwVujTPo3NMbhpWiP4cnn
|
||||
XHGCD5V57bBwjeD6NSrczDIdnN9uTJyFmLNVFMZBguEIeZfLUJLJ6w1ZhfgciX1D
|
||||
9djyyo6eclkHvi+aPZKfzgMmc5BvHcjyUyS5MzI23kUW6WXUDn3IDIUKrfaH9Mjc
|
||||
/d4DDZVKQCYrLoBL+XO7pEHUY0u9XZVYWEavQ5tSN8XY1SDrO0yGUpRWET0ltubE
|
||||
zV7W0LOhuoVCiemboc5H8+njBjCis8obAo1XMmDZzW189L9GPFxHNWlka+KlajZB
|
||||
tMo90PooZYEOw1rTUrzHb+VZY/tYIAAomGZ0
|
||||
-----END CERTIFICATE-----
|
21
package/lean/UnblockNeteaseMusicGo/files/server.crt
Normal file
21
package/lean/UnblockNeteaseMusicGo/files/server.crt
Normal file
@ -0,0 +1,21 @@
|
||||
-----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-----
|
27
package/lean/UnblockNeteaseMusicGo/files/server.key
Normal file
27
package/lean/UnblockNeteaseMusicGo/files/server.key
Normal file
@ -0,0 +1,27 @@
|
||||
-----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-----
|
13
package/lean/luci-app-unblockmusic/Config.in
Normal file
13
package/lean/luci-app-unblockmusic/Config.in
Normal file
@ -0,0 +1,13 @@
|
||||
choice
|
||||
prompt "Select UnblockNeteaseMusic APP"
|
||||
default UnblockNeteaseMusic_Go
|
||||
|
||||
config UnblockNeteaseMusic_Go
|
||||
bool "Go"
|
||||
|
||||
config UnblockNeteaseMusic_NodeJS
|
||||
bool "NodeJS"
|
||||
|
||||
endchoice
|
||||
|
||||
|
@ -8,12 +8,22 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-unblockmusic
|
||||
PKG_VERSION:=2.3.1
|
||||
PKG_RELEASE:=22
|
||||
PKG_RELEASE:=28
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_UnblockNeteaseMusic_Go \
|
||||
CONFIG_UnblockNeteaseMusic_NodeJS
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
LUCI_TITLE:=LuCI support for Unblock NeteaseCloudMusic
|
||||
LUCI_DEPENDS:=+UnblockNeteaseMusic +dnsmasq-full +ipset +wget +coreutils +coreutils-nohup
|
||||
LUCI_DEPENDS:=+dnsmasq-full +ipset +wget +UnblockNeteaseMusic_NodeJS:UnblockNeteaseMusic +UnblockNeteaseMusic_Go:UnblockNeteaseMusicGo
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_MAINTAINER:=lean
|
||||
|
@ -16,7 +16,7 @@ end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("busybox ps -w | grep UnblockNeteaseMusic/app.js | grep -v grep >/dev/null")==0
|
||||
e.running=luci.sys.call("busybox ps -w | grep UnblockNeteaseMusic | grep -v grep >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
mp = Map("unblockmusic", translate("解锁网易云灰色歌曲"))
|
||||
mp.description = translate("采用 [QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源,替换网易云变灰歌曲链接")
|
||||
@ -13,7 +14,16 @@ enabled.default = 0
|
||||
enabled.rmempty = false
|
||||
enabled.description = translate("启用后,路由器自动分流解锁,大部分设备无需设置代理")
|
||||
|
||||
speedtype = s:option(ListValue, "musicapptype", translate("音源选择"))
|
||||
apptype = s:option(ListValue, "apptype", translate("解锁程序选择"))
|
||||
if nixio.fs.access("/usr/bin/UnblockNeteaseMusic") then
|
||||
apptype:value("go", translate("Golang 版本"))
|
||||
end
|
||||
if nixio.fs.access("/usr/share/UnblockNeteaseMusic/app.js") then
|
||||
apptype:value("nodejs", translate("NodeJS 版本"))
|
||||
end
|
||||
apptype:value("cloud", translate("云解锁([CTCGFW]Project OpenWrt 服务器)"))
|
||||
|
||||
speedtype = s:option(Value, "musicapptype", translate("音源选择"))
|
||||
speedtype:value("default", translate("默认"))
|
||||
speedtype:value("netease", translate("网易云音乐"))
|
||||
speedtype:value("qq", translate("QQ音乐"))
|
||||
@ -23,47 +33,40 @@ speedtype:value("kugou", translate("酷狗音乐"))
|
||||
speedtype:value("kuwo", translate("酷我音乐(高音质/FLACの解锁可能性)"))
|
||||
speedtype:value("migu", translate("咕咪音乐"))
|
||||
speedtype:value("joox", translate("JOOX音乐"))
|
||||
speedtype.default = "kuwo"
|
||||
speedtype:depends("apptype", "nodejs")
|
||||
speedtype:depends("apptype", "go")
|
||||
|
||||
o = s:option(Button,"certificate",translate("HTTPS 证书"))
|
||||
o.inputtitle = translate("下载 CA 根证书")
|
||||
o.description = translate("新版安卓/iOS客户端可能需要安装 CA根证书并信任<br />苹果系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA )")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
Download()
|
||||
end
|
||||
cloudserver = s:option(Value, "cloudserver", translate("服务器位置"))
|
||||
cloudserver:value("cdn-shanghai.service.project-openwrt.eu.org:30000:30001", translate("[CTCGFW] 腾讯云上海(高音质)"))
|
||||
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.default = "cdn-shanghai.service.project-openwrt.eu.org:30000:30001"
|
||||
cloudserver.rmempty = true
|
||||
cloudserver:depends("apptype", "cloud")
|
||||
|
||||
function Download()
|
||||
local t,e
|
||||
t=nixio.open("/usr/share/UnblockNeteaseMusic/ca.crt","r")
|
||||
luci.http.header('Content-Disposition','attachment; filename="ca.crt"')
|
||||
luci.http.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
e=t:read(nixio.const.buffersize)
|
||||
if(not e)or(#e==0)then
|
||||
break
|
||||
else
|
||||
luci.http.write(e)
|
||||
end
|
||||
end
|
||||
t:close()
|
||||
luci.http.close()
|
||||
end
|
||||
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 参数 )")
|
||||
|
||||
o = s:option(Flag, "autoupdate")
|
||||
o.title = translate("自动检查更新主程序")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
o.description = translate("每天自动检测并更新到最新版本")
|
||||
o:depends("apptype", "nodejs")
|
||||
|
||||
local ver = luci.sys.exec("cat /usr/share/UnblockNeteaseMusic/core_ver")
|
||||
local ver = fs.readfile("/usr/share/UnblockNeteaseMusic/core_ver") or "0.00"
|
||||
|
||||
o = s:option(Button, "restart",translate("手动更新"))
|
||||
o.inputtitle = translate("更新核心版本")
|
||||
o.description = string.format(translate("目前运行主程序版本") .. "<strong><font color=\"green\">: %s </font></strong>", ver)
|
||||
o.description = string.format(translate("NodeJS 解锁主程序版本") .. "<strong><font color=\"green\">: %s </font></strong>", ver)
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
luci.sys.exec("/usr/share/UnblockNeteaseMusic/update_core.sh luci_update 2>&1")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "unblockmusic"))
|
||||
end
|
||||
o:depends("apptype", "nodejs")
|
||||
|
||||
return mp
|
||||
|
@ -7,7 +7,7 @@ t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 20
|
||||
function t.cfgvalue()
|
||||
luci.sys.exec("grep -B 1 'http' /tmp/unblockmusic.log | grep -v 'running' > /tmp/music.log")
|
||||
luci.sys.exec("grep -B 1 'http' /tmp/unblockmusic.log | grep -v -e'running' -e'TLS Server' -e'Transport' -e'POST' -e'github' -e'consumed' -e'starting'-e'TLS handshake' > /tmp/music.log")
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
config unblockmusic
|
||||
option musicapptype 'default'
|
||||
option autoupdate '1'
|
||||
option musicapptype 'kuwo'
|
||||
option autoupdate '0'
|
||||
option endpoint 'http://music.163.com'
|
||||
option enabled '0'
|
||||
option apptype 'go'
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
[ "$INTERFACE" = "wan" ] || exit 0
|
||||
|
||||
ipset -! -N music hash:ip
|
||||
sleep 10
|
||||
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
|
||||
wget-ssl -q -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
|
||||
|
@ -3,9 +3,41 @@
|
||||
START=97
|
||||
STOP=10
|
||||
|
||||
enable=$(uci get unblockmusic.@unblockmusic[0].enabled)
|
||||
TYPE=$(uci get unblockmusic.@unblockmusic[0].musicapptype)
|
||||
AUTOUPDATE=$(uci get unblockmusic.@unblockmusic[0].autoupdate)
|
||||
NAME=unblockmusic
|
||||
|
||||
uci_get_by_type() {
|
||||
local ret=$(uci get $NAME.@$1[0].$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
|
||||
hostip=$host
|
||||
elif [ "$host" != "${host#*:[0-9a-fA-F]}" ]; then
|
||||
hostip=$host
|
||||
else
|
||||
hostip=$(ping $host -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1)
|
||||
if echo $hostip | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
||||
hostip=$hostip
|
||||
else
|
||||
hostip="127.0.0.1"
|
||||
fi
|
||||
fi
|
||||
echo -e $hostip
|
||||
}
|
||||
|
||||
ENABLE=$(uci_get_by_type unblockmusic enabled 0)
|
||||
TYPE=$(uci_get_by_type unblockmusic musicapptype default)
|
||||
AUTOUPDATE=$(uci_get_by_type unblockmusic autoupdate 0)
|
||||
APPTYPE=$(uci_get_by_type unblockmusic apptype go)
|
||||
|
||||
CLOUD=$(uci_get_by_type unblockmusic cloudserver "127.0.0.1:5200:5201")
|
||||
cloudadd=$(echo "$CLOUD" | awk -F ':' '{print $1}')
|
||||
cloudhttp=$(echo "$CLOUD" | awk -F ':' '{print $2}')
|
||||
cloudhttps=$(echo "$CLOUD" | awk -F ':' '{print $3}')
|
||||
|
||||
cloudip=$(check_host $cloudadd)
|
||||
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
|
||||
@ -14,25 +46,30 @@ ipt_n="iptables -t nat"
|
||||
add_rule()
|
||||
{
|
||||
ipset -! -N music 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
|
||||
$ipt_n -A cloud_music -d 127.0.0.0/8 -j RETURN
|
||||
$ipt_n -A cloud_music -d 169.254.0.0/16 -j RETURN
|
||||
$ipt_n -A cloud_music -d 172.16.0.0/12 -j RETURN
|
||||
$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 --dport 80 -j REDIRECT --to-ports 5200
|
||||
$ipt_n -A cloud_music -p tcp --dport 443 -j REDIRECT --to-ports 5201
|
||||
$ipt_n -I PREROUTING -p tcp -m set --match-set music dst -j cloud_music
|
||||
$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
|
||||
$ipt_n -A CLOUD_MUSIC -d 127.0.0.0/8 -j RETURN
|
||||
$ipt_n -A CLOUD_MUSIC -d 169.254.0.0/16 -j RETURN
|
||||
$ipt_n -A CLOUD_MUSIC -d 172.16.0.0/12 -j RETURN
|
||||
$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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
del_rule(){
|
||||
$ipt_n -D PREROUTING -p tcp -m set --match-set music dst -j cloud_music 2>/dev/null
|
||||
$ipt_n -F cloud_music 2>/dev/null
|
||||
$ipt_n -X cloud_music 2>/dev/null
|
||||
$ipt_n -D PREROUTING -p tcp -m set --match-set music dst -j CLOUD_MUSIC 2>/dev/null
|
||||
$ipt_n -F CLOUD_MUSIC 2>/dev/null
|
||||
$ipt_n -X CLOUD_MUSIC 2>/dev/null
|
||||
iptables -D OUTPUT -d 223.252.199.10 -j DROP 2>/dev/null
|
||||
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
@ -78,28 +115,41 @@ start()
|
||||
{
|
||||
stop
|
||||
|
||||
[ $enable -eq "0" ] && exit 0
|
||||
|
||||
[ $ENABLE -eq "0" ] && exit 0
|
||||
|
||||
rm -f /tmp/unblockmusic.log
|
||||
echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log
|
||||
|
||||
if [ $TYPE = "default" ]; then
|
||||
if [ "$TYPE" = "default" ]; then
|
||||
musictype=" "
|
||||
else
|
||||
musictype="-o $TYPE"
|
||||
fi
|
||||
|
||||
nohup env "ENABLE_FLAC=true" node /usr/share/UnblockNeteaseMusic/app.js -e http://music.163.com -p 5200:5201 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
|
||||
if [ "$APPTYPE" == "nodejs" ]; then
|
||||
export ENABLE_FLAC=true
|
||||
node /usr/share/UnblockNeteaseMusic/app.js -e http://music.163.com -p 5200:5201 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
add_cron
|
||||
echo "$(date -R) # UnblockNeteaseMusic Nodejs Version (http:5200, https:5201)" >>/tmp/unblockmusic.log
|
||||
elif [ "$APPTYPE" == "go" ]; then
|
||||
UnblockNeteaseMusic -p 5200 -sp 5201 -c /usr/share/UnblockNeteaseMusicGo/server.crt -k /usr/share/UnblockNeteaseMusicGo/server.key -m 0 -e >>/tmp/unblockmusic.log 2>&1 &
|
||||
echo "$(date -R) # UnblockNeteaseMusic Golang Version (http:5200, https:5201)" >>/tmp/unblockmusic.log
|
||||
else
|
||||
kill -9 $(busybox ps -w | grep 'sleep 60m' | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
/usr/bin/UnblockNeteaseMusicCloud >/dev/null 2>&1 &
|
||||
echo "$(date -R) # UnblockNeteaseMusic Cloud Version - Server: $cloudip (http:$cloudhttp, https:$cloudhttp)" >>/tmp/unblockmusic.log
|
||||
fi
|
||||
|
||||
set_firewall
|
||||
add_cron
|
||||
|
||||
/usr/share/UnblockNeteaseMusic/logcheck.sh >/dev/null 2>&1 &
|
||||
|
||||
if [ "$APPTYPE" != "cloud" ]; then
|
||||
/usr/share/UnblockNeteaseMusic/logcheck.sh >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
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 | 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,3 +1,6 @@
|
||||
/usr/share/UnblockNeteaseMusic/ca.crt
|
||||
/usr/share/UnblockNeteaseMusic/server.crt
|
||||
/usr/share/UnblockNeteaseMusic/server.key
|
||||
/usr/share/UnblockNeteaseMusic/server.key
|
||||
/usr/share/UnblockNeteaseMusicGo/ca.crt
|
||||
/usr/share/UnblockNeteaseMusicGo/server.crt
|
||||
/usr/share/UnblockNeteaseMusicGo/server.key
|
8
package/lean/luci-app-unblockmusic/root/usr/bin/UnblockNeteaseMusicCloud
Executable file
8
package/lean/luci-app-unblockmusic/root/usr/bin/UnblockNeteaseMusicCloud
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
while true
|
||||
do
|
||||
ipset -! -N music hash:ip
|
||||
wget-ssl -q -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
|
||||
sleep 60m
|
||||
done
|
@ -7,7 +7,7 @@ log_size=0
|
||||
while true
|
||||
do
|
||||
sleep 10m
|
||||
icount=`busybox ps -w | grep UnblockNeteaseMusic/app.js |grep -v grep`
|
||||
icount=`busybox ps -w | grep UnblockNeteaseMusic |grep -v grep`
|
||||
[ -z "$icount" ] && /etc/init.d/unblockmusic restart
|
||||
log_size=$(expr $(ls -l $log_file | awk '{print $5}') / 1024)
|
||||
[ $log_size -ge $log_max_size ] && echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log
|
||||
|
@ -1,15 +0,0 @@
|
||||
# Copyright (C) 2020 Silvan
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic Go
|
||||
LUCI_DEPENDS:=+coreutils-nohup +dnsmasq-full +ipset +UnblockNeteaseMusicGo
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-unblockneteasemusic-go
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_MAINTAINER:=https://github.com/cnsilvan/luci-app-unblockneteasemusic
|
||||
|
||||
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 Silvan
|
||||
-- https://github.com/cnsilvan/luci-app-unblockneteasemusic
|
||||
|
||||
module("luci.controller.unblockneteasemusic", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/unblockneteasemusic") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic"},firstchild(), _("解除网易云音乐播放限制"), 50).dependent = false
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic", "general"},cbi("unblockneteasemusic"), _("基本设定"), 1)
|
||||
entry({"admin", "services", "unblockneteasemusic", "log"},form("unblockneteasemusic_log"), _("日志"), 2)
|
||||
|
||||
entry({"admin", "services", "unblockneteasemusic", "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,92 +0,0 @@
|
||||
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:section(SimpleSection).template = "unblockneteasemusic/unblockneteasemusic_status"
|
||||
|
||||
s = mp:section(TypedSection, "unblockneteasemusic")
|
||||
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("customize", translate("自定义"))
|
||||
music_source.description = translate("默认为kuwo:kugou")
|
||||
music_source.default = "default"
|
||||
music_source.rmempty = false
|
||||
|
||||
music_customize_source = s:option(Value, "music_customize_source", translate("自定义音源"))
|
||||
music_customize_source.description = translate("自定义音源设置,如kuwo:kugou:migu ,以:隔开,migu在某些运营商下无法使用可能会导致卡顿")
|
||||
music_customize_source.default = "kuwo:kugou"
|
||||
music_customize_source.rmempty = false
|
||||
music_customize_source:depends("music_source", "customize")
|
||||
|
||||
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,路由器不建议使用Hosts劫持")
|
||||
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
|
||||
|
||||
download = s:option(FileUpload,"", translate("下载根证书"))
|
||||
download.description = translate("请在客户端信任该证书。该证书由你设备自动生成,安全可靠")
|
||||
download.rmempty = false
|
||||
download.template = "unblockneteasemusic/unblockneteasemusic_download"
|
||||
function Download()
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/UnblockNeteaseMusic/ca.crt"
|
||||
sFile = nixio.fs.basename(sPath)
|
||||
if luci.fs.isdirectory(sPath) then
|
||||
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
|
||||
sFile = sFile .. ".tar.gz"
|
||||
else
|
||||
fd = nixio.open(sPath, "r")
|
||||
end
|
||||
if not fd then
|
||||
download.description = string.format('请在客户端信任该证书。该证书由你设备自动生成,安全可靠<br/><span style="color: red">%s</span>', translate("Couldn't open file: ") .. sPath)
|
||||
return
|
||||
end
|
||||
download.description = translate("请在客户端信任该证书。该证书由你设备自动生成,安全可靠")
|
||||
http.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
|
||||
http.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
block = fd:read(nixio.const.buffersize)
|
||||
if (not block) or (#block ==0) then
|
||||
break
|
||||
else
|
||||
http.write(block)
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
http.close()
|
||||
end
|
||||
if luci.http.formvalue("download") then
|
||||
Download()
|
||||
end
|
||||
return mp
|
@ -1,14 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/tmp/unblockneteasemusic.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,3 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<input type="submit" class="cbi-button cbi-input-apply" name="download" value="<%:Download%>" />
|
||||
<%+cbi/valuefooter%>
|
@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[unblockneteasemusic]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('unblockneteasemusic_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>UnblockNeteaseMusic <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="unblockneteasemusic_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
@ -1,8 +0,0 @@
|
||||
|
||||
config unblockneteasemusic
|
||||
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,135 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
|
||||
lan_addr="$(uci get network.lan.ipaddr)"
|
||||
|
||||
enable="$(uci get unblockneteasemusic.@unblockneteasemusic[0].enable)"
|
||||
http_port="$(uci get unblockneteasemusic.@unblockneteasemusic[0].http_port)"
|
||||
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)"
|
||||
extFile="/usr/share/UnblockNeteaseMusic/extFile.txt"
|
||||
serverCrt="/usr/share/UnblockNeteaseMusic/server.crt"
|
||||
serverKey="/usr/share/UnblockNeteaseMusic/server.key"
|
||||
serverCsr="/usr/share/UnblockNeteaseMusic/server.csr"
|
||||
caCrt="/usr/share/UnblockNeteaseMusic/ca.crt"
|
||||
caKey="/usr/share/UnblockNeteaseMusic/ca.key"
|
||||
logFile="/tmp/unblockneteasemusic.log"
|
||||
set_ipset() {
|
||||
if [ "${set_type}" = "start" ]; then
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic.conf"
|
||||
cat <<-EOF >"/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic.conf"
|
||||
ipset=/.music.163.com/unblockneteasemusic
|
||||
ipset=/interface.music.163.com/unblockneteasemusic
|
||||
ipset=/interface3.music.163.com/unblockneteasemusic
|
||||
ipset=/apm.music.163.com/unblockneteasemusic
|
||||
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 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
|
||||
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
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 127.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 169.254.0.0/16 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 172.16.0.0/12 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 192.168.0.0/16 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A cloud_unblockneteasemusic -d 240.0.0.0/4 -j RETURN
|
||||
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
|
||||
|
||||
mkdir -p /var/etc
|
||||
cat <<-EOF >>"/var/etc/unblockneteasemusic.include"
|
||||
/etc/init.d/unblockneteasemusic restart
|
||||
EOF
|
||||
elif [ "${set_type}" = "stop" ]; then
|
||||
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
|
||||
ipset destroy unblockneteasemusic
|
||||
|
||||
echo "" >"/var/etc/unblockneteasemusic.include"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic.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.conf"
|
||||
cat <<-EOF >"/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic.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.conf"
|
||||
/etc/init.d/dnsmasq reload >"/dev/null" 2>&1
|
||||
# ip route del 223.252.199.10
|
||||
fi
|
||||
}
|
||||
createCertificate() {
|
||||
echo "create certificate..." >>"${logFile}"
|
||||
# 生成 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 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}"
|
||||
}
|
||||
start() {
|
||||
stop >>"${logFile}" 2>&1
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
if [ ! -f "$serverCrt" ]; then
|
||||
createCertificate >>"${logFile}" 2>&1
|
||||
fi
|
||||
if [ "${music_source}" = "default" ]; then
|
||||
nohup UnblockNeteaseMusic -p "${http_port}" -sp "${https_port}" -m 0 -c "${serverCrt}" -k "${serverKey}" >>"${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 &
|
||||
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/d' /etc/crontabs/root
|
||||
echo "*/5 * * * * /usr/share/UnblockNeteaseMusic/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/d' "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart >"/dev/null" 2>&1
|
||||
|
||||
rm -f "${logFile}"
|
||||
|
||||
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 unblockneteasemusic "$1}' |bash > "/dev/null" 2>&1
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@unblockneteasemusic[-1]
|
||||
add ucitrack unblockneteasemusic
|
||||
set ucitrack.@unblockneteasemusic[-1].init=unblockneteasemusic
|
||||
commit ucitrack
|
||||
delete firewall.unblockneteasemusic
|
||||
set firewall.unblockneteasemusic=include
|
||||
set firewall.unblockneteasemusic.type=script
|
||||
set firewall.unblockneteasemusic.path=/var/etc/unblockneteasemusic.include
|
||||
set firewall.unblockneteasemusic.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
log_max_size="16" #使用KB计算
|
||||
log_file="/tmp/unblockneteasemusic.log"
|
||||
|
||||
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
|
||||
(( "${log_size}" >= "${log_max_size}" )) && echo "" > "${log_file}"
|
||||
|
||||
[ "*$(uci get unblockneteasemusic.@unblockneteasemusic[0].daemon_enable)*" == "*1*" ] && { [ -z "$(ps |grep "UnblockNeteaseMusic" |grep -v "grep")" ] && /etc/init.d/unblockneteasemusic restart; }
|
@ -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
|
||||
|
||||
PKG_NAME:=luci-app-unblockneteasemusic-mini
|
||||
PKG_VERSION:=1.2
|
||||
PKG_RELEASE:=7
|
||||
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic(Mini)
|
||||
LUCI_DEPENDS:=+dnsmasq-full +ipset +iptables +wget
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -1,23 +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-mini", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/unblockneteasemusic-mini") then
|
||||
return
|
||||
end
|
||||
|
||||
local page
|
||||
page = entry({"admin", "services", "unblockneteasemusic-mini"}, cbi("unblockneteasemusic-mini"), _("云解锁网易云音乐"), 100)
|
||||
page.dependent = true
|
||||
entry({"admin", "services", "unblockneteasemusic-mini", "status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("iptables -t nat -L -v -n |grep unblock_netease_music |grep -v grep >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
@ -1,30 +0,0 @@
|
||||
-- Created By [CTCGFW]Project-OpenWrt
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
mp = Map("unblockneteasemusic-mini", translate("解除网易云音乐播放限制 (Mini)"))
|
||||
mp.description = translate("原理:采用 [QQ/酷狗/酷我/咕咪] 等音源,替换网易云音乐 无版权/收费 歌曲链接<br/>由 [CTCGFW]Project-OpenWrt & hyird & Sunsky 提供服务器支持<br/>详细说明参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic-mini")
|
||||
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic-mini/unblockneteasemusic_mini_status"
|
||||
|
||||
s = mp:section(TypedSection, "unblockneteasemusic-mini")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
enable = s:option(Flag, "enable", translate("启用本插件"))
|
||||
enable.description = translate("启用本插件以解除网易云音乐播放限制")
|
||||
enable.default = 0
|
||||
enable.rmempty = false
|
||||
|
||||
select_server = s:option(ListValue, "select_server", translate("服务器位置"))
|
||||
select_server:value("tencent_shanghai_nodejs", translate("[CTCGFW] 腾讯云上海(高音质)"))
|
||||
select_server:value("aliyun_beijing_nodejs", translate("[hyird] 阿里云北京(高音质)"))
|
||||
select_server:value("aliyun_beijing_nodejs_2", translate("[Sunsky] 阿里云北京(高音质)"))
|
||||
select_server:value("mobile_henan_nodejs",translate("[CTCGFW] 移动河南(无损音质)"))
|
||||
select_server.description = translate("请合理使用本插件与各个服务器,请勿滥用")
|
||||
select_server.default = "tencent_shanghai_nodejs"
|
||||
select_server.rmempty = false
|
||||
|
||||
download_certificate=s:option(DummyValue,"opennewwindow",translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"下载CA根证书\" onclick=\"window.open('https://raw.githubusercontent.com/nondanee/UnblockNeteaseMusic/master/ca.crt')\" />"))
|
||||
download_certificate.description = translate("Linux/iOS/MacOSX设备在信任根证书后方可正常使用解锁功能。")
|
||||
|
||||
return mp
|
@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[unblockneteasemusic-mini]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('unblockneteasemusic_mini_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>UnblockNeteaseMusic-Mini <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic-Mini <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="unblockneteasemusic_mini_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
@ -1,5 +0,0 @@
|
||||
|
||||
config unblockneteasemusic-mini
|
||||
option enable '0'
|
||||
option select_server 'tencent_shanghai_nodejs'
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
[ "$INTERFACE" = "wan" ] || exit 0
|
||||
|
||||
ipset -! -N "neteasemusic" hash:ip
|
||||
sleep 10
|
||||
wget-ssl -t 5 -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 neteasemusic "$1}' |sh
|
@ -1,93 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
START=80
|
||||
STOP=10
|
||||
|
||||
enable="$(uci get unblockneteasemusic-mini.@unblockneteasemusic-mini[0].enable)"
|
||||
select_server="$(uci get unblockneteasemusic-mini.@unblockneteasemusic-mini[0].select_server)"
|
||||
|
||||
if [ "${select_server}" = "tencent_shanghai_nodejs" ]; then
|
||||
unblock_server_ip="$(ping "cdn-shanghai.service.project-openwrt.eu.org" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
|
||||
[ -z "${unblock_server_ip}" ] && unblock_server_ip="122.51.88.18"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
elif [ "${select_server}" = "aliyun_beijing_nodejs" ]; then
|
||||
unblock_server_ip="$(ping "hyird.xyz" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
|
||||
[ -z "${unblock_server_ip}" ] && unblock_server_ip="182.92.84.98"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
elif [ "${select_server}" = "aliyun_beijing_nodejs_2" ]; then
|
||||
unblock_server_ip="39.96.56.58"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
elif [ "${select_server}" = "mobile_henan_nodejs" ]; then
|
||||
unblock_server_ip="$(ping "cdn-henan.service.project-openwrt.eu.org" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
|
||||
[ -z "${unblock_server_ip}" ] && exit 1
|
||||
unblock_server_http_port="33221"
|
||||
unblock_server_https_port="33222"
|
||||
fi
|
||||
|
||||
set_ipset(){
|
||||
if [ "${set_type}" = "start" ]; then
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-mini.conf"
|
||||
cat <<-EOF > "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-mini.conf"
|
||||
ipset=/.music.163.com/neteasemusic
|
||||
ipset=/interface.music.163.com/neteasemusic
|
||||
ipset=/interface3.music.163.com/neteasemusic
|
||||
ipset=/apm.music.163.com/neteasemusic
|
||||
ipset=/apm3.music.163.com/neteasemusic
|
||||
ipset=/clientlog.music.163.com/neteasemusic
|
||||
ipset=/clientlog3.music.163.com/neteasemusic
|
||||
EOF
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
if ! ipset list "neteasemusic" >/dev/null; then ipset create "neteasemusic" hash:ip; fi
|
||||
wget-ssl -t 5 -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 neteasemusic "$1}' |sh
|
||||
iptables -t nat -N "unblock_netease_music"
|
||||
iptables -t nat -A "unblock_netease_music" -d 0.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 10.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 127.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 169.254.0.0/16 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 172.16.0.0/12 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 192.168.0.0/16 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -d 240.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A "unblock_netease_music" -p tcp --dport 80 -j DNAT --to ${unblock_server_ip}:${unblock_server_http_port}
|
||||
iptables -t nat -A "unblock_netease_music" -p tcp --dport 443 -j DNAT --to ${unblock_server_ip}:${unblock_server_https_port}
|
||||
[ -z "$(iptables -t nat -L "ADBYBY" | grep "UnblockMusic" | sed 's/\/.*//')" ] && iptables -t nat -I "ADBYBY" -m set --match-set "neteasemusic" dst -j RETURN -m comment --comment "AD for UnblockMusic"
|
||||
[ -z "$(iptables -t nat -L "KOOLPROXY" | grep "UnblockMusic" | sed 's/\/.*//')" ] && iptables -t nat -I "KOOLPROXY" -m set --match-set "neteasemusic" dst -j RETURN -m comment --comment "KP for UnblockMusic"
|
||||
iptables -t nat -I "PREROUTING" -p tcp -m set --match-set "neteasemusic" dst -j "unblock_netease_music"
|
||||
|
||||
mkdir -p /var/etc
|
||||
echo -e "/etc/init.d/unblockneteasemusic-mini restart" > "/var/etc/unblockneteasemusic-mini.include"
|
||||
elif [ "${set_type}" = "stop" ]; then
|
||||
iptables -t nat -D "ADBYBY" -m set --match-set "neteasemusic" dst -j RETURN -m comment --comment "AD for UnblockMusic"
|
||||
iptables -t nat -D "KOOLPROXY" -m set --match-set "neteasemusic" dst -j RETURN -m comment --comment "KP for UnblockMusic"
|
||||
iptables -t nat -D "PREROUTING" -p tcp -m set --match-set "neteasemusic" dst -j "unblock_netease_music"
|
||||
iptables -t nat -F "unblock_netease_music"
|
||||
iptables -t nat -X "unblock_netease_music"
|
||||
ipset destroy "neteasemusic"
|
||||
|
||||
echo "" > "/var/etc/unblockneteasemusic-mini.include"
|
||||
rm -f "/tmp/dnsmasq.d/dnsmasq-unblockneteasemusic-mini.conf"
|
||||
/etc/init.d/dnsmasq reload >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
set_type="start"
|
||||
set_ipset >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
set_type="stop"
|
||||
set_ipset >/dev/null 2>&1
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@unblockneteasemusic-mini[-1]
|
||||
add ucitrack unblockneteasemusic-mini
|
||||
set ucitrack.@unblockneteasemusic-mini[-1].init=unblockneteasemusic-mini
|
||||
commit ucitrack
|
||||
delete firewall.unblockneteasemusic_mini
|
||||
set firewall.unblockneteasemusic_mini=include
|
||||
set firewall.unblockneteasemusic_mini.type=script
|
||||
set firewall.unblockneteasemusic_mini.path=/var/etc/unblockneteasemusic-mini.include
|
||||
set firewall.unblockneteasemusic_mini.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user