From 2c18a510fa7c4d973d4f909ae92569f4ea06084b Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Wed, 21 Jan 2026 20:57:05 +0800 Subject: [PATCH] update 2026-01-21 20:57:05 --- luci-app-netspeedtest/Makefile | 6 +- .../resources/view/netspeedtest/homebox.js | 2 +- .../resources/view/netspeedtest/iperf3.js | 2 +- .../resources/view/netspeedtest/logs.js | 2 +- .../view/netspeedtest/onlinespeedtest.js | 193 ++++++++++++++++++ .../resources/view/netspeedtest/speedtest.js | 2 +- .../po/zh_Hans/netspeedtest.po | 13 +- .../luci/menu.d/luci-app-netspeedtest.json | 6 +- services/kai/Makefile | 6 +- services/kai/files/kai.init | 15 +- services/kai_session/Makefile | 6 +- 11 files changed, 231 insertions(+), 22 deletions(-) create mode 100644 luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/onlinespeedtest.js diff --git a/luci-app-netspeedtest/Makefile b/luci-app-netspeedtest/Makefile index be91f35ab..58a0f981e 100644 --- a/luci-app-netspeedtest/Makefile +++ b/luci-app-netspeedtest/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-only # -# Copyright (C) 2021-2025 sirpdboy +# Copyright (C) 2021-2026 sirpdboy # https://github.com/sirpdboy/luci-app-netspeedtest # This is free software, licensed under the Apache License, Version 2.0 . # @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-netspeedtest -PKG_VERSION:=5.1.0 -PKG_RELEASE:=20251108 +PKG_VERSION:=5.1.1 +PKG_RELEASE:=20260121 LUCI_TITLE:=LuCI Support for netspeedtest LUCI_DEPENDS:=+speedtest-cli +homebox +netspeedtest $(if $(find_package iperf3-ssl),+iperf3-ssl,+iperf3) diff --git a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/homebox.js b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/homebox.js index a368bc8a7..a38a4c034 100644 --- a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/homebox.js +++ b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/homebox.js @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ +/* Copyright (C) 2021-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ 'use strict'; 'require view'; 'require fs'; diff --git a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/iperf3.js b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/iperf3.js index 7d96957dd..b46386d97 100644 --- a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/iperf3.js +++ b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/iperf3.js @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ +/* Copyright (C) 2021-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ 'use strict'; 'require view'; 'require fs'; diff --git a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/logs.js b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/logs.js index 593d96aa6..55efcf308 100644 --- a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/logs.js +++ b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/logs.js @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ +/* Copyright (C) 2021-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ 'use strict'; 'require dom'; 'require fs'; diff --git a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/onlinespeedtest.js b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/onlinespeedtest.js new file mode 100644 index 000000000..ad6e47365 --- /dev/null +++ b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/onlinespeedtest.js @@ -0,0 +1,193 @@ +/* Copyright (C) 2021-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ +'use strict'; +'require view'; +'require uci'; +'require form'; + +return view.extend({ + + load() { + return Promise.all([ + uci.load('netspeedtest') + ]); + }, + + render(res) { + let m, s, o; + + m = new form.Map('netspeedtest', _('Online SpeedTest')); + + let currentSpeedTestUrl = uci.get('netspeedtest', 'config', 'speedtest_site') || 'https://plugin.speedtest.cn/taste#/?t=1767018285493'; + if (!currentSpeedTestUrl) { + currentSpeedTestUrl = 'https://plugin.speedtest.cn/taste#/?t=1767018285493'; + uci.set('netspeedtest', 'config', 'speedtest_site', currentSpeedTestUrl); + uci.save(); + } + + s = m.section(form.NamedSection, 'config', 'netspeedtest'); + s.anonymous = true; + + // 下拉选择 + o = s.option(form.DummyValue, '_speedtest_select'); + o.textvalue = function() { + return ''; + }; + o.render = function(section_id) { + const sites = [ + {url: 'https://plugin.speedtest.cn/taste#/?t=1767018285493', name: 'speedtest.cn'}, + {url: 'https://static.hdslb.com/', name: 'hdslb.com'}, + {url: 'https://test.ustc.edu.cn/', name: 'ustc.edu.cn'}, + {url: 'https://www1.szu.edu.cn/nc/speedtest/', name: 'szu.edu.cn'}, + {url: 'https://10000.gd.cn/#/speed', name: 'gd.cn'}, + {url: 'https://speed.cloudflare.com/', name: 'cloudflare.com'}, + {url: 'https://fast.com/', name: 'Netflix fast.com'}, + {url: '//openspeedtest.com/speedtest', name: 'openspeedtest.com'} + ]; + + const container = E('div', { + class: 'cbi-value' + }); + + const label = E('label', { + class: 'cbi-value-title', + for: 'speedtest-site-select' + }, _('Select speed measurement station')); + + const field = E('div', { + class: 'cbi-value-field', + }); + + const select = E('select', { + id: 'speedtest-site-select', + class: 'cbi-input-select' + }); + + sites.forEach(site => { + const option = E('option', { + value: site.url, + selected: currentSpeedTestUrl === site.url ? 'selected' : null + }, site.name); + select.appendChild(option); + }); + + function saveConfig(url) { + try { + uci.set('netspeedtest', 'config', 'speedtest_site', url); + uci.save(); + } catch (e) { + } + } + + select.addEventListener('change', function() { + const iframe = document.getElementById('speedtest-iframe'); + if (iframe && this.value) { + currentSpeedTestUrl = this.value; + iframe.src = this.value; + saveConfig(this.value); + } + }); + + field.appendChild(select); + container.appendChild(label); + container.appendChild(field); + + const saveStatus = E('small', { + id: 'save-status', + style: 'display: block; margin-top: 5px; color: #28a745; opacity: 0; transition: opacity 0.3s;' + }); + + field.appendChild(saveStatus); + + return container; + }; + + s = m.section(form.NamedSection, '_iframe'); + s.anonymous = true; + + s.render = function(section_id) { + const container = E('div', { + class: 'speedtest-wrapper mobiliframe', + style: 'width:100%;height:550px;position:relative;overflow:hidden;margin-top:20px;' + }); + const header = E('div', { + style: 'display:flex;justify-content:space-between;align-items:center;padding: 0.5rem 1rem;' + }, [ + E('span', { + style: 'font-weight:bold;' + }, _('NetSpeedtest')), + ]); + + const iframeContainer = E('div', { + style: 'height: calc(100% - 33px);' + }); + + const iframe = E('iframe', { + id: 'speedtest-iframe', + src: currentSpeedTestUrl, + style: 'width:100%;height:100%;border:none;background: #fff' + }); + + iframeContainer.appendChild(iframe); + + const style = E('style', {}, ` + .speedtest-wrapper { + transition: all 0.3s ease; + } + + .speedtest-wrapper:hover { + box-shadow: 0 4px 20px rgba(0,0,0,0.15); + } + + #save-status { + transition: opacity 0.3s ease; + } + + @media (prefers-color-scheme: dark) { + .speedtest-wrapper { + background: #2d2d2d; + } + + .speedtest-wrapper > div:first-child { + background: #3d3d3d; + border-color: #555; + } + + .speedtest-wrapper > div:first-child span { + color: #e0e0e0; + } + } + + @media (max-width: 768px) { + .speedtest-wrapper { + height: 500px; + } + + .cbi-value-title { + width: 100% !important; + margin-bottom: 5px; + } + + .cbi-value-field { + width: 100% !important; + } + + #speedtest-site-select { + max-width: 100%; + } + } + `); + + container.appendChild(header); + container.appendChild(iframeContainer); + container.appendChild(style); + + return container; + }; + + return m.render(); + }, + + handleSaveApply: null, + handleSave: null, + handleReset: null +}); \ No newline at end of file diff --git a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/speedtest.js b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/speedtest.js index 6a7fa0c4a..4f4d09af9 100644 --- a/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/speedtest.js +++ b/luci-app-netspeedtest/htdocs/luci-static/resources/view/netspeedtest/speedtest.js @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ +/* Copyright (C) 2021-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/luci-app-netspeedtest */ 'use strict'; 'require view'; 'require poll'; diff --git a/luci-app-netspeedtest/po/zh_Hans/netspeedtest.po b/luci-app-netspeedtest/po/zh_Hans/netspeedtest.po index 4824ecb7d..751c4ca7f 100644 --- a/luci-app-netspeedtest/po/zh_Hans/netspeedtest.po +++ b/luci-app-netspeedtest/po/zh_Hans/netspeedtest.po @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2025 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/netspeedtest +# Copyright (C) 2020-2026 sirpdboy herboy2008@gmail.com https://github.com/sirpdboy/netspeedtest # This is free software, licensed under the GNU General Public License v3. # msgid "" @@ -28,8 +28,8 @@ msgstr "本地homebox测速" msgid "Wan Ookla SpeedTest" msgstr "宽带Ookla测速" -msgid "Wan OpenSpeedTest SpeedTest" -msgstr "宽带OpenSpeedTest测速" +msgid "Online SpeedTest" +msgstr "在线宽带测速" msgid "Log" msgstr "日志" @@ -126,3 +126,10 @@ msgstr "Homebox控制台" msgid "Due to browser security policies, the Homebox interface https cannot be embedded directly." msgstr "由于浏览器安全策略,Homebox接口https不能直接嵌入。" + +msgid "Select speed measurement station" +msgstr "选择测速站点" + +msgid "" +msgstr "" + diff --git a/luci-app-netspeedtest/root/usr/share/luci/menu.d/luci-app-netspeedtest.json b/luci-app-netspeedtest/root/usr/share/luci/menu.d/luci-app-netspeedtest.json index 35d2c4147..f0ca17ea6 100644 --- a/luci-app-netspeedtest/root/usr/share/luci/menu.d/luci-app-netspeedtest.json +++ b/luci-app-netspeedtest/root/usr/share/luci/menu.d/luci-app-netspeedtest.json @@ -34,12 +34,12 @@ "path": "netspeedtest/speedtest" } }, - "admin/network/netspeedtest/openspeedtest": { - "title": "Wan OpenSpeedTest", + "admin/network/netspeedtest/onlinespeedtest": { + "title": "Online SpeedTest", "order": 5, "action": { "type": "view", - "path": "netspeedtest/openspeedtest" + "path": "netspeedtest/onlinespeedtest" } }, "admin/network/netspeedtest/logs": { diff --git a/services/kai/Makefile b/services/kai/Makefile index ca1e96e1d..7a1060c09 100644 --- a/services/kai/Makefile +++ b/services/kai/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_ARCH_kai:=$(ARCH) PKG_NAME:=kai -PKG_VERSION:=0.0.1 -PKG_RELEASE:=5 +PKG_VERSION:=0.0.2 +PKG_RELEASE:=0 PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/ -PKG_HASH:=60bc356bf9764f50cd0af9703d9675fe918173a79eae13e04aa9fa13fec7d75e +PKG_HASH:=6938d0cd9460cbb454f83000a83c79b46a1d2aab38e1a16aba6de71f5ce1a8ab PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 diff --git a/services/kai/files/kai.init b/services/kai/files/kai.init index 882a7a68b..c11b5e709 100755 --- a/services/kai/files/kai.init +++ b/services/kai/files/kai.init @@ -15,10 +15,14 @@ start_kai_bin(){ procd_set_param respawn procd_close_instance } +mkdir_cwd(){ + if [ ! -d $1 ]; then + mkdir -p $1 + fi +} start_kai_session(){ procd_open_instance kai_session - procd_set_param env OPENCODE_CWD=$cwd - procd_set_param env OPENCODE_CONFIG=http://127.0.0.1:8197/config/opencode/opencode.json + procd_set_param env OPENCODE_CWD=$1 OPENCODE_CONFIG=http://127.0.0.1:8197/config/opencode/opencode.json procd_set_param command /usr/sbin/kai_session procd_append_param command serve --port "8196" --hostname "127.0.0.1" procd_set_param stderr 1 @@ -34,6 +38,11 @@ start_service() { logger -t kai "Starting KAI Service" start_kai_bin sleep 1 - start_kai_session + mkdir_cwd $cwd + start_kai_session $cwd logger -t kai "Starting KAI Service Completed" } + +service_triggers() { + procd_add_reload_trigger "kai" +} \ No newline at end of file diff --git a/services/kai_session/Makefile b/services/kai_session/Makefile index 826b18604..9d4d5bd7d 100644 --- a/services/kai_session/Makefile +++ b/services/kai_session/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_ARCH_kai_session:=$(ARCH) PKG_NAME:=kai_session -PKG_VERSION:=0.0.1 -PKG_RELEASE:=4 +PKG_VERSION:=0.0.2 +PKG_RELEASE:=0 PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/ -PKG_HASH:=b52dd8b87ba81be75c61c04ee3a1fa9fdad74fba0fd925beab1eeda9fb02a698 +PKG_HASH:=c06437429150cc845bb36d5763dd5d27221817c99369e8db10d4b32e53d2d033 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1