mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 11:09:57 +08:00
Merge Lean's source
This commit is contained in:
parent
e6240b6d47
commit
3f0ede38af
@ -11,14 +11,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic
|
||||
PKG_VERSION:=2020.02.05
|
||||
PKG_VERSION:=0.23.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nondanee/UnblockNeteaseMusic.git
|
||||
PKG_SOURCE_VERSION:=98809174c3de3266a930e3af74df630075823304
|
||||
PKG_SOURCE_VERSION:=1251b9d96826ce5bb63131d0f18696253ec02127
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz
|
||||
|
@ -1,22 +1,19 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
# Copyright (C) 2020 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
# licheng
|
||||
# www.maxlicheng.com
|
||||
# 2019-06-08
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-unblockmusic
|
||||
PKG_VERSION:=2.2.0
|
||||
PKG_RELEASE:=11
|
||||
PKG_VERSION:=2.3.1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
LUCI_TITLE:=LuCI support for Unblock NeteaseCloudMusic
|
||||
LUCI_DEPENDS:=+UnblockNeteaseMusic +bash +dnsmasq-full +ipset
|
||||
LUCI_DEPENDS:=+UnblockNeteaseMusic +dnsmasq-full +ipset +wget
|
||||
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 app.js | grep -v grep >/dev/null")==0
|
||||
e.running=luci.sys.call("busybox ps -w | grep UnblockNeteaseMusic/app.js | grep -v grep >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -8,10 +8,15 @@ s = mp:section(TypedSection, "unblockmusic")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
enabled = s:option(Flag, "enabled", translate("启用解锁"))
|
||||
enabled = s:option(Flag, "enabled", translate("启用"))
|
||||
enabled.default = 0
|
||||
enabled.rmempty = false
|
||||
enabled.description = translate("启用后,路由器自动分流解锁,大部分设备无需设置代理。<br />苹果系列设备需要设置 WIFI/有线代理方式为 自动 ,并安装 CA根证书并信任。")
|
||||
enabled.description = translate("启用后,路由器自动分流解锁,大部分设备无需设置代理")
|
||||
|
||||
proxy = s:option(Flag, "proxy", translate("开启独立的HTTP代理服务"))
|
||||
proxy.default = 0
|
||||
proxy.rmempty = false
|
||||
proxy.description = translate("某些PC版本客户端不能自动解锁,需要手动设置 HTTP代理 为 路由器IP:5200端口 ")
|
||||
|
||||
speedtype = s:option(ListValue, "musicapptype", translate("音源选择"))
|
||||
speedtype:value("default", translate("默认"))
|
||||
@ -31,7 +36,7 @@ endpoint.description = translate("默认为 https://music.163.com")
|
||||
|
||||
o = s:option(Button,"certificate",translate("HTTPS 证书"))
|
||||
o.inputtitle = translate("下载 CA 根证书")
|
||||
o.description = translate("iOS 13 系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置” 中,信任 UnblockNeteaseMusic Root CA )")
|
||||
o.description = translate("新版安卓/iOS客户端可能需要安装 CA根证书并信任<br />苹果系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA )")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
Download()
|
||||
@ -71,4 +76,4 @@ o.write = function()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "unblockmusic"))
|
||||
end
|
||||
|
||||
return mp
|
||||
return mp
|
@ -1,5 +1,4 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/tmp/unblockmusic.log"
|
||||
local conffile = "/tmp/music.log"
|
||||
|
||||
f = SimpleForm("logview")
|
||||
@ -8,9 +7,9 @@ t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 20
|
||||
function t.cfgvalue()
|
||||
luci.sys.exec("grep -B 1 'http' /tmp/unblockmusic.log > /tmp/music.log")
|
||||
luci.sys.exec("grep -B 1 'http' /tmp/unblockmusic.log | grep -v 'running' > /tmp/music.log")
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
||||
return f
|
||||
return f
|
@ -1,129 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: zh-Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: luasrc/controller/unblockmusic.lua:11
|
||||
msgid "Base Setting"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/view/unblockmusic/unblockmusic_status.htm:20
|
||||
msgid "Collecting data..."
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:32
|
||||
msgid "HTTPS 证书"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:25
|
||||
msgid "JOOX音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/controller/unblockmusic.lua:12
|
||||
msgid "Log"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/view/unblockmusic/unblockmusic_status.htm:10
|
||||
msgid "NOT RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:19
|
||||
msgid "QQ音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/view/unblockmusic/unblockmusic_status.htm:7
|
||||
msgid "RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:34
|
||||
msgid ""
|
||||
"iOS 13 系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置” 中,信任 "
|
||||
"UnblockNeteaseMusic Root CA )"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:33
|
||||
msgid "下载 CA 根证书"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:14
|
||||
msgid ""
|
||||
"启用后,路由器自动分流解锁,大部分设备无需设置代理。<br />苹果系列设备需要设"
|
||||
"置 WIFI/有线代理方式为 自动 ,并安装 CA根证书并信任。"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:11
|
||||
msgid "启用解锁"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:24
|
||||
msgid "咕咪音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:65
|
||||
msgid "手动更新"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:66
|
||||
msgid "更新核心版本"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:61
|
||||
msgid "每天自动检测并更新到最新版本"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:21
|
||||
msgid "百度音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:67
|
||||
msgid "目前运行主程序版本"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:18
|
||||
msgid "网易云音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:58
|
||||
msgid "自动检查更新主程序"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:20
|
||||
msgid "虾米音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/controller/unblockmusic.lua:9 luasrc/model/cbi/unblockmusic.lua:2
|
||||
msgid "解锁网易云灰色歌曲"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:27
|
||||
msgid "转发HTTPS音源地址"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:23
|
||||
msgid "酷我音乐(高音质推荐)"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:22
|
||||
msgid "酷狗音乐"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:3
|
||||
msgid "采用 [QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源,替换网易云变灰歌曲链接"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:16
|
||||
msgid "音源选择"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:17
|
||||
msgid "默认"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/unblockmusic.lua:30
|
||||
msgid "默认为 https://music.163.com"
|
||||
msgstr ""
|
@ -1,10 +1,8 @@
|
||||
|
||||
config unblockmusic
|
||||
option enabled '0'
|
||||
option musicapptype 'default'
|
||||
option port '5200'
|
||||
option enable_ipset '1'
|
||||
option endpoint 'https://music.163.com'
|
||||
option autoupdate '1'
|
||||
|
||||
option endpoint 'https://music.163.com'
|
||||
option proxy '1'
|
||||
option enabled '0'
|
||||
|
||||
|
@ -5,7 +5,7 @@ STOP=10
|
||||
|
||||
enable=$(uci get unblockmusic.@unblockmusic[0].enabled)
|
||||
TYPE=$(uci get unblockmusic.@unblockmusic[0].musicapptype)
|
||||
ROUTE_IP=$(uci get network.lan.ipaddr)
|
||||
PROXY=$(uci get unblockmusic.@unblockmusic[0].proxy)
|
||||
ENDPOINT=$(uci get unblockmusic.@unblockmusic[0].endpoint)
|
||||
AUTOUPDATE=$(uci get unblockmusic.@unblockmusic[0].autoupdate)
|
||||
|
||||
@ -25,25 +25,28 @@ add_rule()
|
||||
$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 -j REDIRECT --to-ports 5200
|
||||
$ipt_n -I PREROUTING -p tcp --dport 80 -m set --match-set music dst -j cloud_music
|
||||
$ipt_n -A cloud_music -p tcp --dport 80 -j REDIRECT --to-ports 5201
|
||||
$ipt_n -A cloud_music -p tcp --dport 443 -j REDIRECT --to-ports 5202
|
||||
$ipt_n -I PREROUTING -p tcp -m set --match-set music dst -j cloud_music
|
||||
}
|
||||
|
||||
del_rule(){
|
||||
$ipt_n -D PREROUTING -p tcp --dport 80 -m set --match-set music dst -j 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
|
||||
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
/etc/init.d/dnsmasq reload >/dev/null 2>&1
|
||||
}
|
||||
|
||||
set_firewall(){
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
echo "dhcp-option=252,http://$ROUTE_IP:5201/proxy.pac" > /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
echo "ipset=/music.163.com/music" >> /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
echo "ipset=/interface.music.163.com/music" >> /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
echo "ipset=/interface3.music.163.com/music" >> /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
echo "ipset=/apm.music.163.com/music" >> /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
echo "ipset=/apm3.music.163.com/music" >> /tmp/dnsmasq.d/dnsmasq-163.conf
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
add_rule
|
||||
@ -75,20 +78,27 @@ start()
|
||||
|
||||
[ $enable -eq "0" ] && exit 0
|
||||
|
||||
endponintset="";
|
||||
endponintset=" ";
|
||||
|
||||
if [ -n "$ENDPOINT" ]; then
|
||||
endponintset="-e ${ENDPOINT}"
|
||||
fi
|
||||
|
||||
if [ $TYPE = "default" ]; then
|
||||
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5201:5202 >/tmp/unblockmusic.log 2>&1 &
|
||||
node /usr/share/UnblockNeteaseMusic/app.js -p 5200 >>/tmp/unblockmusic.log 2>&1 &
|
||||
else
|
||||
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5201:5202 -o $TYPE >/tmp/unblockmusic.log 2>&1 &
|
||||
node /usr/share/UnblockNeteaseMusic/app.js -p 5200 -o $TYPE >>/tmp/unblockmusic.log 2>&1 &
|
||||
fi
|
||||
rm -f /tmp/unblockmusic.log
|
||||
echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log
|
||||
|
||||
if [ $TYPE = "default" ]; then
|
||||
musictype=" "
|
||||
else
|
||||
musictype="-o $TYPE"
|
||||
fi
|
||||
|
||||
node /usr/share/UnblockNeteaseMusic/app.js $endponintset -p 5201:5202 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
|
||||
if [ $PROXY -eq "1" ]; then
|
||||
node /usr/share/UnblockNeteaseMusic/app.js -p 5200 $musictype >>/tmp/unblockmusic.log 2>&1 &
|
||||
fi
|
||||
|
||||
set_firewall
|
||||
add_cron
|
||||
|
||||
@ -96,15 +106,11 @@ start()
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 $(busybox ps -w | grep monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
kill -9 $(busybox ps -w | grep app.js | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
{
|
||||
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 logcheck.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
rm -f /tmp/unblockmusic.log
|
||||
|
||||
|
||||
del_rule
|
||||
del_cron
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,17 +1,11 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
log_max_size="100" #使用KB计算
|
||||
log_max_size="10" #使用KB计算
|
||||
log_file="/tmp/unblockmusic.log"
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 30s
|
||||
icount=`busybox ps -w | grep app.js |grep -v grep| wc -l`
|
||||
if [ $icount -ne 2 ] ;then
|
||||
/etc/init.d/unblockmusic restart
|
||||
fi
|
||||
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
|
||||
(( "${log_size}" >= "${log_max_size}" )) && echo "" > /tmp/unblockmusic.log
|
||||
sleep 10m
|
||||
done
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
function check_if_already_running(){
|
||||
running_tasks="$(ps |grep "unblockneteasemusic" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
@ -37,7 +37,9 @@ function update_core(){
|
||||
|
||||
wget-ssl --no-check-certificate -t 1 -T 10 -O /tmp/unblockneteasemusic/core/core.tar.gz "https://github.com/nondanee/UnblockNeteaseMusic/archive/master.tar.gz" >/dev/null 2>&1
|
||||
tar -zxf "/tmp/unblockneteasemusic/core/core.tar.gz" -C "/tmp/unblockneteasemusic/core/" >/dev/null 2>&1
|
||||
rm -f /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/ca.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.key
|
||||
if [ -e "/usr/share/UnblockNeteaseMusic/ca.crt" ] && [ -e "/usr/share/UnblockNeteaseMusic/server.crt" ] && [ -e "/usr/share/UnblockNeteaseMusic/server.key" ] ; then
|
||||
rm -f /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/ca.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.key
|
||||
fi
|
||||
cp -a /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/* "/usr/share/UnblockNeteaseMusic/"
|
||||
rm -rf "/tmp/unblockneteasemusic" >/dev/null 2>&1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user