From 3a3b6a86804ff8d8e12e0ce7bd83f1015e06b043 Mon Sep 17 00:00:00 2001 From: action Date: Wed, 13 May 2026 14:44:23 +0800 Subject: [PATCH] update 2026-05-13 14:44:23 --- luci-app-amlogic/Makefile | 2 +- .../resources/amlogic/javascript.svg | 1 + .../luci-static/resources/amlogic/lua.svg | 1 + .../resources/view/amlogic/check.js | 8 +---- .../resources/view/amlogic/info.js | 29 ++++++++++++++++--- .../root/usr/share/rpcd/ucode/luci.amlogic | 7 ++++- 6 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 luci-app-amlogic/htdocs/luci-static/resources/amlogic/javascript.svg create mode 100644 luci-app-amlogic/htdocs/luci-static/resources/amlogic/lua.svg diff --git a/luci-app-amlogic/Makefile b/luci-app-amlogic/Makefile index 4d441a82..86a9d5b3 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.309 +PKG_VERSION:=3.1.310 PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0 License diff --git a/luci-app-amlogic/htdocs/luci-static/resources/amlogic/javascript.svg b/luci-app-amlogic/htdocs/luci-static/resources/amlogic/javascript.svg new file mode 100644 index 00000000..8b447f3c --- /dev/null +++ b/luci-app-amlogic/htdocs/luci-static/resources/amlogic/javascript.svg @@ -0,0 +1 @@ +JavaScriptJavaScript \ No newline at end of file diff --git a/luci-app-amlogic/htdocs/luci-static/resources/amlogic/lua.svg b/luci-app-amlogic/htdocs/luci-static/resources/amlogic/lua.svg new file mode 100644 index 00000000..c631a493 --- /dev/null +++ b/luci-app-amlogic/htdocs/luci-static/resources/amlogic/lua.svg @@ -0,0 +1 @@ +LuaLua \ No newline at end of file diff --git a/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/check.js b/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/check.js index 1d7facea..8c70772e 100644 --- a/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/check.js +++ b/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/check.js @@ -283,7 +283,6 @@ return view.extend({ var verPlugin = E('span', _('Collecting data...')); var verKernel = E('span', _('Collecting data...')); var verRescue = E('span', _('Collecting data...')); - var branchSpan = E('span'); // Per-action status spans (right side, updated by poll) var statusFw = E('span'); @@ -419,8 +418,7 @@ return view.extend({ E('p', _('Provide OpenWrt Firmware, Kernel and Plugin online check, download and update service.')), E('div', { class: 'cbi-section' }, [ E('p', { style: 'text-align:center' }, [ - _('Update plugins first, then update the kernel or firmware. More options can be configured in [Plugin Settings].'), - ' ', branchSpan + _('Update plugins first, then update the kernel or firmware. More options can be configured in [Plugin Settings].') ]), E('table', { class: 'amlogic-row-table' }, [ E('tr', [ @@ -461,10 +459,6 @@ return view.extend({ dom.content(verKernel, s && s.current_kernel_version ? E('span', { class: 'amlogic-status-ok' }, _('Current Version') + ' [ ' + s.current_kernel_version + ' ] ') : E('span', { class: 'amlogic-status-err' }, _('Invalid value.'))); - var branchLabel = s && s.plugin_branch - ? (s.plugin_branch === 'lua' ? 'Lua' : 'JavaScript') - : (s && s.has_luci_js ? 'JavaScript' : 'Lua'); - dom.content(branchSpan, ' [ ' + branchLabel + ' ] '); // Rescue row: show same kernel version directly via the verRescue span dom.content(verRescue, s && s.current_kernel_version diff --git a/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/info.js b/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/info.js index ae6328fa..fa5beb12 100644 --- a/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/info.js +++ b/luci-app-amlogic/htdocs/luci-static/resources/view/amlogic/info.js @@ -23,6 +23,9 @@ const callAuthor = rpc.declare({ // Called on every info page load so the sidebar menu is correct from first visit. const callSyncMenu = rpc.declare({ object: 'luci.amlogic', method: 'sync_menu' }); +// Get runtime state to determine plugin_branch for the language badge. +const callState = rpc.declare({ object: 'luci.amlogic', method: 'state' }); + // Static list of supported boxes (display only, not used in any logic). const SUPPORTED_BOXES = [ _('Amlogic s922x --- [ Beelink, Beelink-Pro, Ugoos-AM6-Plus, ODROID-N2, Khadas-VIM3, Ali-CT2000 ]'), @@ -67,6 +70,23 @@ return view.extend({ amlogicShared.ensureCss(); const res = L.resource('amlogic'); + // Language badge image — default to javascript.svg (JS version), + // will be confirmed/corrected after the state RPC resolves. + var langsImg = E('img', { + id: 'Langs', + src: res + '/javascript.svg', alt: 'javascript', + width: '86', height: '20', + style: 'margin:0 5px; vertical-align:middle; border-radius:3px' + }); + + // Fetch plugin_branch from state and update the language badge. + callState().then(function (s) { + var isLua = s && s.plugin_branch === 'lua'; + langsImg.src = res + (isLua ? '/lua.svg' : '/javascript.svg'); + langsImg.alt = isLua ? 'lua' : 'javascript'; + langsImg.setAttribute('width', isLua ? '46' : '86'); + }).catch(function () {}); + // Flatten the supported-boxes list to [text,
, text,
, ...]. const boxRows = []; for (let i = 0; i < SUPPORTED_BOXES.length; i++) @@ -86,13 +106,13 @@ return view.extend({ E('img', { src: res + '/packit.svg', alt: 'Packit', width: '168', height: '20', - style: 'cursor:pointer; margin:0 5px', + style: 'cursor:pointer; margin:0 5px; vertical-align:middle; border-radius:3px', click: function () { openExternal('https://github.com/unifreq/openwrt_packit'); } }), E('img', { src: res + '/author.svg', alt: 'Author', width: '168', height: '20', - style: 'cursor:pointer; margin:0 5px', + style: 'cursor:pointer; margin:0 5px; vertical-align:middle; border-radius:3px', click: function () { callAuthor().then(function (repo) { let url = String(repo || '').trim(); @@ -106,9 +126,10 @@ return view.extend({ E('img', { src: res + '/plugin.svg', alt: 'luci-app-amlogic', width: '160', height: '20', - style: 'cursor:pointer; margin:0 5px', + style: 'cursor:pointer; margin:0 5px; vertical-align:middle; border-radius:3px', click: function () { openExternal('https://github.com/ophub/luci-app-amlogic'); } - }) + }), + langsImg ]) ]), E('tr', [ diff --git a/luci-app-amlogic/root/usr/share/rpcd/ucode/luci.amlogic b/luci-app-amlogic/root/usr/share/rpcd/ucode/luci.amlogic index a9bac26b..a9d5f300 100644 --- a/luci-app-amlogic/root/usr/share/rpcd/ucode/luci.amlogic +++ b/luci-app-amlogic/root/usr/share/rpcd/ucode/luci.amlogic @@ -475,7 +475,12 @@ function m_start_plugin() { + ' uci set amlogic.config.amlogic_plugin_branch=\'lua\' 2>/dev/null\n' + ' fi\n' + ' uci commit amlogic 2>/dev/null\n' - + ' fi) &\n' + + ' fi\n' + + ' # Restart services so the newly installed files take effect immediately,\n' + + ' # avoiding the need for users to manually clear browser cache.\n' + + ' /etc/init.d/rpcd restart >> "$LOG" 2>&1\n' + + ' /etc/init.d/uhttpd restart >> "$LOG" 2>&1\n' + + ' ) &\n' + 'else\n' + ' echo "--- INSTALLATION FAILED! ---" >> "$LOG"\n' + ' [ -f "$cfg_bak" ] && cp -f "$cfg_bak" "$cfg"\n'