mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-13 20:08:05 +08:00
190 lines
7.4 KiB
Diff
190 lines
7.4 KiB
Diff
--- a/luci-mod-status/ucode/template/admin_status/index.ut
|
|
+++ b/luci-mod-status/ucode/template/admin_status/index.ut
|
|
@@ -6,8 +6,6 @@
|
|
|
|
{% include('header') %}
|
|
|
|
-<h2 name="content">{{ _('Status') }}</h2>
|
|
-
|
|
<div id="view">
|
|
<div class="spinning">{{ _('Loading view…') }}</div>
|
|
</div>
|
|
|
|
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/index.js
|
|
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/index.js
|
|
@@ -2,6 +2,7 @@
|
|
'require view';
|
|
'require dom';
|
|
'require poll';
|
|
+'require fs';
|
|
'require network';
|
|
'require ui';
|
|
|
|
@@ -278,26 +279,14 @@ return view.extend({
|
|
},
|
|
|
|
load: function() {
|
|
- var includeModules = [
|
|
- { name: 'view.status.include.10_system' },
|
|
- { name: 'view.status.include.15_ports', title: _('Port status'), deferFirstLoad: true },
|
|
- { name: 'view.status.include.20_memory' },
|
|
- { name: 'view.status.include.25_storage' },
|
|
- { name: 'view.status.include.30_network' },
|
|
- { name: 'view.status.include.40_dhcp', title: _('Online Hosts'), deferFirstLoad: true },
|
|
- { name: 'view.status.include.50_dsl' },
|
|
- { name: 'view.status.include.60_wifi', title: _('Wireless'), deferFirstLoad: true }
|
|
- ];
|
|
-
|
|
- return Promise.all(includeModules.map(L.bind(function(spec) {
|
|
- if (spec.deferFirstLoad)
|
|
- return this.wrapDeferredInclude(spec);
|
|
-
|
|
- return L.resolveDefault(L.require(spec.name), null);
|
|
- }, this))).then(function(includes) {
|
|
- return includes.filter(function(include) {
|
|
- return include != null;
|
|
- });
|
|
+ return L.resolveDefault(fs.list('/www' + L.resource('view/status/include')), []).then(function(entries) {
|
|
+ return Promise.all(entries.filter(function(e) {
|
|
+ return (e.type == 'file' && e.name.match(/\.js$/));
|
|
+ }).map(function(e) {
|
|
+ return 'view.status.include.' + e.name.replace(/\.js$/, '');
|
|
+ }).sort().map(function(n) {
|
|
+ return L.require(n);
|
|
+ }));
|
|
});
|
|
},
|
|
|
|
|
|
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
|
|
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
|
|
@@ -36,14 +36,14 @@ return baseclass.extend({
|
|
available = Math.min(mem.total ?? Infinity, Math.max(0, available + (mem.buffered || 0)));
|
|
|
|
var fields = [
|
|
- _('Total Available'), available, mem.total,
|
|
+ _('Used'), (mem.total && mem.available) ? (mem.total - available): null, mem.total,
|
|
];
|
|
|
|
if (mem.cached)
|
|
fields.push(_('Cached'), mem.cached, mem.total);
|
|
|
|
if (swap.total > 0)
|
|
- fields.push(_('Swap free'), swap.free, swap.total);
|
|
+ fields.push(_('Swap used'), swap.total - swap.free, swap.total);
|
|
|
|
var table = E('table', { 'class': 'table' });
|
|
|
|
|
|
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js
|
|
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js
|
|
@@ -36,7 +36,7 @@ var callCPUInfo = rpc.declare({
|
|
|
|
var callCPUUsage = rpc.declare({
|
|
object: 'luci',
|
|
- method: 'getCPUUsage'
|
|
+ method: 'getTempInfo'
|
|
});
|
|
|
|
return baseclass.extend({
|
|
@@ -85,15 +85,9 @@ return baseclass.extend({
|
|
|
|
var fields = [
|
|
_('Hostname'), boardinfo.hostname,
|
|
- _('Model'), boardinfo.model + cpubench.cpubench,
|
|
- _('Architecture'), cpuinfo.cpuinfo || boardinfo.system,
|
|
+ _('Architecture'), (cpuinfo.cpuinfo || boardinfo.system) + ' ' + cpubench.cpubench,
|
|
_('Target Platform'), (L.isObject(boardinfo.release) ? boardinfo.release.target : ''),
|
|
- _('Firmware Version'), (L.isObject(boardinfo.release)
|
|
- ? '%s%s / '.format(
|
|
- boardinfo.release.description || '',
|
|
- boardinfo.release.revision ? boardinfo.release.revision : ''
|
|
- )
|
|
- : '') + (luciversion || ''),
|
|
+ _('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''),
|
|
_('Kernel Version'), boardinfo.kernel,
|
|
_('Local Time'), datestr,
|
|
_('Uptime'), systeminfo.uptime ? '%t'.format(systeminfo.uptime) : null,
|
|
@@ -101,10 +95,19 @@ return baseclass.extend({
|
|
systeminfo.load[0] / 65535.0,
|
|
systeminfo.load[1] / 65535.0,
|
|
systeminfo.load[2] / 65535.0
|
|
- ) : null,
|
|
- _('CPU usage (%)'), cpuusage.cpuusage
|
|
+ ) : null
|
|
];
|
|
|
|
+ if (cpuusage.tempinfo) {
|
|
+ fields.splice(6, 0, _('Temperature'));
|
|
+ fields.splice(7, 0, cpuusage.tempinfo);
|
|
+ }
|
|
+
|
|
+ if (boardinfo.model != "Default string Default string") {
|
|
+ fields.splice(2, 0, _('Model'));
|
|
+ fields.splice(3, 0, boardinfo.model);
|
|
+ }
|
|
+
|
|
var table = E('table', { 'class': 'table' });
|
|
|
|
for (var i = 0; i < fields.length; i += 2) {
|
|
@@ -114,6 +117,19 @@ return baseclass.extend({
|
|
]));
|
|
}
|
|
|
|
+ if (uci.get('system', '@system[0]', 'links') !== '0') {
|
|
+ table.appendChild(E('tr', { 'class': 'tr' }, [
|
|
+ E('td', { 'class': 'td', 'colspan': 2, 'style': 'padding: 10px 12px;' }, [
|
|
+ E('div', { 'style': 'display: flex; justify-content: space-around; align-items: center; text-align: center;' }, [
|
|
+ E('a', { 'href': 'https://openwrt.ai/', 'target': '_blank' }, [ '固件下载与定制' ]),
|
|
+ E('a', { 'href': 'https://openwrt.ai/fadian/', 'target': '_blank', 'style': 'color: orangered;' }, [ '赞助' ]),
|
|
+ E('a', { 'href': 'https://github.com/kiddin9/Kwrt', 'target': '_blank' }, [ '源码与反馈' ]),
|
|
+ E('a', { 'href': 'https://t.me/opkwrt', 'target': '_blank' }, [ 'TG交流' ])
|
|
+ ])
|
|
+ ])
|
|
+ ]));
|
|
+ }
|
|
+
|
|
return table;
|
|
}
|
|
});
|
|
|
|
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
|
|
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
|
|
@@ -675,7 +675,6 @@ return view.extend({
|
|
checkLegacyRules: function(ipt4save, ipt6save) {
|
|
if (ipt4save.match(/\n-A /) || ipt6save.match(/\n-A /)) {
|
|
ui.addNotification(_('Legacy rules detected'), [
|
|
- E('p', _('There are legacy iptables rules present on the system. Mixing iptables and nftables rules is discouraged and may lead to incomplete traffic filtering.')),
|
|
E('button', {
|
|
'class': 'btn cbi-button',
|
|
'click': function() { location.href = 'nftables/iptables' }
|
|
|
|
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/include/08_stats.js
|
|
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/include/08_stats.js
|
|
@@ -474,7 +474,7 @@ function maybeRefreshIp() {
|
|
|
|
// ─── Main baseclass ───────────────────────────────────────────────────────────
|
|
return baseclass.extend({
|
|
- title: _(''),
|
|
+ title: _('Status'),
|
|
|
|
load() {
|
|
// Use ?fast=1 to skip slow public-IP APIs — response is near-instant
|
|
|
|
--- a/luci-mod-status/root/usr/lib/lua/luci/controller/netstat.lua
|
|
+++ b/luci-mod-status/root/usr/lib/lua/luci/controller/netstat.lua
|
|
@@ -3,9 +3,6 @@ local nixio = require("nixio")
|
|
local uci = require("luci.model.uci").cursor()
|
|
|
|
function index()
|
|
- entry({"admin", "tools"}, firstchild(), _("Tools"), 50).dependent = false
|
|
- entry({"admin", "tools", "netstat"}, cbi("netstat/config"), _("Netstat"), 20).leaf = true
|
|
- entry({"admin", "tools", "netstat_config"}, alias("admin", "tools", "netstat")).dependent = true
|
|
entry({"admin", "tools", "get_netdev_stats"}, call("getNetdevStats"), nil).sysauth = false
|
|
end
|
|
|
|
diff --git a/luci-mod-status/htdocs/luci-static/resources/view/status/include/15_ports.js b/luci-mod-status/htdocs/luci-static/resources/view/status/include/26_ports.js
|
|
similarity index 100%
|
|
rename from luci-mod-status/htdocs/luci-static/resources/view/status/include/15_ports.js
|
|
rename to luci-mod-status/htdocs/luci-static/resources/view/status/include/26_ports.js
|