diff --git a/luci-app-amlogic/Makefile b/luci-app-amlogic/Makefile index a53cfe3a..1b2f4897 100644 --- a/luci-app-amlogic/Makefile +++ b/luci-app-amlogic/Makefile @@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-amlogic -PKG_VERSION:=3.1.206 +PKG_VERSION:=3.1.207 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0 License diff --git a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh index e9ebd8bd..eac83163 100755 --- a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh +++ b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh @@ -105,7 +105,7 @@ fi # Convert kernel repo to api format [[ "${kernel_repo}" =~ ^https: ]] && kernel_repo="$(echo ${kernel_repo} | awk -F'/' '{print $4"/"$5}')" -kernel_api="https://api.github.com/repos/${kernel_repo}" +kernel_api="https://github.com/${kernel_repo}" if [[ -n "${KERNEL_TAGS}" ]]; then kernel_tag="${KERNEL_TAGS}" else @@ -142,12 +142,10 @@ check_kernel() { # Check the version on the server latest_version="$( - curl -s \ - -H "Accept: application/vnd.github+json" \ - ${kernel_api}/releases/tags/kernel_${kernel_tag} | - jq -r '.assets[].name' | - grep -oE "${main_line_version}\.[0-9]+" | - sort -rV | head -n 1 + curl -fsSL \ + ${kernel_api}/releases/expanded_assets/kernel_${kernel_tag} | + grep -oE "${main_line_version}.[0-9]+.tar.gz" | sed 's/.tar.gz//' | + sort -urV | head -n 1 )" [[ -n "${latest_version}" ]] || tolog "02.03 No kernel available, please use another kernel branch." "1" diff --git a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh index 1c5bae80..86d61df4 100755 --- a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh +++ b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh @@ -18,17 +18,12 @@ AMLOGIC_SOC_FILE="/etc/flippy-openwrt-release" START_LOG="${TMP_CHECK_DIR}/amlogic_check_plugin.log" RUNNING_LOG="${TMP_CHECK_DIR}/amlogic_running_script.log" LOG_FILE="${TMP_CHECK_DIR}/amlogic.log" -all_plugin_list="${TMP_CHECK_DIR}/josn_api_plugin" support_platform=("allwinner" "rockchip" "amlogic" "qemu-aarch64") LOGTIME="$(date "+%Y-%m-%d %H:%M:%S")" -# Set github API default value -github_page="1" -github_per_page="100" [[ -d ${TMP_CHECK_DIR} ]] || mkdir -p ${TMP_CHECK_DIR} rm -f ${TMP_CHECK_DIR}/*.ipk 2>/dev/null && sync rm -f ${TMP_CHECK_DIR}/sha256sums 2>/dev/null && sync -rm -f ${all_plugin_list} # Clean the running log clean_running() { @@ -97,6 +92,7 @@ sleep 2 # 01. Query local version information tolog "01. Query current version information." + current_plugin_v="$(opkg list-installed | grep 'luci-app-amlogic' | awk '{print $3}')" tolog "01.01 current version: ${current_plugin_v}" sleep 2 @@ -104,43 +100,18 @@ sleep 2 # 02. Check the version on the server tolog "02. Start querying plugin version..." -# Get the release list -while true; do - response="$( - curl -s -L \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/ophub/luci-app-amlogic/releases?per_page=${github_per_page}&page=${github_page}" - )" - - # Check if the response is empty or an error occurred - if [[ -z "${response}" ]] || [[ "${response}" == *"Not Found"* ]]; then - tolog "02.01 Query failed, please try again." "1" - else - echo "${response}" | - jq -r '.[].tag_name' | sort -rV \ - >>${all_plugin_list} - fi - - # Check if the current page has fewer results than the per_page limit - if [[ "$(echo "${response}" | jq '. | length')" -lt "${github_per_page}" ]]; then - break - else - github_page="$((github_page + 1))" - fi -done - # Get the latest version -if [[ -s "${all_plugin_list}" ]]; then - latest_version="$(cat ${all_plugin_list} | sort -rV | head -n 1)" - if [[ -z "${latest_version}" ]]; then - tolog "02.01 Query failed, please try again." "1" - else - tolog "02.01 current version: ${current_plugin_v}, Latest version: ${latest_version}" - sleep 2 - fi +latest_version="$( + curl -fsSL \ + https://github.com/ophub/luci-app-amlogic/releases | + grep -oE 'expanded_assets/[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?' | sed 's|expanded_assets/||' | + sort -urV | head -n 1 +)" +if [[ -z "${latest_version}" ]]; then + tolog "02.01 Query failed, please try again." "1" else - tolog "02.01 The search results for releases are empty." "1" + tolog "02.01 current version: ${current_plugin_v}, Latest version: ${latest_version}" + sleep 2 fi # Compare the version and download the latest version