update 2026-05-12 14:33:40

This commit is contained in:
action 2026-05-12 14:33:40 +08:00
parent 9914e8ed36
commit 7f3005ed5a
8 changed files with 98 additions and 38 deletions

View File

@ -16,7 +16,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-amlogic
PKG_VERSION:=3.1.303
PKG_VERSION:=3.1.306
PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0 License

View File

@ -130,11 +130,14 @@ return view.extend({
// 8. Plugin branch
const pbranch = o.option(form.ListValue, 'amlogic_plugin_branch',
_('Set plugin branch:'),
_('Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Default (empty) uses the main (JavaScript) branch.'));
pbranch.value('', _('main [JavaScript version]'));
state.has_luci_js
? _('Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Select main for JavaScript version or lua for Lua version.')
: _('Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. This system does not have JS LuCI, only the Lua branch is available.'));
if (state.has_luci_js)
pbranch.value('main', _('main [JavaScript version]'));
pbranch.value('lua', _('lua [Lua version]'));
pbranch.default = '';
pbranch.rmempty = true;
pbranch.default = state.has_luci_js ? 'main' : 'lua';
pbranch.rmempty = false;
// 9. Keep config
const fcfg = o.option(form.Flag, 'amlogic_firmware_config',

View File

@ -425,8 +425,8 @@ msgstr "Укажите ветку версии для файлов OpenWrt и я
msgid "Set plugin branch:"
msgstr "Ветка плагина:"
msgid "Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Default (empty) uses the main (JavaScript) branch."
msgstr "Укажите ветку плагина luci-app-amlogic для раздела [Только обновить сервис Amlogic]. По умолчанию (пусто) используется ветка main (JavaScript)."
msgid "Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Select main for JavaScript version or lua for Lua version."
msgstr "Укажите ветку плагина luci-app-amlogic для раздела [Только обновить сервис Amlogic]. Выберите main для JavaScript версии или lua для Lua версии."
msgid "main [JavaScript version]"
msgstr "main [JavaScript версия]"

View File

@ -425,8 +425,8 @@ msgstr "设置 [在线下载更新] 时 OpenWrt 文件与内核所选用的版
msgid "Set plugin branch:"
msgstr "设置插件分支:"
msgid "Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Default (empty) uses the main (JavaScript) branch."
msgstr "设置 [仅更新晶晨宝盒] 时使用的插件分支。默认(空)使用 main (JavaScript) 分支。"
msgid "Set the branch of the luci-app-amlogic plugin used in [Only update Amlogic Service]. Select main for JavaScript version or lua for Lua version."
msgstr "设置 [仅更新晶晨宝盒] 时使用的插件分支。选择 main 使用 JavaScript 版本,选择 lua 使用 Lua 版本。"
msgid "main [JavaScript version]"
msgstr "main [JavaScript 版本]"

View File

@ -64,19 +64,39 @@ fi
tolog "PLATFORM: [ ${PLATFORM} ]"
sleep 2
# Read plugin branch from UCI config; default to "" (main-js) when missing or empty
# When amlogic_plugin_branch is missing, add it with empty value (main-js default)
# Read plugin branch from UCI config; default to auto-detect when missing or empty.
# When amlogic_plugin_branch is missing, add it and auto-detect from system.
if [[ -f "${AMLOGIC_CONFIG_FILE}" ]]; then
plugin_branch="$(uci get amlogic.config.amlogic_plugin_branch 2>/dev/null | xargs)"
if ! grep -q "amlogic_plugin_branch" "${AMLOGIC_CONFIG_FILE}" 2>/dev/null; then
uci set amlogic.config.amlogic_plugin_branch='' 2>/dev/null
# Auto-detect: JS LuCI → js branch, Lua LuCI → lua branch
if [[ -f "/www/luci-static/resources/luci.js" ]]; then
plugin_branch="main"
else
plugin_branch="lua"
fi
uci set amlogic.config.amlogic_plugin_branch="${plugin_branch}" 2>/dev/null
uci commit amlogic 2>/dev/null
plugin_branch=""
fi
else
plugin_branch=""
# Config file missing, detect from system
if [[ -f "/www/luci-static/resources/luci.js" ]]; then
plugin_branch="main"
else
plugin_branch="lua"
fi
fi
tolog "Plugin branch: [ ${plugin_branch:-main-js} ]"
# If branch is still empty (old config set it to ''), auto-detect
if [[ -z "${plugin_branch}" ]]; then
if [[ -f "/www/luci-static/resources/luci.js" ]]; then
plugin_branch="main"
else
plugin_branch="lua"
fi
uci set amlogic.config.amlogic_plugin_branch="${plugin_branch}" 2>/dev/null
uci commit amlogic 2>/dev/null
fi
tolog "Plugin branch: [ ${plugin_branch} ]"
sleep 1
get_plugin_info() {
package_manager=""
@ -114,19 +134,21 @@ check_plugin() {
sleep 2
tolog "02. Start querying plugin version..."
if [[ "${plugin_branch}" == "lua" ]]; then
if [[ "${plugin_branch}" == "main" ]]; then
# JS branch: match tags ending with -js (e.g. 3.1.305-js)
latest_version="$(
curl -fsSL -m 10 \
https://github.com/ophub/luci-app-amlogic/releases |
grep -oE 'expanded_assets/[0-9]+\.[0-9]+\.[0-9]+-lua' | sed 's|expanded_assets/||g' |
grep -oE 'expanded_assets/[0-9]+\.[0-9]+\.[0-9]+-js' | sed 's|expanded_assets/||g' |
sort -urV | head -n 1
)"
else
# Lua branch: match tags with digits only, no suffix (e.g. 3.1.305)
latest_version="$(
curl -fsSL -m 10 \
https://github.com/ophub/luci-app-amlogic/releases |
grep -oE 'expanded_assets/[0-9]+\.[0-9]+\.[0-9]+' | sed 's|expanded_assets/||g' |
grep -v '\-lua' |
grep -v -- '-' |
sort -urV | head -n 1
)"
fi
@ -141,12 +163,12 @@ check_plugin() {
latest_version_base="${latest_version%%-*}"
# Determine target PKG_RELEASE for the selected branch:
# js branch (default) -> release 2
# lua branch -> release 1
if [[ "${plugin_branch}" == "lua" ]]; then
target_release="1"
else
# main branch -> release 2 (tag: 3.x.xxx-js)
# lua branch -> release 1 (tag: 3.x.xxx, no suffix)
if [[ "${plugin_branch}" == "main" ]]; then
target_release="2"
else
target_release="1"
fi
# Only report "already latest" when BOTH the version number AND the installed

View File

@ -224,7 +224,8 @@ function m_state() {
current_plugin_version: current_plugin_version(),
current_kernel_version: current_kernel_version(),
current_kernel_branch: current_kernel_branch(),
kernel_release: sh('uname -r')
kernel_release: sh('uname -r'),
has_luci_js: access('/www/luci-static/resources/luci.js') ? true : false
};
}
@ -382,6 +383,30 @@ function m_start_plugin() {
+ 'cfg=' + shq(cfg) + '\n'
+ 'cfg_bak=' + shq(cfg_bak) + '\n'
+ '[ -f "$cfg" ] && cp -f "$cfg" "$cfg_bak"\n'
+ '# Detect new release from downloaded file name (r1=lua, r2=js)\n'
+ 'new_release=""\n'
+ 'cur_release=""\n'
+ 'if command -v opkg >/dev/null 2>&1; then\n'
+ ' _ipk="$(ls /tmp/amlogic/luci-app-amlogic_*.ipk 2>/dev/null | head -n 1)"\n'
+ ' new_release="$(echo "${_ipk}" | grep -oE \'\\-r[0-9]+_\' | grep -oE \'[0-9]+\')"\n'
+ ' _raw="$(opkg list-installed 2>/dev/null | grep \'^luci-app-amlogic \' | awk \'{print $3}\' | cut -d\'-\' -f2)"\n'
+ ' cur_release="${_raw#r}"\n'
+ 'elif command -v apk >/dev/null 2>&1; then\n'
+ ' _apk="$(ls /tmp/amlogic/luci-app-amlogic_*.apk 2>/dev/null | head -n 1)"\n'
+ ' new_release="$(echo "${_apk}" | grep -oE \'\\-r[0-9]+[-~]\' | grep -oE \'[0-9]+\')"\n'
+ ' cur_release="$(apk list --installed 2>/dev/null | grep \'^luci-app-amlogic-\' | awk \'{print $1}\' | cut -d\'-\' -f5 | sed \'s/^r//\')"\n'
+ 'fi\n'
+ '# When switching branches (r1<->r2), remove old package first so that\n'
+ '# opkg/apk registers all new files. plain remove does NOT touch dep packages.\n'
+ 'if [ -n "$cur_release" ] && [ -n "$new_release" ] && [ "$cur_release" != "$new_release" ]; then\n'
+ ' echo "Branch switch detected (r${cur_release} -> r${new_release}), removing old package first..." >> "$LOG"\n'
+ ' if command -v opkg >/dev/null 2>&1; then\n'
+ ' opkg remove luci-app-amlogic --force-depends >> "$LOG" 2>&1 || true\n'
+ ' elif command -v apk >/dev/null 2>&1; then\n'
+ ' apk del luci-app-amlogic >> "$LOG" 2>&1 || true\n'
+ ' fi\n'
+ ' echo "Old package removed (dependencies kept)." >> "$LOG"\n'
+ 'fi\n'
+ 'if command -v opkg >/dev/null 2>&1; then\n'
+ ' echo "System uses opkg." >> "$LOG"\n'
+ ' opkg --force-reinstall --force-downgrade install /tmp/amlogic/*.ipk >> "$LOG" 2>&1\n'
@ -396,7 +421,7 @@ function m_start_plugin() {
+ 'fi\n'
+ 'if [ "$rc" = "0" ]; then\n'
+ ' [ -f "$cfg_bak" ] && cp -f "$cfg_bak" "$cfg"\n'
+ ' rm -f /etc/config/amlogic.apk-new /etc/config/amlogic.ipk-old\n'
+ ' rm -f /etc/config/amlogic.apk-new /etc/config/amlogic.ipk-old /etc/config/amlogic-opkg\n'
+ ' rm -rf /tmp/luci-indexcache /tmp/luci-modulecache/* "$cfg_bak"\n'
+ ' echo "" > "$LOG_RUNNING"\n'
+ ' echo "Successful Update" > "$LOG"\n'
@ -418,6 +443,16 @@ function m_start_plugin() {
+ ' rm -f /usr/share/rpcd/ucode/luci.amlogic\n'
+ ' rm -f /www/luci-static/resources/view/amlogic/*.js\n'
+ ' rm -f /usr/share/luci/menu.d/luci-app-amlogic.json\n'
+ ' fi\n'
+ ' # Auto-set plugin branch in UCI config if not already configured\n'
+ ' _cur_branch="$(uci -q get amlogic.config.amlogic_plugin_branch 2>/dev/null)"\n'
+ ' if [ -z "${_cur_branch}" ]; then\n'
+ ' if [ -f "/www/luci-static/resources/luci.js" ]; then\n'
+ ' uci set amlogic.config.amlogic_plugin_branch=\'main\' 2>/dev/null\n'
+ ' else\n'
+ ' uci set amlogic.config.amlogic_plugin_branch=\'lua\' 2>/dev/null\n'
+ ' fi\n'
+ ' uci commit amlogic 2>/dev/null\n'
+ ' fi) &\n'
+ 'else\n'
+ ' echo "--- INSTALLATION FAILED! ---" >> "$LOG"\n'

View File

@ -1775,12 +1775,12 @@ local function select_node(nodes, config, parentConfig)
end
end
end
-- 第一优先级 类型 + 备注 + IP + 端口
-- 第一优先级 类型 + 备注 + IP + 端口 + 分组
if not server then
for index, node in pairs(nodes) do
if config.currentNode.type and config.currentNode.remarks and config.currentNode.address and config.currentNode.port then
if node.type and node.remarks and node.address and node.port then
if node.type == config.currentNode.type and node.remarks == config.currentNode.remarks and (node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port) then
if node.type == config.currentNode.type and node.remarks == config.currentNode.remarks and (node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port) and node.group == config.currentNode.group then
if config.log == nil or config.log == true then
log('更新【' .. config.remarks .. '】第一匹配节点:' .. node.remarks)
end
@ -1791,12 +1791,12 @@ local function select_node(nodes, config, parentConfig)
end
end
end
-- 第二优先级 类型 + IP + 端口
-- 第二优先级 类型 + IP + 端口 + 分组
if not server then
for index, node in pairs(nodes) do
if config.currentNode.type and config.currentNode.address and config.currentNode.port then
if node.type and node.address and node.port then
if node.type == config.currentNode.type and (node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port) then
if node.type == config.currentNode.type and (node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port) and node.group == config.currentNode.group then
if config.log == nil or config.log == true then
log('更新【' .. config.remarks .. '】第二匹配节点:' .. node.remarks)
end
@ -1807,12 +1807,12 @@ local function select_node(nodes, config, parentConfig)
end
end
end
-- 第三优先级 IP + 端口
-- 第三优先级 IP + 端口 + 分组
if not server then
for index, node in pairs(nodes) do
if config.currentNode.address and config.currentNode.port then
if node.address and node.port then
if node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port then
if node.address .. ':' .. node.port == config.currentNode.address .. ':' .. config.currentNode.port and node.group == config.currentNode.group then
if config.log == nil or config.log == true then
log('更新【' .. config.remarks .. '】第三匹配节点:' .. node.remarks)
end
@ -1823,12 +1823,12 @@ local function select_node(nodes, config, parentConfig)
end
end
end
-- 第四优先级 IP
-- 第四优先级 IP + 分组
if not server then
for index, node in pairs(nodes) do
if config.currentNode.address then
if node.address then
if node.address == config.currentNode.address then
if node.address == config.currentNode.address and node.group == config.currentNode.group then
if config.log == nil or config.log == true then
log('更新【' .. config.remarks .. '】第四匹配节点:' .. node.remarks)
end
@ -1839,12 +1839,12 @@ local function select_node(nodes, config, parentConfig)
end
end
end
-- 第五优先级备注
-- 第五优先级备注 + 分组
if not server then
for index, node in pairs(nodes) do
if config.currentNode.remarks then
if node.remarks then
if node.remarks == config.currentNode.remarks then
if node.remarks == config.currentNode.remarks and node.group == config.currentNode.group then
if config.log == nil or config.log == true then
log('更新【' .. config.remarks .. '】第五匹配节点:' .. node.remarks)
end

View File

@ -12,7 +12,7 @@ PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
GEOIP_VER:=202605050255
GEOIP_VER:=202605120112
GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
define Download/geoip
URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
@ -21,13 +21,13 @@ define Download/geoip
HASH:=e9002979e0df72bce1c8751ff70725386594c551db684b7a232935b8b2bb8aa2
endef
GEOSITE_VER:=20260510103350
GEOSITE_VER:=20260512024130
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
define Download/geosite
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
HASH:=36fd0b9b577de2e60468c48b5da89dcf0fb1ba2a261cc34fc603cb2300d58d04
HASH:=10a12b243f21da295c7d2c6e4e36186566542663ff8a16e307caf4b7f252c656
endef
GEOSITE_IRAN_VER:=202605110145