OSDN Git Service

luci-app-unblockneteasemusic: bump to 2.11-3
authorTianling Shen <cnsztl@immortalwrt.org>
Sun, 19 Sep 2021 06:18:04 +0000 (14:18 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Sun, 19 Sep 2021 06:18:04 +0000 (14:18 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
applications/luci-app-unblockneteasemusic/Makefile
applications/luci-app-unblockneteasemusic/luasrc/controller/unblockneteasemusic.lua
applications/luci-app-unblockneteasemusic/root/etc/init.d/unblockneteasemusic
applications/luci-app-unblockneteasemusic/root/usr/share/unblockneteasemusic/update.sh

index bccde14..af77448 100644 (file)
@@ -10,10 +10,10 @@ LUCI_PKGARCH:=all
 
 PKG_NAME:=luci-app-unblockneteasemusic
 PKG_VERSION:=2.11
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
 
-include $(TOPDIR)/feeds/luci/luci.mk
+include ../../luci.mk
 
 # call BuildPackage - OpenWrt buildroot signature
index aba3a6b..36a401b 100644 (file)
@@ -31,7 +31,7 @@ function act_status()
 end
 
 function update_core()
-       core_cloud_ver=luci.sys.exec("uclient-fetch -q -O- 'https://api.github.com/repos/1715173329/UnblockNeteaseMusic/commits/enhanced' | jsonfilter -e '@.sha'")
+       core_cloud_ver=luci.sys.exec("uclient-fetch -q -O- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits/enhanced' | jsonfilter -e '@.sha'")
        core_cloud_ver_mini=string.sub(core_cloud_ver, 1, 7)
        if not core_cloud_ver or not core_cloud_ver_mini then
                return "1"
index 363a582..84717af 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh /etc/rc.common
 # SPDX-License-Identifier: GPL-3.0-only
+#
 # Copyright (C) 2019-2021 Tianling Shen <cnsztl@immortalwrt.org>
 
 USE_PROCD=1
@@ -14,7 +15,7 @@ IPT_N="iptables -t nat"
 
 is_enabled() {
        local enabled
-       config_get enabled "$1" "$2" "0"
+       config_get_bool enabled "$1" "$2" "${3:-0}"
        if [ "$enabled" -eq "1" ]; then
                return 0
        else
@@ -129,8 +130,8 @@ start_service()
                EOF
                /etc/init.d/dnsmasq reload
 
-               ipset list "acl_neteasemusic_http" > "/dev/null" || ipset create "acl_neteasemusic_http" hash:ip
-               ipset list "acl_neteasemusic_https" > "/dev/null" || ipset create "acl_neteasemusic_https" hash:ip
+               ipset create "acl_neteasemusic_http" hash:ip
+               ipset create "acl_neteasemusic_https" hash:ip
                ip_addr_num="$(uci show "$NAME" | grep -c "filter_mode")"
                let ip_addr_num="ip_addr_num-1"
                [ "${ip_addr_num}" -ge "0" ] && for i in $(seq 0 "${ip_addr_num}")
@@ -151,7 +152,7 @@ start_service()
                        esac
                done
 
-               ipset list "neteasemusic" > "/dev/null" || ipset create "neteasemusic" hash:ip
+               ipset create "neteasemusic" hash:ip
                netease_music_ips="$(uclient-fetch -qO- "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" |jsonfilter -e '@.data.*.ip.*')"
                netease_music_ips2="$(uclient-fetch -qO- "https://music.httpdns.c.163.com/d" --post-data="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" |jsonfilter -e '@.dns.*["ips"].*')"
                echo -e "${netease_music_ips}\n${netease_music_ips2}" |sort -u |awk '{print "ipset add neteasemusic "$1}' |sh
index c673fd8..c9d3b25 100755 (executable)
@@ -14,7 +14,7 @@ function clean_log(){
 }
 
 function check_core_latest_version(){
-       core_latest_ver="$(uclient-fetch -q -O- 'https://api.github.com/repos/1715173329/UnblockNeteaseMusic/commits/enhanced' | jsonfilter -e '@.sha')"
+       core_latest_ver="$(uclient-fetch -q -O- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits/enhanced' | jsonfilter -e '@.sha')"
        [ -z "${core_latest_ver}" ] && { echo -e "\nFailed to check latest core version, please try again later." >> "/tmp/$NAME.log"; exit 1; }
        if [ ! -e "/usr/share/$NAME/core_local_ver" ]; then
                clean_log
@@ -39,10 +39,10 @@ function update_core(){
        mkdir -p "/usr/share/$NAME/core" > "/dev/null" 2>&1
        rm -rf /usr/share/$NAME/core/* > "/dev/null" 2>&1
 
-       uclient-fetch -q "https://codeload.github.com/1715173329/UnblockNeteaseMusic/tar.gz/${core_latest_ver}" -O "/usr/share/$NAME/core/core.tar.gz" > "/dev/null" 2>&1
+       uclient-fetch -q "https://codeload.github.com/UnblockNeteaseMusic/server/tar.gz/${core_latest_ver}" -O "/usr/share/$NAME/core/core.tar.gz" > "/dev/null" 2>&1
        tar -zxf "/usr/share/$NAME/core/core.tar.gz" -C "/usr/share/$NAME/core/" > "/dev/null" 2>&1
-       mv "/usr/share/$NAME/core/UnblockNeteaseMusic-${core_latest_ver}"/* "/usr/share/$NAME/core/"
-       rm -rf "/usr/share/$NAME/core/core.tar.gz" "/usr/share/$NAME/core/UnblockNeteaseMusic-${core_latest_ver}" > "/dev/null" 2>&1
+       mv "/usr/share/$NAME/core/server-${core_latest_ver}"/* "/usr/share/$NAME/core/"
+       rm -rf "/usr/share/$NAME/core/core.tar.gz" "/usr/share/$NAME/core/server-${core_latest_ver}" > "/dev/null" 2>&1
 
        if [ ! -e "/usr/share/$NAME/core/app.js" ]; then
                echo -e "Failed to download core." >> "/tmp/$NAME.log"