mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 19:12:33 +08:00
Merge Lean's source
This commit is contained in:
parent
3298b7c401
commit
6bd0b94b15
13
package/lean/UnblockNeteaseMusic-Go/001-endpoint.patch
Normal file
13
package/lean/UnblockNeteaseMusic-Go/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:=UnblockNeteaseMusic-Go
|
||||
PKG_VERSION:=0.1.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/cnsilvan/UnblockNeteaseMusic.git
|
||||
@ -32,14 +32,15 @@ define Package/$(PKG_NAME)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
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/UnblockNeteaseMusic-Go/files/ca.crt
Normal file
21
package/lean/UnblockNeteaseMusic-Go/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/UnblockNeteaseMusic-Go/files/server.crt
Normal file
21
package/lean/UnblockNeteaseMusic-Go/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/UnblockNeteaseMusic-Go/files/server.key
Normal file
27
package/lean/UnblockNeteaseMusic-Go/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
|
||||
|
||||
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/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
|
||||
|
Loading…
x
Reference in New Issue
Block a user