update 2026-01-21 20:57:05

This commit is contained in:
kenzok8
2026-01-21 20:57:05 +08:00
parent 5c4ed61451
commit 2c18a510fa
11 changed files with 231 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2025 sirpdboy <herboy2008@gmail.com>
# Copyright (C) 2021-2026 sirpdboy <herboy2008@gmail.com>
# 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)

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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
});

View File

@@ -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';

View File

@@ -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 ""

View File

@@ -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": {

View File

@@ -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

View File

@@ -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"
}

View File

@@ -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