luci-app-unblockneteasemusic: sync upstream source
This commit is contained in:
parent
27b1610628
commit
56c4d0b335
@ -12,7 +12,7 @@ LUCI_DEPENDS:=+bash +busybox +coreutils-nohup +curl +dnsmasq-full +ipset +libope
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-unblockneteasemusic
|
||||
PKG_VERSION:=2.5
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
|
||||
@ -40,6 +40,12 @@ music_source.description = translate("音源调用接口")
|
||||
music_source.default = "default"
|
||||
music_source.rmempty = false
|
||||
|
||||
qq_cookie = s:option(Value, "qq_cookie", translate("QQ Cookie"))
|
||||
qq_cookie.description = translate("在 y.qq.com 获取,需要uin和qm_keyst值")
|
||||
qq_cookie.placeholder = "uin=; qm_keyst="
|
||||
qq_cookie.datatype = "string"
|
||||
qq_cookie:depends("music_source", "qq")
|
||||
|
||||
youtube_key = s:option(Value, "youtube_key", translate("Youtube API Key"))
|
||||
youtube_key.description = translate("API Key申请地址:https://developers.google.com/youtube/v3/getting-started#before-you-start")
|
||||
youtube_key.datatype = "string"
|
||||
|
||||
@ -11,6 +11,7 @@ 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)"
|
||||
qq_cookie="$(uci get unblockneteasemusic.@unblockneteasemusic[0].qq_cookie 2> "/dev/null")"
|
||||
youtube_key="$(uci get unblockneteasemusic.@unblockneteasemusic[0].youtube_key 2> "/dev/null")"
|
||||
hijack_ways="$(uci get unblockneteasemusic.@unblockneteasemusic[0].hijack_ways)"
|
||||
auto_update="$(uci get unblockneteasemusic.@unblockneteasemusic[0].auto_update)"
|
||||
@ -121,7 +122,12 @@ start()
|
||||
[ ! -e "/usr/share/unblockneteasemusic/core/app.js" ] && rm -f "/usr/share/unblockneteasemusic/local_ver" && bash "/usr/share/unblockneteasemusic/update_core.sh"
|
||||
[ ! -e "/usr/share/unblockneteasemusic/core/app.js" ] && echo "Core Not Found, please download it before starting." >> "/tmp/unblockneteasemusic.log" && exit 1
|
||||
|
||||
if [ "${music_source}" = "youtube" ];then
|
||||
if [ "${music_source}" = "qq" ];then
|
||||
[ -z "${qq_cookie}" ] && echo "QQ cookie is not exsit, please enter it before starting." && exit 1
|
||||
qq_cookie_line="$(awk "/'cookie':/{print NR}" "/usr/share/unblockneteasemusic/core/provider/qq.js")"
|
||||
sed -i "${qq_cookie_line}d" "/usr/share/unblockneteasemusic/core/provider/qq.js"
|
||||
sed -i -e "${qq_cookie_line}i \\\t'cookie': '${qq_cookie}'" "/usr/share/unblockneteasemusic/core/provider/qq.js"
|
||||
elif [ "${music_source}" = "youtube" ];then
|
||||
[ -z "${youtube_key}" ] && echo "Youtube API Key is not exsit, please enter it before starting." && exit 1
|
||||
sed -i '/const key = /d' "/usr/share/unblockneteasemusic/core/provider/youtube.js"
|
||||
sed -i -e "1i const key = '${youtube_key}'" "/usr/share/unblockneteasemusic/core/provider/youtube.js"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user