mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 17:35:13 +08:00
🍕 Sync 2026-09-14 23:30:37
This commit is contained in:
1 parent
0603b094cf
commit
81fe4cd866
214 files changed
+10806
-2630
No files matched your search
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require form';
|
||||
@@ -15,10 +17,16 @@ return view.extend({
|
||||
expect: { result: [] }
|
||||
}),
|
||||
|
||||
getRuntimeStatus() {
|
||||
return L.resolveDefault(
|
||||
fs.exec_direct('/usr/libexec/luci-firewall-status', [], 'json'), {});
|
||||
},
|
||||
|
||||
load() {
|
||||
return Promise.all([
|
||||
this.callConntrackHelpers(),
|
||||
firewall.getDefaults()
|
||||
firewall.getDefaults(),
|
||||
this.getRuntimeStatus()
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -29,9 +37,24 @@ return view.extend({
|
||||
return this.renderZones(data);
|
||||
},
|
||||
|
||||
renderZones([ctHelpers, fwDefaults]) {
|
||||
renderZones([ctHelpers, fwDefaults, runtimeStatus]) {
|
||||
let m, s, o, out;
|
||||
const fw4 = L.hasSystemFeature('firewall4');
|
||||
const runtimeStatusText = E('span', {}, [ '-' ]);
|
||||
const updateRuntimeStatus = (status) => {
|
||||
const natModes = {
|
||||
fullcone: 'FULLCONENAT',
|
||||
nat1: _('Broadcom Fullcone NAT1'),
|
||||
disabled: _('Disabled')
|
||||
};
|
||||
const natMode = natModes[status?.nat_mode] || _('Unknown');
|
||||
const tcpcca = status?.tcp_cca
|
||||
? status.tcp_cca.toUpperCase()
|
||||
: _('Unknown');
|
||||
|
||||
runtimeStatusText.textContent =
|
||||
_('Running status: %s, TCP congestion control algorithm is %s').format(natMode, tcpcca);
|
||||
};
|
||||
const addTCPCCAOption = () => {
|
||||
const tcpcca = s.option(form.ListValue, 'tcpcca', _('TCP CCA'),
|
||||
_('TCP congestion control algorithm.'));
|
||||
@@ -42,6 +65,8 @@ return view.extend({
|
||||
tcpcca.rmempty = false;
|
||||
};
|
||||
|
||||
updateRuntimeStatus(runtimeStatus);
|
||||
|
||||
m = new form.Map('firewall', _('Firewall - Zone Settings'),
|
||||
_('The firewall creates zones over your network interfaces to control network traffic flow.'));
|
||||
|
||||
@@ -462,6 +487,24 @@ return view.extend({
|
||||
o.filter = out.filter;
|
||||
o.cfgvalue = out.cfgvalue;
|
||||
|
||||
return m.render();
|
||||
return m.render().then(L.bind(function(mapEl) {
|
||||
const firstSection = mapEl.querySelector('.cbi-section');
|
||||
const statusSection = E('div', {
|
||||
'class': 'cbi-section firewall-runtime-status',
|
||||
'style': 'overflow-x:auto'
|
||||
}, [
|
||||
E('div', {
|
||||
'style': 'padding:.75em 1.5em;color:#008000;font-size:1em;font-weight:600;white-space:nowrap'
|
||||
}, [ runtimeStatusText ])
|
||||
]);
|
||||
|
||||
firstSection.parentNode.insertBefore(statusSection, firstSection);
|
||||
|
||||
poll.add(L.bind(function() {
|
||||
return this.getRuntimeStatus().then(updateRuntimeStatus);
|
||||
}, this), 5);
|
||||
|
||||
return mapEl;
|
||||
}, this));
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user