1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

fix luci-mod-dashboard

This commit is contained in:
suyuan 2023-10-26 16:46:49 +08:00
parent 7229f8ae07
commit a40125ea08
34 changed files with 0 additions and 23765 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,21 +0,0 @@
#
# Copyright 2019-2020 ZHANG Zhao <Zhao.Zhang2@etu.univ-grenoble-alpes.fr>
# Copyright 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
# Based on openwrt luci commit 03c77dafe3cfb922b995adfe9c0f8a75c98a18af
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Dashboard Pages
LUCI_DEPENDS:=+luci-base +libiwinfo
PKG_BUILD_DEPENDS:=iwinfo
PKG_LICENSE:=Apache-2.0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -1,300 +0,0 @@
/**
* Dashboard Principals Styles
**/
.Dashboard {
color: #212529!important;
}
.Dashboard h3 {
color:#000;
background: transparent;
}
.Dashboard hr {
border: 0;
height: 0;
overflow: visible;
margin: 0;
box-sizing: content-box;
border-top: 1px solid rgba(0,0,0,.1);
}
.Dashboard .box-s1 {
min-height: 550px;
}
.Dashboard .internet-status-self .internet-status-info .title {
height: 97px;
}
.Dashboard .dashboard-bg {
border-radius: 16px;
background-color: #e0e0e0;
}
.Dashboard div > table > tbody > tr:nth-of-type(2n), div > .table > .tr:nth-of-type(2n) {
background-color: transparent;
}
.Dashboard .tr {
background-color: transparent;
}
.Dashboard .title {
text-align: center;
}
.Dashboard .section-content {
display: flex;
vertical-align: top;
padding: 20px 0 0 0;
align-items: flex-start;
justify-content: space-between;
}
.Dashboard .section-content > div {
width:100%;
padding:1.5em;
}
.Dashboard .section-content .settings-info {
padding-top:1em;
}
.Dashboard .section-content .internet-status-info .settings-info {
display: flex;
justify-content: space-around;
}
.Dashboard .section-content .internet-status-info .settings-info > div > p > i{
padding: 0 0 0 5px;
}
.Dashboard .section-content > div:nth-child(2) {
margin-left:20px;
}
.Dashboard .devices-list .devices-info {
margin-bottom: 0;
}
.Dashboard .devices-list .devices-info .tr .td{
padding:0px 0 0 10px;
}
.Dashboard .devices-list .devices-info .tr .td:first-child {
width: 33%;
word-break: break-all;
}
.Dashboard .devices-list hr:nth-child(4) {
margin-top: 0;
margin-bottom: 8px;
}
.Dashboard .router-status-lan .devices-list .table-titles .th:first-child {
width: 35%;
}
.Dashboard .router-status-self .router-status-info .settings-info {
padding-left:27px;
}
.Dashboard .router-status-self .router-status-info .title h3 {
margin-top:-2px;
}
.Dashboard .router-status-info svg {
width: 70px;
}
.Dashboard .internet-status-self .settings-info p:first-child span:first-child{
font-size: 12px;
font-weight: 500;
}
//.Dashboard .internet-status-self .settings-info p:first-child span:first-child,
.Dashboard .router-status-wifi .wifi-info .settings-info p:first-child span:first-child,
.Dashboard .router-status-wifi .wifi-info .settings-info p:nth-child(2) span:first-child{
font-weight: 700;
}
.Dashboard .settings-info p span:first-child {
width: 35%;
font-size: 12px;
text-align: right;
}
.Dashboard .settings-info p span:nth-child(2){
display: inline-block;
word-break: break-all;
overflow: hidden;
max-height: 16px;
position: relative;
top:2px;
}
.Dashboard .router-status-info .settings-info p span:nth-child(2){
max-width: 283px;
}
.Dashboard .settings-info p span.ssid {
max-height: 18px;
top: 3px;
}
.Dashboard .settings-info p span.encryption {
max-width: 82px;
}
.Dashboard .router-status-wifi .wifi-info .settings-info,
.Dashboard .router-status-lan .lan-info .settings-info
{
display: flex;
justify-content: space-around;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .tr .td {
padding: 0 10px 0 10px;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .tr .td:first-child {
width: 30%;
word-break: break-all;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .tr .td:nth-child(2) {
width: 21%;
overflow: hidden;
padding-left:0;
word-break: break-all;
}
.Dashboard .router-status-wifi .wifi-info .settings-info{
padding:1em 0 1em 0;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .tr .td:nth-child(3) {
width: 22%;
overflow: hidden;
position: relative;
top: -3px;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .tr .td:nth-child(5) {
width: initial;
}
.Dashboard .router-status-wifi .wifi-info > hr:last-child {
margin-bottom:0;
}
.Dashboard .router-status-wifi .wifi-info .devices-info .device-info .progress {
padding: 0;
width: 100%;
margin: 0;
}
.Dashboard .wifi-info .devices-info .table-titles {
border-bottom:1px solid rgba(0,0,0,.1);
}
.Dashboard .label-success {
background-color: green;
}
.Dashboard .label-danger {
background-color: red;
}
/**
* Responsive
**/
@media screen and (min-width: 200px) and (max-width: 640px) {
.Dashboard .cbi-section-1 > .section-content {
padding-top:10px;
}
.Dashboard .section-content {
display:block;
}
.Dashboard .section-content > div{
padding: 1em;
}
.Dashboard .section-content > div:first-child {
margin-bottom:10px;
}
.Dashboard .section-content > div:nth-child(2) {
margin:0;
}
.Dashboard .router-status-self .router-status-info .settings-info {
padding:0;
}
.Dashboard .section-content .internet-status-info .settings-info {
display:block;
}
.Dashboard .section-content .internet-status-info .settings-info > div:first-child {
margin-bottom: 10px;
border-bottom: 1px solid rgba(0,0,0,.1);
}
.Dashboard .section-content .router-status-lan .devices-info .table-titles {
display:block;
}
.Dashboard .router-status-wifi .wifi-info .settings-info > div{
flex:1;
}
.Dashboard .section-content .router-status-lan .devices-info .table-titles .th:last-child{
padding-left: 70px;
}
.Dashboard .section-content .router-status-lan .devices-info .td:first-child{
flex: 2 2 31%;
}
.Dashboard .section-content .router-status-lan .devices-info .td:nth-child(2){
flex: 1 1 24%;
padding: 0;
}
.Dashboard .section-content .router-status-lan .devices-info .td:last-child{
word-wrap: normal;
}
.Dashboard .router-status-wifi .wifi-info .settings-info > div p:nth-child(6) > span:last-child{
display: inline-block;
overflow: hidden;
height: 14px;
width: 52%;
word-break: break-word;
line-height: 15px;
}
.Dashboard .wifi-info .devices-info .table-titles {
padding: 0;
margin: 0;
display: flex;
border-radius: initial;
}
.Dashboard .wifi-info .devices-info .table-titles .th {
flex: 2 2 24%;
}
.Dashboard .wifi-info .devices-info .tr .td {
flex: 2 2 10%;
}
.Dashboard .wifi-info hr:nth-child(4) {
margin-bottom: 0;
}
}

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32"><g stroke="#000" fill="none"><defs><symbol id="0"><path d="M6 11l0 -2 -4 0c-1,0 -1,-1 -1,-1l0 -6c0,-1 1,-1 1,-1l10 0c1,0 1,1 1,1l0 6c0,1 -1,1 -1,1l-4 0 0 2m-2 -2l2 0m-5 2l8 0"/></symbol></defs><use xlink:href="#0" x="9" y="2"/><use xlink:href="#0" x="0" y="18"/><use xlink:href="#0" x="18" y="18"/><path d="M16 14l0 3m-8 1l0 -1 16 0 0 1"/></g></svg>

Before

Width:  |  Height:  |  Size: 452 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g stroke="#5b5" fill="none"><circle cx="16" cy="16" r="15"/><ellipse cx="16" cy="16" rx="8" ry="15"/><path d="M4 25c6,-3 18,-3 24,0m-27 -9l30 0m-27 -9c6,3 18,3 24,0m-12 -6l0 30"/></g></svg>

Before

Width:  |  Height:  |  Size: 250 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g stroke="#000" fill="none"><circle cx="16" cy="16" r="15"/><ellipse cx="16" cy="16" rx="8" ry="15"/><path d="M4 25c6,-3 18,-3 24,0m-27 -9l30 0m-27 -9c6,3 18,3 24,0m-12 -6l0 30"/></g></svg>

Before

Width:  |  Height:  |  Size: 250 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path stroke="#000" fill="none" d="M6 22l-4 0c-1,0 -1,1 -1,1l0 4c0,1 1,1 1,1l28 0c1,0 1,-1 1,-1l0 -4c0,-1 -1,-1 -1,-1l-24 0 -2 -18c-0.2,-2 -2.2,-2 -2,0l2 18m22 0l2 -18c0.2,-2 2.2,-2 2,0l-2 18m-2 4l2 0m-5 0l2 0m-12 0l2 0m-5 0l2 0m-5 0l2 0m-5 0l2 0"/></svg>

Before

Width:  |  Height:  |  Size: 315 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path stroke="#000" fill="none" d="M4 15l-3 -3c8.4,-8.3 21.6,-8.3 30,0l-3 3c-6.6,-6.6 -17.4,-6.6 -24,0zm6 6l-3 -3c5,-5 13,-5 18,0l-3 3c-3.3,-3.3 -8.7,-3.3 -12,0zm6 6l-3 -3c1.6,-1.7 4.4,-1.7 6,0l-3 3z"/></svg>

Before

Width:  |  Height:  |  Size: 268 B

View file

@ -1,384 +0,0 @@
'use strict';
'require baseclass';
'require fs';
'require rpc';
'require network';
var callSystemBoard = rpc.declare({
object: 'system',
method: 'board'
});
var callSystemInfo = rpc.declare({
object: 'system',
method: 'info'
});
var callOpenMPTCProuterInfo = rpc.declare({
object: 'openmptcprouter',
method: 'status'
});
return baseclass.extend({
params: [],
formatBytes: function(a,b=2){if(0===a)return"0 Bytes";const c=0>b?0:b,d=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,d)).toFixed(c))+" "+["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"][d]},
load: function() {
return Promise.all([
network.getWANNetworks(),
network.getWAN6Networks(),
L.resolveDefault(callSystemBoard(), {}),
L.resolveDefault(callSystemInfo(), {}),
L.resolveDefault(callOpenMPTCProuterInfo(), {})
]);
},
renderHtml: function(data, type) {
var icon = type;
var title = 'router' == type ? _('System') : _('Internet');
var container_wapper = E('div', { 'class': type + '-status-self dashboard-bg box-s1'});
var container_box = E('div', { 'class': type + '-status-info'});
var container_item = E('div', { 'class': 'settings-info'});
if ('internet' == type) {
icon = (data.internet.v4.connected.value || data.internet.v6.connected.value) ? type : 'not-internet';
}
container_box.appendChild(E('div', { 'class': 'title'}, [
E('img', {
'src': L.resource('view/dashboard/icons/' + icon + '.svg'),
'width': 'router' == type ? 64 : 54,
'title': title,
'class': 'middle'
}),
E('h3', title)
]));
container_box.appendChild(E('hr'));
if ('internet' == type) {
var container_internet_v4 = E('div');
var container_internet_v6 = E('div');
var container_internet_vps = E('div');
for(var idx in data['vps']) {
var classname = ver,
suppelements = '',
visible = data['vps'][idx].visible;
if ('title' === idx) {
container_internet_vps.appendChild(
E('p', { 'class': 'mt-2'}, [
E('h4', {'class': ''}, [ data['vps'].title ]),
])
);
continue;
}
if (visible) {
container_internet_vps.appendChild(
E('p', { 'class': 'mt-2'}, [
E('span', {'class': ''}, [ data['vps'][idx].title + '' ]),
E('span', {'class': ''}, [ data['vps'][idx].value ]),
suppelements
])
);
}
}
for(var idx in data['internet']) {
for(var ver in data['internet'][idx]) {
var classname = ver,
suppelements = '',
visible = data['internet'][idx][ver].visible;
if('connected' === ver) {
classname = data['internet'][idx][ver].value ? 'label label-success' : 'label label-danger';
data['internet'][idx][ver].value = data['internet'][idx][ver].value ? _('yes') : _('no');
}
if ('v4' === idx) {
if ('title' === ver) {
container_internet_v4.appendChild(
E('p', { 'class': 'mt-2'}, [
E('h4', {'class': ''}, [ data['internet'][idx].title ]),
])
);
continue;
}
if ('addrsv4' === ver) {
var addrs = data['internet'][idx][ver].value;
if(Array.isArray(addrs) && addrs.length) {
for(var ip in addrs) {
data['internet'][idx][ver].value = addrs[ip].split('/')[0];
}
}
}
if (visible) {
container_internet_v4.appendChild(
E('p', { 'class': 'mt-2'}, [
E('span', {'class': ''}, [ data['internet'][idx][ver].title + '' ]),
E('span', {'class': classname }, [ data['internet'][idx][ver].value ]),
suppelements
])
);
}
} else {
if ('title' === ver) {
container_internet_v6.appendChild(
E('p', { 'class': 'mt-2'}, [
E('h4', {'class': ''}, [ data['internet'][idx].title ]),
])
);
continue;
}
if (visible) {
container_internet_v6.appendChild(
E('p', {'class': 'mt-2'}, [
E('span', {'class': ''}, [data['internet'][idx][ver].title + '']),
E('span', {'class': classname}, [data['internet'][idx][ver].value]),
suppelements
])
);
}
}
}
}
container_item.appendChild(E('p', { 'class': 'table'}, [
E('div', { 'class': 'tr' }, [
E('div', { 'class': 'td' }, [ container_internet_vps ])
]),
E('div', { 'class': 'tr' }, [
E('div', { 'class': 'td' }, [
container_internet_v4
]),
E('div', { 'class': 'td' }, [
container_internet_v6
])
])
]));
} else {
for(var idx in data) {
container_item.appendChild(
E('p', { 'class': 'mt-2'}, [
E('span', {'class': ''}, [ data[idx].title + '' ]),
E('span', {'class': ''}, [ data[idx].value ])
])
);
}
}
container_box.appendChild(container_item);
container_box.appendChild(E('hr'));
container_wapper.appendChild(container_box);
return container_wapper;
},
renderUpdateWanData: function(data, v6) {
for (var i = 0; i < data.length; i++) {
var ifc = data[i];
if (v6) {
this.params.internet.v6.ipprefixv6.value = ifc.getIP6Prefix() || '-';
this.params.internet.v6.gatewayv6.value = ifc.getGateway6Addr() || '-';
this.params.internet.v6.protocol.value= ifc.getI18n() || E('em', _('Not connected'));
this.params.internet.v6.addrsv6.value = ifc.getIP6Addrs() || [ '-' ];
this.params.internet.v6.dnsv6.value = ifc.getDNS6Addrs() || [ '-' ];
this.params.internet.v6.connected.value = ifc.isUp();
} else {
var uptime = ifc.getUptime();
this.params.internet.v4.uptime.value = (uptime > 0) ? '%t'.format(uptime) : '-';
this.params.internet.v4.protocol.value= ifc.getI18n() || E('em', _('Not connected'));
this.params.internet.v4.gatewayv4.value = ifc.getGatewayAddr() || '0.0.0.0';
this.params.internet.v4.connected.value = ifc.isUp();
this.params.internet.v4.addrsv4.value = ifc.getIPAddrs() || [ '-'];
this.params.internet.v4.dnsv4.value = ifc.getDNSAddrs() || [ '-' ];
}
}
},
renderUpdateOpenMPTCProuterData: function(data, v6) {
if (data.openmptcprouter != undefined) {
if (data.openmptcprouter.wan_addr != '') this.params.omrvps.internet.v4.connected.value = true;
if (data.openmptcprouter.wan_addr) this.params.omrvps.internet.v4.addrsv4.value = data.openmptcprouter.wan_addr || [ '-'];
if (data.openmptcprouter.wan_addr6) this.params.omrvps.internet.v6.addrsv6.value = data.openmptcprouter.wan_addr6 || [ '-'];
if (data.openmptcprouter.vps_kernel) this.params.omrvps.vps.version.value = data.openmptcprouter.vps_kernel + ' ' + data.openmptcprouter.vps_omr_version || [ '-'];
if (data.openmptcprouter.vps_loadavg) {
var vps_loadavg = data.openmptcprouter.vps_loadavg.split(" ");
this.params.omrvps.vps.load.value = '%s, %s, %s'.format(vps_loadavg[0],vps_loadavg[1],vps_loadavg[2]);
}
if (data.openmptcprouter.vps_uptime) this.params.omrvps.vps.uptime.value = String.format('%t', data.openmptcprouter.vps_uptime) || [ '-'];
if (data.openmptcprouter.proxy_traffic) this.params.omrvps.vps.trafficproxy.value = this.formatBytes(data.openmptcprouter.proxy_traffic) || [ '-'];
if (data.openmptcprouter.vpn_traffic) this.params.omrvps.vps.trafficvpn.value = this.formatBytes(data.openmptcprouter.vpn_traffic) || [ '-'];
if (data.openmptcprouter.total_traffic) this.params.omrvps.vps.traffictotal.value = this.formatBytes(data.openmptcprouter.total_traffic) || [ '-'];
if (data.openmptcprouter.ipv6 != 'disabled') this.params.omrvps.internet.v6.connected.value = true;
}
},
renderInternetBox: function(data) {
this.params.omrvps = {
vps: {
title: _('Server'),
version: {
title: _('Version'),
visible: true,
value: [ '-' ]
},
load: {
title: _('Load'),
visible: true,
value: [ '-' ]
},
uptime: {
title: _('Uptime'),
visible: true,
value: [ '-' ]
},
trafficproxy: {
title: _('Proxy traffic'),
visible: true,
value: [ '-' ]
},
trafficvpn: {
title: _('VPN traffic'),
visible: true,
value: [ '-' ]
},
traffictotal: {
title: _('Total traffic'),
visible: true,
value: [ '-' ]
}
},
internet: {
v4: {
title: _('IPv4 Internet'),
connected: {
title: _('Connected'),
visible: true,
value: false
},
addrsv4: {
title: _('IPv4'),
visible: true,
value: [ '-' ]
}
},
v6: {
title: _('IPv6 Internet'),
connected: {
title: _('Connected'),
visible: true,
value: false
},
ipprefixv6 : {
title: _('IPv6 prefix'),
visible: false,
value: ' - '
},
addrsv6: {
title: _('IPv6'),
visible: true,
value: [ '-' ]
}
}
}
};
//this.renderUpdateWanData(data[0], false);
//this.renderUpdateWanData(data[1], true);
this.renderUpdateOpenMPTCProuterData(data[4], true);
return this.renderHtml(this.params.omrvps, 'internet');
},
renderRouterBox: function(data) {
var boardinfo = data[2],
systeminfo = data[3];
var datestr = null;
if (systeminfo.localtime) {
var date = new Date(systeminfo.localtime * 1000);
datestr = '%04d-%02d-%02d %02d:%02d:%02d'.format(
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds()
);
}
this.params.router = {
uptime: {
title: _('Uptime'),
value: systeminfo.uptime ? '%t'.format(systeminfo.uptime) : null,
},
localtime: {
title: _('Local Time'),
value: datestr
},
load: {
title: _('Load Average'),
value: Array.isArray(systeminfo.load) ? '%.2f, %.2f, %.2f'.format(systeminfo.load[0] / 65535.0,systeminfo.load[1] / 65535.0,systeminfo.load[2] / 65535.0) : null
},
kernel: {
title: _('Kernel Version'),
value: boardinfo.kernel
},
model: {
title: _('Model'),
value: boardinfo.model
},
system: {
title: _('Architecture'),
value: boardinfo.system
},
release: {
title: _('Firmware Version'),
value: (typeof boardinfo.release !== "undefined") ? ((typeof boardinfo.release.description !== "undefined") ? boardinfo.release.description : null) : null
}
};
return this.renderHtml(this.params.router, 'router');
},
render: function(data) {
return [this.renderInternetBox(data), this.renderRouterBox(data)];
}
});

View file

@ -1,152 +0,0 @@
'use strict';
'require baseclass';
'require rpc';
'require network';
var callLuciDHCPLeases = rpc.declare({
object: 'luci-rpc',
method: 'getDHCPLeases',
expect: { '': {} }
});
return baseclass.extend({
title: _('DHCP Devices'),
params: {},
load: function() {
return Promise.all([
callLuciDHCPLeases(),
network.getDevices()
]);
},
renderHtml: function() {
var container_wapper = E('div', { 'class': 'router-status-lan dashboard-bg box-s1' });
var container_box = E('div', { 'class': 'lan-info devices-list' });
var container_devices = E('table', { 'class': 'table assoclist devices-info' }, [
E('tr', { 'class': 'tr table-titles dashboard-bg' }, [
E('th', { 'class': 'th nowrap' }, _('Hostname')),
E('th', { 'class': 'th' }, _('IP Address')),
E('th', { 'class': 'th' }, _('MAC')),
])
]);
var container_deviceslist = E('table', { 'class': 'table assoclist devices-info' });
container_box.appendChild(E('div', { 'class': 'title'}, [
E('img', {
'src': L.resource('view/dashboard/icons/devices.svg'),
'width': 55,
'title': this.title,
'class': 'middle'
}),
E('h3', this.title)
]));
for(var idx in this.params.lan.devices) {
var deivce = this.params.lan.devices[idx];
container_deviceslist.appendChild(E('tr', { 'class': 'tr cbi-rowstyle-1'}, [
E('td', { 'class': 'td device-info'}, [
E('p', {}, [
E('span', { 'class': 'd-inline-block'}, [ deivce.hostname ]),
]),
]),
E('td', { 'class': 'td device-info'}, [
E('p', {}, [
E('span', { 'class': 'd-inline-block'}, [ deivce.ipv4 ]),
]),
]),
E('td', { 'class': 'td device-info'}, [
E('p', {}, [
E('span', { 'class': 'd-inline-block'}, [ deivce.macaddr ]),
]),
])
]));
}
if (this.params.lan.devices.length > 0) {
container_box.appendChild(E('hr'));
container_box.appendChild(container_devices);
container_box.appendChild(E('hr'));
container_box.appendChild(container_deviceslist);
container_wapper.appendChild(container_box);
}
return container_wapper;
},
renderUpdateData: function(data, leases) {
for(var item in data) {
if (/lan|br-lan/ig.test(data[item].ifname) && (typeof data[item].dev == 'object' && !data[item].dev.wireless)) {
var lan_device = data[item];
var ipv4addr = lan_device.dev.ipaddrs.toString().split('/');
this.params.lan.ipv4 = ipv4addr[0] || '?';
this.params.lan.ipv6 = ipv4addr[0] || '?';
this.params.lan.macaddr = lan_device.dev.macaddr || '00:00:00:00:00:00';
this.params.lan.rx_bytes = lan_device.dev.stats.rx_bytes ? '%.2mB'.format(lan_device.dev.stats.rx_bytes) : '-';
this.params.lan.tx_bytes = lan_device.dev.stats.tx_bytes ? '%.2mB'.format(lan_device.dev.stats.tx_bytes) : '-';
}
}
var devices = [];
leases.map(function(lease) {
devices[lease.expires] = {
hostname: lease.hostname || '?',
ipv4: lease.ipaddr || '-',
macaddr: lease.macaddr || '00:00:00:00:00:00',
};
});
this.params.lan.devices = devices;
},
renderLeases: function(data) {
var leases = Array.isArray(data[0].dhcp_leases) ? data[0].dhcp_leases : [];
this.params.lan = {
ipv4: {
title: _('IPv4'),
value: '?'
},
macaddr: {
title: _('Mac'),
value: '00:00:00:00:00:00'
},
rx_bytes: {
title: _('Upload'),
value: '-'
},
tx_bytes: {
title: _('Download'),
value: '-'
},
devices: {
title: _('Devices'),
value: []
}
};
this.renderUpdateData(data[1], leases);
return this.renderHtml();
},
render: function(data) {
if (L.hasSystemFeature('dnsmasq') || L.hasSystemFeature('odhcpd'))
return this.renderLeases(data);
return E([]);
}
});

View file

@ -1,269 +0,0 @@
'use strict';
'require baseclass';
'require dom';
'require network';
'require rpc';
return baseclass.extend({
title: _('Wireless'),
params: [],
load: function() {
return Promise.all([
network.getWifiDevices(),
network.getWifiNetworks(),
network.getHostHints()
]).then(function(radios_networks_hints) {
var tasks = [];
for (var i = 0; i < radios_networks_hints[1].length; i++)
tasks.push(L.resolveDefault(radios_networks_hints[1][i].getAssocList(), []).then(L.bind(function(net, list) {
net.assoclist = list.sort(function(a, b) { return a.mac > b.mac });
}, this, radios_networks_hints[1][i])));
return Promise.all(tasks).then(function() {
return radios_networks_hints;
});
});
},
renderHtml: function() {
var container_wapper = E('div', { 'class': 'router-status-wifi dashboard-bg box-s1' });
var container_box = E('div', { 'class': 'wifi-info devices-list' });
var container_radio = E('div', { 'class': 'settings-info' });
var container_radio_item;
container_box.appendChild(E('div', { 'class': 'title'}, [
E('img', {
'src': L.resource('view/dashboard/icons/wireless.svg'),
'width': 55,
'title': this.title,
'class': 'middle'
}),
E('h3', this.title)
]));
container_box.appendChild(E('hr'));
for (var i =0; i < this.params.wifi.radios.length; i++) {
container_radio_item = E('div', { 'class': 'radio-info' })
for(var idx in this.params.wifi.radios[i]) {
var classname = idx,
radio = this.params.wifi.radios[i];
if (!radio[idx].visible) {
continue;
}
if ('actived' === idx) {
classname = radio[idx].value ? 'label label-success' : 'label label-danger';
radio[idx].value = radio[idx].value ? _('yes') : _('no');
}
container_radio_item.appendChild(
E('p', {}, [
E('span', { 'class': ''}, [ radio[idx].title + '']),
E('span', { 'class': classname }, [ radio[idx].value ]),
])
);
}
container_radio.appendChild(container_radio_item);
}
container_box.appendChild(container_radio);
var container_devices = E('div', { 'class': 'table assoclist devices-info' }, [
E('div', { 'class': 'tr table-titles dashboard-bg' }, [
E('div', { 'class': 'th nowrap' }, _('Hostname')),
E('div', { 'class': 'th' }, _('Wireless')),
E('div', { 'class': 'th' }, _('Signal')),
E('div', { 'class': 'th' }, '%s / %s'.format( _('Up.'), _('Down.')))
])
]);
var container_devices_item;
var container_devices_list = E('div', { 'class': 'table assoclist devices-info' });
for (var i =0; i < this.params.wifi.devices.length; i++) {
container_devices_item = E('div', { 'class': 'tr cbi-rowstyle-1' });
for(var idx in this.params.wifi.devices[i]) {
var device = this.params.wifi.devices[i];
if (!device[idx].visible) {
continue;
}
var container_content;
if ('progress' == idx) {
container_content = E('div', { 'class' : 'td device-info' }, [
E('div', { 'class': 'progress' }, [
E('div', { 'class': 'progress-bar ' + device[idx].value.style, role: 'progressbar', style: 'width:'+device[idx].value.qualite+'%', 'aria-valuenow': device[idx].value.qualite, 'aria-valuemin': 0, 'aria-valuemax': 100 }),
])
]);
} else if ('rate' == idx) {
container_content = E('div', { 'class': 'td device-info' }, [
E('p', {}, [
E('span', { 'class': ''}, [ device[idx].value.rx ]),
E('br'),
E('span', { 'class': ''}, [ device[idx].value.tx ])
])
]);
} else {
container_content = E('div', { 'class': 'td device-info'}, [
E('p', {}, [
E('span', { 'class': ''}, [ device[idx].value ]),
])
]);
}
container_devices_item.appendChild(container_content);
}
container_devices_list.appendChild(container_devices_item);
}
if (this.params.wifi.devices.length > 0) {
container_devices.appendChild(container_devices_list);
container_box.appendChild(E('hr'));
container_box.appendChild(container_devices);
container_box.appendChild(container_devices_list);
container_wapper.appendChild(container_box);
}
return container_wapper;
},
renderUpdateData: function(radios, networks, hosthints) {
for (var i = 0; i < radios.sort(function(a, b) { a.getName() > b.getName() }).length; i++) {
var network_items = networks.filter(function(net) { return net.getWifiDeviceName() == radios[i].getName() });
for (var j = 0; j < network_items.length; j++) {
var net = network_items[j],
is_assoc = (net.getBSSID() != '00:00:00:00:00:00' && net.getChannel() && !net.isDisabled()),
chan = net.getChannel(),
freq = net.getFrequency(),
rate = net.getBitRate();
this.params.wifi.radios.push(
{
ssid : {
title: _('SSID'),
visible: true,
value: net.getActiveSSID() || '?'
},
actived : {
title: _('Active'),
visible: true,
value: !net.isDisabled()
},
chan : {
title: _('Channel'),
visible: true,
value: chan ? '%d (%.3f %s)'.format(chan, freq, _('GHz')) : '-'
},
rate : {
title: _('Bitrate'),
visible: true,
value: rate ? '%d %s'.format(rate, _('Mbit/s')) : '-'
},
bssid : {
title: _('BSSID'),
visible: true,
value: is_assoc ? (net.getActiveBSSID() || '-') : '-'
},
encryption : {
title: _('Encryption'),
visible: true,
value: is_assoc ? net.getActiveEncryption() : '-'
},
associations : {
title: _('Devices Connected'),
visible: true,
value: is_assoc ? (net.assoclist.length || '0') : 0
}
}
);
}
}
for (var i = 0; i < networks.length; i++) {
for (var k = 0; k < networks[i].assoclist.length; k++) {
var bss = networks[i].assoclist[k],
name = hosthints.getHostnameByMACAddr(bss.mac);
var progress_style;
var q = Math.min((bss.signal + 110) / 70 * 100, 100);
if (q == 0 || q < 25)
progress_style = 'bg-danger';
else if (q < 50)
progress_style = 'bg-warning';
else if (q < 75)
progress_style = 'bg-success';
else
progress_style = 'bg-success';
this.params.wifi.devices.push(
{
hostname : {
title: _('Hostname'),
visible: true,
value: name || '?'
},
ssid : {
title: _('SSID'),
visible: true,
value: networks[i].getActiveSSID()
},
progress : {
title: _('Channel'),
visible: true,
value: {
qualite: q,
style: progress_style
}
},
rate : {
title: _('Bitrate'),
visible: true,
value: {
rx: '%s'.format('%.2mB'.format(bss.rx.bytes)),
tx: '%s'.format('%.2mB'.format(bss.tx.bytes)),
}
}
}
);
}
}
},
render: function(data) {
this.params.wifi = {
radios: [],
devices: []
};
this.renderUpdateData(data[0], data[1], data[2]);
return this.renderHtml();
}
});

View file

@ -1,110 +0,0 @@
'use strict';
'require view';
'require dom';
'require poll';
'require fs';
'require network';
document.querySelector('head').appendChild(E('link', {
'rel': 'stylesheet',
'type': 'text/css',
'href': L.resource('view/dashboard/css/custom.css')
}));
function invokeIncludesLoad(includes) {
var tasks = [], has_load = false;
for (var i = 0; i < includes.length; i++) {
if (typeof(includes[i].load) == 'function') {
tasks.push(includes[i].load().catch(L.bind(function() {
this.failed = true;
}, includes[i])));
has_load = true;
}
else {
tasks.push(null);
}
}
return has_load ? Promise.all(tasks) : Promise.resolve(null);
}
function startPolling(includes, containers) {
var step = function() {
return network.flushCache().then(function() {
return invokeIncludesLoad(includes);
}).then(function(results) {
for (var i = 0; i < includes.length; i++) {
var content = null;
if (includes[i].failed)
continue;
if (typeof(includes[i].render) == 'function')
content = includes[i].render(results ? results[i] : null);
else if (includes[i].content != null)
content = includes[i].content;
if (content != null) {
if (i > 1) {
dom.append(containers[1], content);
} else {
containers[i].parentNode.style.display = '';
containers[i].parentNode.classList.add('fade-in');
containers[i].parentNode.classList.add('Dashboard');
dom.content(containers[i], content);
}
}
}
var ssi = document.querySelector('div.includes');
if (ssi) {
ssi.style.display = '';
ssi.classList.add('fade-in');
}
});
};
return step().then(function() {
poll.add(step);
});
}
return view.extend({
load: function() {
return L.resolveDefault(fs.list('/www' + L.resource('view/dashboard/include')), []).then(function(entries) {
return Promise.all(entries.filter(function(e) {
return (e.type == 'file' && e.name.match(/\.js$/));
}).map(function(e) {
return 'view.dashboard.include.' + e.name.replace(/\.js$/, '');
}).sort().map(function(n) {
return L.require(n);
}));
});
},
render: function(includes) {
var rv = E([]), containers = [];
for (var i = 0; i < includes.length - 1; i++) {
var container = E('div', { 'class': 'section-content' });
rv.appendChild(E('div', { 'class': 'cbi-section-' + i, 'style': 'display:none' }, [
container
]));
containers.push(container);
}
return startPolling(includes, containers).then(function() {
return rv;
});
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

View file

@ -1,223 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2022-02-19 07:53+0000\n"
"Last-Translator: Weblate Admin <contact@openmptcprouter.com>\n"
"Language-Team: French <http://weblate.openmptcprouter.com/projects/omr/"
"lucimoddashboard/fr/>\n"
"Language: fr\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.6.1\n"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:165
msgid "Active"
msgstr "Actif"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:368
msgid "Architecture"
msgstr "Architecture"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:183
msgid "BSSID"
msgstr "BSSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:177
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:245
msgid "Bitrate"
msgstr "Débit"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:171
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:236
msgid "Channel"
msgstr "Canal"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:277
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:293
msgid "Connected"
msgstr "Connecté"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:13
msgid "DHCP Devices"
msgstr "Périphériques DHCP"
#: luci-mod-dashboard/root/usr/share/luci/menu.d/luci-mod-dashboard.json:3
msgid "Dashboard"
msgstr "Tableau de bord"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:136
msgid "Devices"
msgstr "Périphériques"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:195
msgid "Devices Connected"
msgstr "Périphériques connectés"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Down."
msgstr "En panne."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:131
msgid "Download"
msgstr "Téléchargement"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:189
msgid "Encryption"
msgstr "Chiffrement"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:373
msgid "Firmware Version"
msgstr "Version du micrologiciel"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:173
msgid "GHz"
msgstr "GHz"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:25
msgid "Grant access to DHCP status display"
msgstr "Permettre l'accès à l'affichage de l'état DHCP"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:12
msgid "Grant access to main status display"
msgstr "Permettre l'accès à l'affichage de l'état principal"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:3
msgid "Grant access to the system route status"
msgstr "Permettre laccès au status de routage"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:34
msgid "Grant access to wireless status display"
msgstr "Permettre l'accès du status WIFI"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:30
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:83
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:224
msgid "Hostname"
msgstr "Nom d'hôte"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:31
msgid "IP Address"
msgstr "Adresse IP"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:283
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:116
msgid "IPv4"
msgstr "IPv4"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:274
msgid "IPv4 Internet"
msgstr "Internet IPv4"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:305
msgid "IPv6"
msgstr "IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:290
msgid "IPv6 Internet"
msgstr "Internet IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:299
msgid "IPv6 prefix"
msgstr "Préfixe IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "Internet"
msgstr "Internet"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:358
msgid "Kernel Version"
msgstr "Version du noyau"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:241
msgid "Load"
msgstr "Charge"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:353
msgid "Load Average"
msgstr "Charge moyenne"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:348
msgid "Local Time"
msgstr "Heure locale"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:32
msgid "MAC"
msgstr "MAC"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:121
msgid "Mac"
msgstr "Mac"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:179
msgid "Mbit/s"
msgstr "Mbit/s"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:363
msgid "Model"
msgstr "Modèle"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:195
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:202
msgid "Not connected"
msgstr "Non connecté"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:253
msgid "Proxy traffic"
msgstr "Trafic proxy"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:159
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:230
msgid "SSID"
msgstr "SSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:232
msgid "Server"
msgstr "Serveur"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:85
msgid "Signal"
msgstr "Signal"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "System"
msgstr "Système"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:265
msgid "Total traffic"
msgstr "Trafic total"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Up."
msgstr "En ligne."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:126
msgid "Upload"
msgstr "Téléverser"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:247
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:343
msgid "Uptime"
msgstr "Temps de service"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:259
msgid "VPN traffic"
msgstr "Trafic VPN"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:235
msgid "Version"
msgstr "Version"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:9
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:84
msgid "Wireless"
msgstr "Sans-fil"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "no"
msgstr "non"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "yes"
msgstr "oui"

View file

@ -1,224 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2021-06-16 10:51+0000\n"
"Last-Translator: Dmitry Galenko <d@monteops.com>\n"
"Language-Team: Russian <http://weblate.openmptcprouter.com/projects/omr/"
"lucimoddashboard/ru/>\n"
"Language: ru\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.6.1\n"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:165
msgid "Active"
msgstr "Активный"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:368
msgid "Architecture"
msgstr "Процессор"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:183
msgid "BSSID"
msgstr "BSSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:177
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:245
msgid "Bitrate"
msgstr "Скорость"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:171
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:236
msgid "Channel"
msgstr "Канал"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:277
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:293
msgid "Connected"
msgstr "Подключено"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:13
msgid "DHCP Devices"
msgstr "Устройства DHCP"
#: luci-mod-dashboard/root/usr/share/luci/menu.d/luci-mod-dashboard.json:3
msgid "Dashboard"
msgstr "Дашборд"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:136
msgid "Devices"
msgstr "Устройства"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:195
msgid "Devices Connected"
msgstr "Подключенные устройства"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Down."
msgstr "Не работает."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:131
msgid "Download"
msgstr "Получение"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:189
msgid "Encryption"
msgstr "Шифрование"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:373
msgid "Firmware Version"
msgstr "Версия ПО"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:173
msgid "GHz"
msgstr "GHz"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:25
msgid "Grant access to DHCP status display"
msgstr "Разрешить просмотр информации о DHCP"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:12
msgid "Grant access to main status display"
msgstr "Разрешить просмотр информации основной информации"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:3
msgid "Grant access to the system route status"
msgstr "Разрешить просмотр информации о маршрутах"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:34
msgid "Grant access to wireless status display"
msgstr "Разрешить просмотр информации о беспроводных сетях"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:30
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:83
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:224
msgid "Hostname"
msgstr "Имя хоста"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:31
msgid "IP Address"
msgstr "IP-адрес"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:283
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:116
msgid "IPv4"
msgstr "IPv4"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:274
msgid "IPv4 Internet"
msgstr "IPv4 Internet"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:305
msgid "IPv6"
msgstr "IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:290
msgid "IPv6 Internet"
msgstr "IPv6 Internet"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:299
msgid "IPv6 prefix"
msgstr "Префикс IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "Internet"
msgstr "Internet"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:358
msgid "Kernel Version"
msgstr "Версия ядра"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:241
msgid "Load"
msgstr "Загрузка"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:353
msgid "Load Average"
msgstr "Средняя загрузка"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:348
msgid "Local Time"
msgstr "Время хоста"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:32
msgid "MAC"
msgstr "MAC"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:121
msgid "Mac"
msgstr "Mac"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:179
msgid "Mbit/s"
msgstr "Mbit/s"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:363
msgid "Model"
msgstr "Модель"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:195
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:202
msgid "Not connected"
msgstr "Не подключено"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:253
msgid "Proxy traffic"
msgstr "Трафик через прокси"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:159
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:230
msgid "SSID"
msgstr "SSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:232
msgid "Server"
msgstr "Сервер"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:85
msgid "Signal"
msgstr "Сигнал"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "System"
msgstr "Система"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:265
msgid "Total traffic"
msgstr "Трафик всего"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Up."
msgstr "Работает."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:126
msgid "Upload"
msgstr "Отправка"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:247
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:343
msgid "Uptime"
msgstr "Uptime"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:259
msgid "VPN traffic"
msgstr "Трафик VPN"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:235
msgid "Version"
msgstr "Версия"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:9
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:84
msgid "Wireless"
msgstr "Безпроводной"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "no"
msgstr "нет"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "yes"
msgstr "да"

View file

@ -1,214 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:165
msgid "Active"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:368
msgid "Architecture"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:183
msgid "BSSID"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:177
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:245
msgid "Bitrate"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:171
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:236
msgid "Channel"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:277
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:293
msgid "Connected"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:13
msgid "DHCP Devices"
msgstr ""
#: luci-mod-dashboard/root/usr/share/luci/menu.d/luci-mod-dashboard.json:3
msgid "Dashboard"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:136
msgid "Devices"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:195
msgid "Devices Connected"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Down."
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:131
msgid "Download"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:189
msgid "Encryption"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:373
msgid "Firmware Version"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:173
msgid "GHz"
msgstr ""
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:25
msgid "Grant access to DHCP status display"
msgstr ""
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:12
msgid "Grant access to main status display"
msgstr ""
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:3
msgid "Grant access to the system route status"
msgstr ""
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:34
msgid "Grant access to wireless status display"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:30
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:83
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:224
msgid "Hostname"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:31
msgid "IP Address"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:283
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:116
msgid "IPv4"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:274
msgid "IPv4 Internet"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:305
msgid "IPv6"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:290
msgid "IPv6 Internet"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:299
msgid "IPv6 prefix"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "Internet"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:358
msgid "Kernel Version"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:241
msgid "Load"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:353
msgid "Load Average"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:348
msgid "Local Time"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:32
msgid "MAC"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:121
msgid "Mac"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:179
msgid "Mbit/s"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:363
msgid "Model"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:195
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:202
msgid "Not connected"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:253
msgid "Proxy traffic"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:159
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:230
msgid "SSID"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:232
msgid "Server"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:85
msgid "Signal"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "System"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:265
msgid "Total traffic"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Up."
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:126
msgid "Upload"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:247
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:343
msgid "Uptime"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:259
msgid "VPN traffic"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:235
msgid "Version"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:9
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:84
msgid "Wireless"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "no"
msgstr ""
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "yes"
msgstr ""

View file

@ -1,223 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2021-06-02 09:51+0000\n"
"Last-Translator: antrouter <xinyangla@188.com>\n"
"Language-Team: Chinese (Simplified) <http://weblate.openmptcprouter.com/"
"projects/omr/lucimoddashboard/zh_Hans/>\n"
"Language: zh_Hans\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.6.1\n"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:165
msgid "Active"
msgstr "激活"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:368
msgid "Architecture"
msgstr "构架"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:183
msgid "BSSID"
msgstr "BSSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:177
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:245
msgid "Bitrate"
msgstr "比特率"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:171
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:236
msgid "Channel"
msgstr "频道"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:277
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:293
msgid "Connected"
msgstr "连接"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:13
msgid "DHCP Devices"
msgstr "DHCP 设备"
#: luci-mod-dashboard/root/usr/share/luci/menu.d/luci-mod-dashboard.json:3
msgid "Dashboard"
msgstr "仪表盘"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:136
msgid "Devices"
msgstr "设备"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:195
msgid "Devices Connected"
msgstr "连接的设备"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Down."
msgstr "下."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:131
msgid "Download"
msgstr "下载"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:189
msgid "Encryption"
msgstr "加密"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:373
msgid "Firmware Version"
msgstr "固件版本"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:173
msgid "GHz"
msgstr "Ghz"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:25
msgid "Grant access to DHCP status display"
msgstr "授予访问 DHCP 状态显示的权限"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:12
msgid "Grant access to main status display"
msgstr "授予访问主状态显示的权限"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:3
msgid "Grant access to the system route status"
msgstr "授予对系统路由状态的访问权限"
#: luci-mod-dashboard/root/usr/share/rpcd/acl.d/luci-mod-dashboard.json:34
msgid "Grant access to wireless status display"
msgstr "授予访问无线状态显示的权限"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:30
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:83
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:224
msgid "Hostname"
msgstr "主机名"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:31
msgid "IP Address"
msgstr "IP地址"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:283
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:116
msgid "IPv4"
msgstr "IPv4"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:274
msgid "IPv4 Internet"
msgstr "IPv4互联网"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:305
msgid "IPv6"
msgstr "IPv6"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:290
msgid "IPv6 Internet"
msgstr "IPv6互联网"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:299
msgid "IPv6 prefix"
msgstr "IPv6前缀"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "Internet"
msgstr "互联网"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:358
msgid "Kernel Version"
msgstr "内核版本"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:241
msgid "Load"
msgstr "负载"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:353
msgid "Load Average"
msgstr "平均负载"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:348
msgid "Local Time"
msgstr "本地时间"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:32
msgid "MAC"
msgstr "MAC地址"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:121
msgid "Mac"
msgstr "mac地址"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:179
msgid "Mbit/s"
msgstr "Mbit/s"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:363
msgid "Model"
msgstr "型号"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:195
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:202
msgid "Not connected"
msgstr "未连接"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:253
msgid "Proxy traffic"
msgstr "代理流量"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:159
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:230
msgid "SSID"
msgstr "SSID"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:232
msgid "Server"
msgstr "服务器"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:85
msgid "Signal"
msgstr "信号"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:41
msgid "System"
msgstr "系统"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:265
msgid "Total traffic"
msgstr "总流量"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:86
msgid "Up."
msgstr "上."
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js:126
msgid "Upload"
msgstr "上传"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:247
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:343
msgid "Uptime"
msgstr "开机时间"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:259
msgid "VPN traffic"
msgstr "VPN流量"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:235
msgid "Version"
msgstr "版本"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:9
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:84
msgid "Wireless"
msgstr "无线"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "no"
msgstr "否"
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js:101
#: luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/30_wifi.js:65
msgid "yes"
msgstr "是"

View file

@ -1,13 +0,0 @@
{
"admin/dashboard": {
"title": "Dashboard",
"order": 1,
"action": {
"type": "view",
"path": "dashboard/index"
},
"depends": {
"acl": [ "luci-mod-dashboard-index" ]
}
}
}

View file

@ -1,41 +0,0 @@
{
"luci-mod-dashboard-routes": {
"description": "Grant access to the system route status",
"read": {
"ubus": {
"file": [ "exec" ]
}
}
},
"luci-mod-dashboard-index": {
"description": "Grant access to main status display",
"read": {
"file": {
"/www/luci-static/resources/view/status/include": [ "list" ]
},
"ubus": {
"file": [ "list", "read" ],
"system": [ "board", "info" ]
}
}
},
"luci-mod-dashboard-index-dhcp": {
"description": "Grant access to DHCP status display",
"read": {
"ubus": {
"luci-rpc": [ "getDHCPLeases" ]
}
}
},
"luci-mod-dashboard-index-wifi": {
"description": "Grant access to wireless status display",
"read": {
"ubus": {
"iwinfo": [ "assoclist" ]
}
}
}
}

View file

@ -1,19 +0,0 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
# Copyright (C) 2020-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
# From https://github.com/openwrt/luci/commit/b88157e69a060ade618e48b30947729310935d61
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Network Administration
LUCI_DEPENDS:=+luci-base +libiwinfo-lua +rpcd-mod-iwinfo
PKG_LICENSE:=Apache-2.0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -1,949 +0,0 @@
'use strict';
'require ui';
'require dom';
'require uci';
'require form';
'require network';
'require baseclass';
'require validation';
'require tools.widgets as widgets';
function validateAddr(section_id, value) {
if (value == '')
return true;
var ipv6 = /6$/.test(this.section.formvalue(section_id, 'mode')),
addr = ipv6 ? validation.parseIPv6(value) : validation.parseIPv4(value);
return addr ? true : (ipv6 ? _('Expecting a valid IPv6 address') : _('Expecting a valid IPv4 address'));
}
function validateQoSMap(section_id, value) {
if (value == '')
return true;
var m = value.match(/^(\d+):(\d+)$/);
if (!m || +m[1] > 0xFFFFFFFF || +m[2] > 0xFFFFFFFF)
return _('Expecting two priority values separated by a colon');
return true;
}
function deviceSectionExists(section_id, devname) {
var exists = false;
uci.sections('network', 'device', function(ss) {
exists = exists || (
ss['.name'] != section_id &&
ss.name == devname
);
});
return exists;
}
function isBridgePort(dev) {
if (!dev)
return false;
if (dev.isBridgePort())
return true;
var isPort = false;
uci.sections('network', null, function(s) {
if (s['.type'] != 'interface' && s['.type'] != 'device')
return;
if (s.type == 'bridge' && L.toArray(s.ifname).indexOf(dev.getName()) > -1)
isPort = true;
});
return isPort;
}
function updateDevBadge(node, dev) {
var type = dev.getType(),
up = dev.getCarrier();
dom.content(node, [
E('img', {
'class': 'middle',
'src': L.resource('icons/%s%s.png').format(type, up ? '' : '_disabled')
}),
'\x0a', dev.getName()
]);
return node;
}
function renderDevBadge(dev) {
return updateDevBadge(E('span', {
'class': 'ifacebadge port-status-device',
'style': 'font-weight:normal',
'data-device': dev.getName()
}), dev);
}
function updatePortStatus(node, dev) {
var carrier = dev.getCarrier(),
duplex = dev.getDuplex(),
speed = dev.getSpeed(),
desc, title;
if (carrier && speed > 0 && duplex != null) {
desc = '%d%s'.format(speed, duplex == 'full' ? 'FD' : 'HD');
title = '%s, %d MBit/s, %s'.format(_('Connected'), speed, duplex == 'full' ? _('full-duplex') : _('half-duplex'));
}
else if (carrier) {
desc = _('Connected');
}
else {
desc = _('no link');
}
dom.content(node, [
E('img', {
'class': 'middle',
'src': L.resource('icons/port_%s.png').format(carrier ? 'up' : 'down')
}),
'\x0a', desc
]);
if (title)
node.setAttribute('data-tooltip', title);
else
node.removeAttribute('data-tooltip');
return node;
}
function renderPortStatus(dev) {
return updatePortStatus(E('span', {
'class': 'ifacebadge port-status-link',
'data-device': dev.getName()
}), dev);
}
function updatePlaceholders(opt, section_id) {
var dev = network.instantiateDevice(opt.getUIElement(section_id).getValue());
for (var i = 0, co; (co = opt.section.children[i]) != null; i++) {
if (co !== opt) {
switch (co.option) {
case 'mtu':
case 'mtu6':
co.getUIElement(section_id).setPlaceholder(dev.getMTU());
break;
case 'macaddr':
co.getUIElement(section_id).setPlaceholder(dev.getMAC());
break;
case 'txqueuelen':
co.getUIElement(section_id).setPlaceholder(dev._devstate('qlen'));
break;
}
}
}
}
var cbiTagValue = form.Value.extend({
renderWidget: function(section_id, option_index, cfgvalue) {
var widget = new ui.Dropdown(cfgvalue || ['-'], {
'-': E([], [
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ '—' ]),
E('span', { 'class': 'hide-close' }, [ _('Do not participate', 'VLAN port state') ])
]),
'u': E([], [
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ 'u' ]),
E('span', { 'class': 'hide-close' }, [ _('Egress untagged', 'VLAN port state') ])
]),
't': E([], [
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ 't' ]),
E('span', { 'class': 'hide-close' }, [ _('Egress tagged', 'VLAN port state') ])
]),
'*': E([], [
E('span', { 'class': 'hide-open', 'style': 'font-family:monospace' }, [ '*' ]),
E('span', { 'class': 'hide-close' }, [ _('Primary VLAN ID', 'VLAN port state') ])
])
}, {
id: this.cbid(section_id),
sort: [ '-', 'u', 't', '*' ],
optional: false,
multiple: true
});
var field = this;
widget.toggleItem = function(sb, li, force_state) {
var lis = li.parentNode.querySelectorAll('li'),
toggle = ui.Dropdown.prototype.toggleItem;
toggle.apply(this, [sb, li, force_state]);
if (force_state != null)
return;
switch (li.getAttribute('data-value'))
{
case '-':
if (li.hasAttribute('selected')) {
for (var i = 0; i < lis.length; i++) {
switch (lis[i].getAttribute('data-value')) {
case '-':
break;
case '*':
toggle.apply(this, [sb, lis[i], false]);
lis[i].setAttribute('unselectable', '');
break;
default:
toggle.apply(this, [sb, lis[i], false]);
}
}
}
break;
case 't':
case 'u':
if (li.hasAttribute('selected')) {
for (var i = 0; i < lis.length; i++) {
switch (lis[i].getAttribute('data-value')) {
case li.getAttribute('data-value'):
break;
case '*':
lis[i].removeAttribute('unselectable');
break;
default:
toggle.apply(this, [sb, lis[i], false]);
}
}
}
else {
toggle.apply(this, [sb, li, true]);
}
break;
case '*':
if (li.hasAttribute('selected')) {
var section_ids = field.section.cfgsections();
for (var i = 0; i < section_ids.length; i++) {
var other_widget = field.getUIElement(section_ids[i]),
other_value = L.toArray(other_widget.getValue());
if (other_widget === this)
continue;
var new_value = other_value.filter(function(v) { return v != '*' });
if (new_value.length == other_value.length)
continue;
other_widget.setValue(new_value);
break;
}
}
}
};
var node = widget.render();
node.style.minWidth = '4em';
if (cfgvalue == '-')
node.querySelector('li[data-value="*"]').setAttribute('unselectable', '');
return E('div', { 'style': 'display:inline-block' }, node);
},
cfgvalue: function(section_id) {
var ports = L.toArray(uci.get('network', section_id, 'ports'));
for (var i = 0; i < ports.length; i++) {
var s = ports[i].split(/:/);
if (s[0] != this.port)
continue;
var t = /t/.test(s[1] || '') ? 't' : 'u';
return /\*/.test(s[1] || '') ? [t, '*'] : [t];
}
return ['-'];
},
write: function(section_id, value) {
var ports = [];
for (var i = 0; i < this.section.children.length; i++) {
var opt = this.section.children[i];
if (opt.port) {
var val = L.toArray(opt.formvalue(section_id)).join('');
switch (val) {
case '-':
break;
case 'u':
ports.push(opt.port);
break;
default:
ports.push('%s:%s'.format(opt.port, val));
break;
}
}
}
uci.set('network', section_id, 'ports', ports);
},
remove: function() {}
});
return baseclass.extend({
replaceOption: function(s, tabName, optionClass, optionName, optionTitle, optionDescription) {
var o = s.getOption(optionName);
if (o) {
if (o.tab) {
s.tabs[o.tab].children = s.tabs[o.tab].children.filter(function(opt) {
return opt.option != optionName;
});
}
s.children = s.children.filter(function(opt) {
return opt.option != optionName;
});
}
return s.taboption(tabName, optionClass, optionName, optionTitle, optionDescription);
},
addDeviceOptions: function(s, dev, isNew) {
var parent_dev = dev ? dev.getParent() : null,
o, ss;
s.tab('devgeneral', _('General device options'));
s.tab('devadvanced', _('Advanced device options'));
s.tab('brport', _('Bridge port specific options'));
s.tab('bridgevlan', _('Bridge VLAN filtering'));
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'));
o.readonly = !isNew;
o.value('', _('Network device'));
o.value('bridge', _('Bridge device'));
o.value('8021q', _('VLAN (802.1q)'));
o.value('8021ad', _('VLAN (802.1ad)'));
o.value('macvlan', _('MAC VLAN'));
o.value('veth', _('Virtual Ethernet'));
o.validate = function(section_id, value) {
if (value == 'bridge' || value == 'veth')
updatePlaceholders(this.section.getOption('name_complex'), section_id);
return true;
};
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'name_simple', _('Existing device'));
o.readonly = !isNew;
o.rmempty = false;
o.noaliases = true;
o.default = (dev ? dev.getName() : '');
o.ucioption = 'name';
o.filter = function(section_id, value) {
var dev = network.instantiateDevice(value);
return !deviceSectionExists(section_id, value) && (dev.getType() != 'wifi' || dev.isUp());
};
o.validate = function(section_id, value) {
updatePlaceholders(this, section_id);
return deviceSectionExists(section_id, value)
? _('A configuration for the device "%s" already exists').format(value) : true;
};
o.onchange = function(ev, section_id, values) {
updatePlaceholders(this, section_id);
};
o.depends('type', '');
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'ifname_single', _('Base device'));
o.readonly = !isNew;
o.rmempty = false;
o.noaliases = true;
o.default = (dev ? dev.getName() : '').match(/^.+\.\d+$/) ? dev.getName().replace(/\.\d+$/, '') : '';
o.ucioption = 'ifname';
o.filter = function(section_id, value) {
var dev = network.instantiateDevice(value);
return (dev.getType() != 'wifi' || dev.isUp());
};
o.validate = function(section_id, value) {
updatePlaceholders(this, section_id);
if (isNew) {
var type = this.section.formvalue(section_id, 'type'),
name = this.section.getUIElement(section_id, 'name_complex');
if (type == 'macvlan' && value && name && !name.isChanged()) {
var i = 0;
while (deviceSectionExists(section_id, '%smac%d'.format(value, i)))
i++;
name.setValue('%smac%d'.format(value, i));
name.triggerValidation();
}
}
return true;
};
o.onchange = function(ev, section_id, values) {
updatePlaceholders(this, section_id);
};
o.depends('type', '8021q');
o.depends('type', '8021ad');
o.depends('type', 'macvlan');
o = this.replaceOption(s, 'devgeneral', form.Value, 'vid', _('VLAN ID'));
o.readonly = !isNew;
o.datatype = 'range(1, 4094)';
o.rmempty = false;
o.default = (dev ? dev.getName() : '').match(/^.+\.\d+$/) ? dev.getName().replace(/^.+\./, '') : '';
o.validate = function(section_id, value) {
var base = this.section.formvalue(section_id, 'ifname_single'),
vid = this.section.formvalue(section_id, 'vid'),
name = this.section.getUIElement(section_id, 'name_complex');
if (base && vid && name && !name.isChanged()) {
name.setValue('%s.%d'.format(base, vid));
name.triggerValidation();
}
return true;
};
o.depends('type', '8021q');
o.depends('type', '8021ad');
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'mode', _('Mode'));
o.value('vepa', _('VEPA (Virtual Ethernet Port Aggregator)', 'MACVLAN mode'));
o.value('private', _('Private (Prevent communication between MAC VLANs)', 'MACVLAN mode'));
o.value('bridge', _('Bridge (Support direct communication between MAC VLANs)', 'MACVLAN mode'));
o.value('passthru', _('Pass-through (Mirror physical device to single MAC VLAN)', 'MACVLAN mode'));
o.depends('type', 'macvlan');
o = this.replaceOption(s, 'devgeneral', form.Value, 'name_complex', _('Device name'));
o.rmempty = false;
o.datatype = 'maxlength(15)';
o.readonly = !isNew;
o.ucioption = 'name';
o.validate = function(section_id, value) {
var dev = network.instantiateDevice(value);
if (deviceSectionExists(section_id, value) || (isNew && (dev.dev || {}).idx))
return _('The device name "%s" is already taken').format(value);
return true;
};
o.depends({ type: '', '!reverse': true });
o = this.replaceOption(s, 'devadvanced', form.DynamicList, 'ingress_qos_mapping', _('Ingress QoS mapping'), _('Defines a mapping of VLAN header priority to the Linux internal packet priority on incoming frames'));
o.rmempty = true;
o.validate = validateQoSMap;
o.depends('type', '8021q');
o.depends('type', '8021ad');
o = this.replaceOption(s, 'devadvanced', form.DynamicList, 'egress_qos_mapping', _('Egress QoS mapping'), _('Defines a mapping of Linux internal packet priority to VLAN header priority but for outgoing frames'));
o.rmempty = true;
o.validate = validateQoSMap;
o.depends('type', '8021q');
o.depends('type', '8021ad');
o = this.replaceOption(s, 'devgeneral', widgets.DeviceSelect, 'ifname_multi', _('Bridge ports'));
o.size = 10;
o.rmempty = true;
o.multiple = true;
o.noaliases = true;
o.nobridges = true;
o.ucioption = 'ports';
o.default = L.toArray(dev ? dev.getPorts() : null).filter(function(p) { return p.getType() != 'wifi' }).map(function(p) { return p.getName() });
o.filter = function(section_id, device_name) {
var bridge_name = uci.get('network', section_id, 'name'),
choice_dev = network.instantiateDevice(device_name),
parent_dev = choice_dev.getParent();
/* only show wifi networks which are already present in "option ifname" */
if (choice_dev.getType() == 'wifi') {
var ifnames = L.toArray(uci.get('network', section_id, 'ports'));
for (var i = 0; i < ifnames.length; i++)
if (ifnames[i] == device_name)
return true;
return false;
}
return (!parent_dev || parent_dev.getName() != bridge_name);
};
o.description = _('Specifies the wired ports to attach to this bridge. In order to attach wireless networks, choose the associated interface as network in the wireless settings.')
o.onchange = function(ev, section_id, values) {
ss.updatePorts(values);
return ss.parse().then(function() {
ss.redraw();
});
};
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devgeneral', form.Flag, 'bridge_empty', _('Bring up empty bridge'), _('Bring up the bridge interface even if no ports are attached'));
o.default = o.disabled;
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Value, 'priority', _('Priority'));
o.placeholder = '32767';
o.datatype = 'range(0, 65535)';
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Value, 'ageing_time', _('Ageing time'), _('Timeout in seconds for learned MAC addresses in the forwarding database'));
o.placeholder = '30';
o.datatype = 'uinteger';
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Flag, 'stp', _('Enable <abbr title="Spanning Tree Protocol">STP</abbr>'), _('Enables the Spanning Tree Protocol on this bridge'));
o.default = o.disabled;
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Value, 'hello_time', _('Hello interval'), _('Interval in seconds for STP hello packets'));
o.placeholder = '2';
o.datatype = 'range(1, 10)';
o.depends({ type: 'bridge', stp: '1' });
o = this.replaceOption(s, 'devadvanced', form.Value, 'forward_delay', _('Forward delay'), _('Time in seconds to spend in listening and learning states'));
o.placeholder = '15';
o.datatype = 'range(2, 30)';
o.depends({ type: 'bridge', stp: '1' });
o = this.replaceOption(s, 'devadvanced', form.Value, 'max_age', _('Maximum age'), _('Timeout in seconds until topology updates on link loss'));
o.placeholder = '20';
o.datatype = 'range(6, 40)';
o.depends({ type: 'bridge', stp: '1' });
o = this.replaceOption(s, 'devadvanced', form.Flag, 'igmp_snooping', _('Enable <abbr title="Internet Group Management Protocol">IGMP</abbr> snooping'), _('Enables IGMP snooping on this bridge'));
o.default = o.disabled;
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Value, 'hash_max', _('Maximum snooping table size'));
o.placeholder = '512';
o.datatype = 'uinteger';
o.depends({ type: 'bridge', igmp_snooping: '1' });
o = this.replaceOption(s, 'devadvanced', form.Flag, 'multicast_querier', _('Enable multicast querier'));
o.defaults = { '1': [{'igmp_snooping': '1'}], '0': [{'igmp_snooping': '0'}] };
o.depends('type', 'bridge');
o = this.replaceOption(s, 'devadvanced', form.Value, 'robustness', _('Robustness'), _('The robustness value allows tuning for the expected packet loss on the network. If a network is expected to be lossy, the robustness value may be increased. IGMP is robust to (Robustness-1) packet losses'));
o.placeholder = '2';
o.datatype = 'min(1)';
o.depends({ type: 'bridge', multicast_querier: '1' });
o = this.replaceOption(s, 'devadvanced', form.Value, 'query_interval', _('Query interval'), _('Interval in centiseconds between multicast general queries. By varying the value, an administrator may tune the number of IGMP messages on the subnet; larger values cause IGMP Queries to be sent less often'));
o.placeholder = '12500';
o.datatype = 'uinteger';
o.depends({ type: 'bridge', multicast_querier: '1' });
o = this.replaceOption(s, 'devadvanced', form.Value, 'query_response_interval', _('Query response interval'), _('The max response time in centiseconds inserted into the periodic general queries. By varying the value, an administrator may tune the burstiness of IGMP messages on the subnet; larger values make the traffic less bursty, as host responses are spread out over a larger interval'));
o.placeholder = '1000';
o.datatype = 'uinteger';
o.validate = function(section_id, value) {
var qiopt = L.toArray(this.map.lookupOption('query_interval', section_id))[0],
qival = qiopt ? (qiopt.formvalue(section_id) || qiopt.placeholder) : '';
if (value != '' && qival != '' && +value >= +qival)
return _('The query response interval must be lower than the query interval value');
return true;
};
o.depends({ type: 'bridge', multicast_querier: '1' });
o = this.replaceOption(s, 'devadvanced', form.Value, 'last_member_interval', _('Last member interval'), _('The max response time in centiseconds inserted into group-specific queries sent in response to leave group messages. It is also the amount of time between group-specific query messages. This value may be tuned to modify the "leave latency" of the network. A reduced value results in reduced time to detect the loss of the last member of a group'));
o.placeholder = '100';
o.datatype = 'uinteger';
o.depends({ type: 'bridge', multicast_querier: '1' });
o = this.replaceOption(s, 'devgeneral', form.Value, 'mtu', _('MTU'));
o.datatype = 'range(576, 9200)';
o.validate = function(section_id, value) {
var parent_mtu = (dev && dev.getType() == 'vlan') ? (parent_dev ? parent_dev.getMTU() : null) : null;
if (parent_mtu !== null && +value > parent_mtu)
return _('The MTU must not exceed the parent device MTU of %d bytes').format(parent_mtu);
return true;
};
o = this.replaceOption(s, 'devgeneral', form.Value, 'macaddr', _('MAC address'));
o.datatype = 'macaddr';
o = this.replaceOption(s, 'devgeneral', form.Value, 'peer_name', _('Peer device name'));
o.rmempty = true;
o.datatype = 'maxlength(15)';
o.depends('type', 'veth');
o.load = function(section_id) {
var sections = uci.sections('network', 'device'),
idx = 0;
for (var i = 0; i < sections.length; i++)
if (sections[i]['.name'] == section_id)
break;
else if (sections[i].type == 'veth')
idx++;
this.placeholder = 'veth%d'.format(idx);
return form.Value.prototype.load.apply(this, arguments);
};
o = this.replaceOption(s, 'devgeneral', form.Value, 'peer_macaddr', _('Peer MAC address'));
o.rmempty = true;
o.datatype = 'macaddr';
o.depends('type', 'veth');
o = this.replaceOption(s, 'devgeneral', form.Value, 'txqueuelen', _('TX queue length'));
o.placeholder = dev ? dev._devstate('qlen') : '';
o.datatype = 'uinteger';
o = this.replaceOption(s, 'devadvanced', form.Flag, 'promisc', _('Enable promiscuous mode'));
o.default = o.disabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'autoneg', _('Autonegociation'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'gro', _('Generic Receive Offload (GRO)'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'gso', _('Generic Segmentation Offload (GSO)'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'tso', _('TCP Segmentation Offload (TSO)'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'lro', _('Large Receive Offload (LRO)'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'ufo', _('UDP Fragmentation Offload (UFO)'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Value, 'speed', _('Speed'));
o.placeholder = dev ? dev.getSpeed() : '';
o.default = '';
o.rmempty = true;
o.datatype = 'uinteger';
o.depends('autoneg', '0');
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'duplex', _('Duplex'));
o.default = '';
o.value('', _('unknown'));
o.value('half', _('half'));
o.value('full', _('full'));
o.depends('autoneg', '0');
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'rpfilter', _('Reverse path filter'));
o.default = '';
o.value('', _('disabled'));
o.value('loose', _('Loose filtering'));
o.value('strict', _('Strict filtering'));
o.cfgvalue = function(section_id) {
var val = form.ListValue.prototype.cfgvalue.apply(this, [section_id]);
switch (val || '') {
case 'loose':
case '1':
return 'loose';
case 'strict':
case '2':
return 'strict';
default:
return '';
}
};
o = this.replaceOption(s, 'devadvanced', form.Flag, 'acceptlocal', _('Accept local'), _('Accept packets with local source addresses'));
o.default = o.disabled;
o = this.replaceOption(s, 'devadvanced', form.Flag, 'sendredirects', _('Send ICMP redirects'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighreachabletime', _('Neighbour cache validity'), _('Time in milliseconds'));
o.placeholder = '30000';
o.datatype = 'uinteger';
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighgcstaletime', _('Stale neighbour cache timeout'), _('Timeout in seconds'));
o.placeholder = '60';
o.datatype = 'uinteger';
o = this.replaceOption(s, 'devadvanced', form.Value, 'neighlocktime', _('Minimum ARP validity time'), _('Minimum required time in seconds before an ARP entry may be replaced. Prevents ARP cache thrashing.'));
o.placeholder = '0';
o.datatype = 'uinteger';
o = this.replaceOption(s, 'devadvanced', form.Value, 'ttl', _('Force TTL'), _('Some LTE providers detect tethering by inspecting packet TTL values'));
o.placeholder = '65';
o.datatype = 'uinteger';
o = this.replaceOption(s, 'devgeneral', form.Flag, 'ipv6', _('Enable IPv6'));
o.migrate = false;
o.default = o.enabled;
o = this.replaceOption(s, 'devgeneral', form.Value, 'mtu6', _('IPv6 MTU'));
o.datatype = 'max(9200)';
o.depends('ipv6', '1');
o = this.replaceOption(s, 'devgeneral', form.Value, 'dadtransmits', _('DAD transmits'), _('Amount of Duplicate Address Detection probes to send'));
o.placeholder = '1';
o.datatype = 'uinteger';
o.depends('ipv6', '1');
o = this.replaceOption(s, 'devadvanced', form.Flag, 'multicast', _('Enable multicast support'));
o.default = o.enabled;
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'igmpversion', _('Force IGMP version'));
o.value('', _('No enforcement'));
o.value('1', _('Enforce IGMPv1'));
o.value('2', _('Enforce IGMPv2'));
o.value('3', _('Enforce IGMPv3'));
o.depends('multicast', '1');
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'mldversion', _('Force MLD version'));
o.value('', _('No enforcement'));
o.value('1', _('Enforce MLD version 1'));
o.value('2', _('Enforce MLD version 2'));
o.depends('multicast', '1');
if (isBridgePort(dev)) {
o = this.replaceOption(s, 'brport', form.Flag, 'learning', _('Enable MAC address learning'));
o.default = o.enabled;
o = this.replaceOption(s, 'brport', form.Flag, 'unicast_flood', _('Enable unicast flooding'));
o.default = o.enabled;
o = this.replaceOption(s, 'brport', form.Flag, 'isolated', _('Port isolation'), _('Only allow communication with non-isolated bridge ports when enabled'));
o.default = o.disabled;
o = this.replaceOption(s, 'brport', form.ListValue, 'multicast_router', _('Multicast routing'));
o.value('', _('Never'));
o.value('1', _('Learn'));
o.value('2', _('Always'));
o.depends('multicast', '1');
o = this.replaceOption(s, 'brport', form.Flag, 'multicast_to_unicast', _('Multicast to unicast'), _('Forward multicast packets as unicast packets on this device.'));
o.default = o.disabled;
o.depends('multicast', '1');
o = this.replaceOption(s, 'brport', form.Flag, 'multicast_fast_leave', _('Enable multicast fast leave'));
o.default = o.disabled;
o.depends('multicast', '1');
}
o = this.replaceOption(s, 'bridgevlan', form.Flag, 'vlan_filtering', _('Enable VLAN filtering'));
o.depends('type', 'bridge');
o.updateDefaultValue = function(section_id) {
var device = uci.get('network', s.section, 'name'),
uielem = this.getUIElement(section_id),
has_vlans = false;
uci.sections('network', 'bridge-vlan', function(bvs) {
has_vlans = has_vlans || (bvs.device == device);
});
this.default = has_vlans ? this.enabled : this.disabled;
if (uielem && !uielem.isChanged())
uielem.setValue(this.default);
};
o = this.replaceOption(s, 'bridgevlan', form.SectionValue, 'bridge-vlan', form.TableSection, 'bridge-vlan');
o.depends('type', 'bridge');
ss = o.subsection;
ss.addremove = true;
ss.anonymous = true;
ss.renderHeaderRows = function(/* ... */) {
var node = form.TableSection.prototype.renderHeaderRows.apply(this, arguments);
node.querySelectorAll('.th').forEach(function(th) {
th.classList.add('left');
th.classList.add('middle');
});
return node;
};
ss.filter = function(section_id) {
var devname = uci.get('network', s.section, 'name');
return (uci.get('network', section_id, 'device') == devname);
};
ss.render = function(/* ... */) {
return form.TableSection.prototype.render.apply(this, arguments).then(L.bind(function(node) {
node.style.overflow = 'auto hidden';
node.style.paddingTop = '1em';
if (this.node)
this.node.parentNode.replaceChild(node, this.node);
this.node = node;
return node;
}, this));
};
ss.redraw = function() {
return this.load().then(L.bind(this.render, this));
};
ss.updatePorts = function(ports) {
var devices = ports.map(function(port) {
return network.instantiateDevice(port)
}).filter(function(dev) {
return dev.getType() != 'wifi' || dev.isUp();
});
this.children = this.children.filter(function(opt) { return !opt.option.match(/^port_/) });
for (var i = 0; i < devices.length; i++) {
o = ss.option(cbiTagValue, 'port_%s'.format(sfh(devices[i].getName())), renderDevBadge(devices[i]), renderPortStatus(devices[i]));
o.port = devices[i].getName();
}
var section_ids = this.cfgsections(),
device_names = devices.reduce(function(names, dev) { names[dev.getName()] = true; return names }, {});
for (var i = 0; i < section_ids.length; i++) {
var old_spec = L.toArray(uci.get('network', section_ids[i], 'ports')),
new_spec = old_spec.filter(function(spec) { return device_names[spec.replace(/:[ut*]+$/, '')] });
if (old_spec.length != new_spec.length)
uci.set('network', section_ids[i], 'ports', new_spec.length ? new_spec : null);
}
};
ss.handleAdd = function(ev) {
return s.parse().then(L.bind(function() {
var device = uci.get('network', s.section, 'name'),
section_ids = this.cfgsections(),
section_id = null,
max_vlan_id = 0;
if (!device)
return;
for (var i = 0; i < section_ids.length; i++) {
var vid = +uci.get('network', section_ids[i], 'vlan');
if (vid > max_vlan_id)
max_vlan_id = vid;
}
section_id = uci.add('network', 'bridge-vlan');
uci.set('network', section_id, 'device', device);
uci.set('network', section_id, 'vlan', max_vlan_id + 1);
s.children.forEach(function(opt) {
switch (opt.option) {
case 'type':
case 'name_complex':
var input = opt.map.findElement('id', 'widget.%s'.format(opt.cbid(s.section)));
if (input)
input.disabled = true;
break;
}
});
s.getOption('vlan_filtering').updateDefaultValue(s.section);
s.map.addedVLANs = s.map.addedVLANs || [];
s.map.addedVLANs.push(section_id);
return this.redraw();
}, this));
};
o = ss.option(form.Value, 'vlan', _('VLAN ID'));
o.datatype = 'range(1, 4094)';
o.renderWidget = function(/* ... */) {
var node = form.Value.prototype.renderWidget.apply(this, arguments);
node.style.width = '5em';
return node;
};
o.validate = function(section_id, value) {
var section_ids = this.section.cfgsections();
for (var i = 0; i < section_ids.length; i++) {
if (section_ids[i] == section_id)
continue;
if (uci.get('network', section_ids[i], 'vlan') == value)
return _('The VLAN ID must be unique');
}
return true;
};
o = ss.option(form.Flag, 'local', _('Local'));
o.default = o.enabled;
var ports = [];
var seen_ports = {};
L.toArray(uci.get('network', s.section, 'ports')).forEach(function(port) {
seen_ports[port] = true;
});
uci.sections('network', 'bridge-vlan', function(bvs) {
if (uci.get('network', s.section, 'name') != bvs.device)
return;
L.toArray(bvs.ports).forEach(function(portspec) {
var m = portspec.match(/^([^:]+)(?::[ut*]+)?$/);
if (m)
seen_ports[m[1]] = true;
});
});
for (var port_name in seen_ports)
ports.push(port_name);
ports.sort(function(a, b) {
var m1 = a.match(/^(.+?)([0-9]*)$/),
m2 = b.match(/^(.+?)([0-9]*)$/);
if (m1[1] < m2[1])
return -1;
else if (m1[1] > m2[1])
return 1;
else
return +(m1[2] || 0) - +(m2[2] || 0);
});
ss.updatePorts(ports);
},
updateDevBadge: updateDevBadge,
updatePortStatus: updatePortStatus
});

View file

@ -1,610 +0,0 @@
'use strict';
'require view';
'require dom';
'require poll';
'require rpc';
'require uci';
'require form';
'require validation';
var callHostHints, callDUIDHints, callDHCPLeases, CBILeaseStatus, CBILease6Status;
callHostHints = rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
});
callDUIDHints = rpc.declare({
object: 'luci-rpc',
method: 'getDUIDHints',
expect: { '': {} }
});
callDHCPLeases = rpc.declare({
object: 'luci-rpc',
method: 'getDHCPLeases',
expect: { '': {} }
});
CBILeaseStatus = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
return E([
E('h4', _('Active DHCP Leases')),
E('table', { 'id': 'lease_status_table', 'class': 'table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, _('Hostname')),
E('th', { 'class': 'th' }, _('IPv4 address')),
E('th', { 'class': 'th' }, _('MAC address')),
E('th', { 'class': 'th' }, _('Lease time remaining'))
]),
E('tr', { 'class': 'tr placeholder' }, [
E('td', { 'class': 'td' }, E('em', _('Collecting data...')))
])
])
]);
}
});
CBILease6Status = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
return E([
E('h4', _('Active DHCPv6 Leases')),
E('table', { 'id': 'lease6_status_table', 'class': 'table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, _('Host')),
E('th', { 'class': 'th' }, _('IPv6 address')),
E('th', { 'class': 'th' }, _('DUID')),
E('th', { 'class': 'th' }, _('Lease time remaining'))
]),
E('tr', { 'class': 'tr placeholder' }, [
E('td', { 'class': 'td' }, E('em', _('Collecting data...')))
])
])
]);
}
});
function validateHostname(sid, s) {
if (s == null || s == '')
return true;
if (s.length > 256)
return _('Expecting: %s').format(_('valid hostname'));
var labels = s.replace(/^\.+|\.$/g, '').split(/\./);
for (var i = 0; i < labels.length; i++)
if (!labels[i].match(/^[a-z0-9_](?:[a-z0-9-]{0,61}[a-z0-9])?$/i))
return _('Expecting: %s').format(_('valid hostname'));
return true;
}
function validateAddressList(sid, s) {
if (s == null || s == '')
return true;
var m = s.match(/^\/(.+)\/$/),
names = m ? m[1].split(/\//) : [ s ];
for (var i = 0; i < names.length; i++) {
var res = validateHostname(sid, names[i]);
if (res !== true)
return res;
}
return true;
}
function validateServerSpec(sid, s) {
if (s == null || s == '')
return true;
var m = s.match(/^(?:\/(.+)\/)?(.*)$/);
if (!m)
return _('Expecting: %s').format(_('valid hostname'));
var res = validateAddressList(sid, m[1]);
if (res !== true)
return res;
if (m[2] == '' || m[2] == '#')
return true;
// ipaddr%scopeid#srvport@source@interface#srcport
m = m[2].match(/^([0-9a-f:.]+)(?:%[^#@]+)?(?:#(\d+))?(?:@([0-9a-f:.]+)(?:@[^#]+)?(?:#(\d+))?)?$/);
if (!m)
return _('Expecting: %s').format(_('valid IP address'));
if (validation.parseIPv4(m[1])) {
if (m[3] != null && !validation.parseIPv4(m[3]))
return _('Expecting: %s').format(_('valid IPv4 address'));
}
else if (validation.parseIPv6(m[1])) {
if (m[3] != null && !validation.parseIPv6(m[3]))
return _('Expecting: %s').format(_('valid IPv6 address'));
}
else {
return _('Expecting: %s').format(_('valid IP address'));
}
if ((m[2] != null && +m[2] > 65535) || (m[4] != null && +m[4] > 65535))
return _('Expecting: %s').format(_('valid port value'));
return true;
}
return view.extend({
load: function() {
return Promise.all([
callHostHints(),
callDUIDHints()
]);
},
render: function(hosts_duids) {
var has_dhcpv6 = L.hasSystemFeature('dnsmasq', 'dhcpv6') || L.hasSystemFeature('odhcpd'),
hosts = hosts_duids[0],
duids = hosts_duids[1],
m, s, o, ss, so;
m = new form.Map('dhcp', _('DHCP and DNS'), _('Dnsmasq is a combined <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-Server and <abbr title="Domain Name System">DNS</abbr>-Forwarder for <abbr title="Network Address Translation">NAT</abbr> firewalls'));
s = m.section(form.TypedSection, 'dnsmasq', _('Server Settings'));
s.anonymous = true;
s.addremove = false;
s.tab('general', _('General Settings'));
s.tab('files', _('Resolv and Hosts Files'));
s.tab('tftp', _('TFTP Settings'));
s.tab('advanced', _('Advanced Settings'));
s.tab('leases', _('Static Leases'));
s.taboption('general', form.Flag, 'domainneeded',
_('Domain required'),
_('Don\'t forward <abbr title="Domain Name System">DNS</abbr>-Requests without <abbr title="Domain Name System">DNS</abbr>-Name'));
s.taboption('general', form.Flag, 'authoritative',
_('Authoritative'),
_('This is the only <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> in the local network'));
s.taboption('files', form.Flag, 'readethers',
_('Use <code>/etc/ethers</code>'),
_('Read <code>/etc/ethers</code> to configure the <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-Server'));
s.taboption('files', form.Value, 'leasefile',
_('Leasefile'),
_('file where given <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-leases will be stored'));
s.taboption('files', form.Flag, 'noresolv',
_('Ignore resolve file')).optional = true;
o = s.taboption('files', form.Value, 'resolvfile',
_('Resolve file'),
_('local <abbr title="Domain Name System">DNS</abbr> file'));
o.depends('noresolv', '0');
o.placeholder = '/tmp/resolv.conf.d/resolv.conf.auto';
o.optional = true;
s.taboption('files', form.Flag, 'nohosts',
_('Ignore <code>/etc/hosts</code>')).optional = true;
s.taboption('files', form.DynamicList, 'addnhosts',
_('Additional Hosts files')).optional = true;
o = s.taboption('advanced', form.Flag, 'quietdhcp',
_('Suppress logging'),
_('Suppress logging of the routine operation of these protocols'));
o.optional = true;
o = s.taboption('advanced', form.Flag, 'sequential_ip',
_('Allocate IP sequentially'),
_('Allocate IP addresses sequentially, starting from the lowest available address'));
o.optional = true;
o = s.taboption('advanced', form.Flag, 'boguspriv',
_('Filter private'),
_('Do not forward reverse lookups for local networks'));
o.default = o.enabled;
s.taboption('advanced', form.Flag, 'filterwin2k',
_('Filter useless'),
_('Do not forward requests that cannot be answered by public name servers'));
s.taboption('advanced', form.Flag, 'localise_queries',
_('Localise queries'),
_('Localise hostname depending on the requesting subnet if multiple IPs are available'));
if (L.hasSystemFeature('dnsmasq', 'dnssec')) {
o = s.taboption('advanced', form.Flag, 'dnssec',
_('DNSSEC'));
o.optional = true;
o = s.taboption('advanced', form.Flag, 'dnsseccheckunsigned',
_('DNSSEC check unsigned'),
_('Requires upstream supports DNSSEC; verify unsigned domain responses really come from unsigned domains'));
o.default = o.enabled;
o.optional = true;
}
s.taboption('general', form.Value, 'local',
_('Local server'),
_('Local domain specification. Names matching this domain are never forwarded and are resolved from DHCP or hosts files only'));
s.taboption('general', form.Value, 'domain',
_('Local domain'),
_('Local domain suffix appended to DHCP names and hosts file entries'));
s.taboption('advanced', form.Flag, 'expandhosts',
_('Expand hosts'),
_('Add local domain suffix to names served from hosts files'));
s.taboption('advanced', form.Flag, 'nonegcache',
_('No negative cache'),
_('Do not cache negative replies, e.g. for not existing domains'));
s.taboption('advanced', form.Value, 'serversfile',
_('Additional servers file'),
_('This file may contain lines like \'server=/domain/1.2.3.4\' or \'server=1.2.3.4\' for domain-specific or full upstream <abbr title="Domain Name System">DNS</abbr> servers.'));
s.taboption('advanced', form.Flag, 'strictorder',
_('Strict order'),
_('<abbr title="Domain Name System">DNS</abbr> servers will be queried in the order of the resolvfile')).optional = true;
s.taboption('advanced', form.Flag, 'allservers',
_('All Servers'),
_('Query all available upstream <abbr title="Domain Name System">DNS</abbr> servers')).optional = true;
o = s.taboption('advanced', form.DynamicList, 'bogusnxdomain', _('Bogus NX Domain Override'),
_('List of hosts that supply bogus NX domain results'));
o.optional = true;
o.placeholder = '67.215.65.132';
s.taboption('general', form.Flag, 'logqueries',
_('Log queries'),
_('Write received DNS requests to syslog')).optional = true;
o = s.taboption('general', form.DynamicList, 'server', _('DNS forwardings'),
_('List of <abbr title="Domain Name System">DNS</abbr> servers to forward requests to'));
o.optional = true;
o.placeholder = '/example.org/10.1.2.3';
o.validate = validateServerSpec;
o = s.taboption('general', form.DynamicList, 'address', _('Addresses'),
_('List of domains to force to an IP address.'));
o.optional = true;
o.placeholder = '/router.local/192.168.0.1';
o = s.taboption('general', form.Flag, 'rebind_protection',
_('Rebind protection'),
_('Discard upstream RFC1918 responses'));
o.rmempty = false;
o = s.taboption('general', form.Flag, 'rebind_localhost',
_('Allow localhost'),
_('Allow upstream responses in the 127.0.0.0/8 range, e.g. for RBL services'));
o.depends('rebind_protection', '1');
o = s.taboption('general', form.DynamicList, 'rebind_domain',
_('Domain whitelist'),
_('List of domains to allow RFC1918 responses for'));
o.optional = true;
o.depends('rebind_protection', '1');
o.placeholder = 'ihost.netflix.com';
o.validate = validateAddressList;
o = s.taboption('advanced', form.Value, 'port',
_('<abbr title="Domain Name System">DNS</abbr> server port'),
_('Listening port for inbound DNS queries'));
o.optional = true;
o.datatype = 'port';
o.placeholder = 53;
o = s.taboption('advanced', form.Value, 'queryport',
_('<abbr title="Domain Name System">DNS</abbr> query port'),
_('Fixed source port for outbound DNS queries'));
o.optional = true;
o.datatype = 'port';
o.placeholder = _('any');
o = s.taboption('advanced', form.Value, 'dhcpleasemax',
_('<abbr title="maximal">Max.</abbr> <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> leases'),
_('Maximum allowed number of active DHCP leases'));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = _('unlimited');
o = s.taboption('advanced', form.Value, 'ednspacket_max',
_('<abbr title="maximal">Max.</abbr> <abbr title="Extension Mechanisms for Domain Name System">EDNS0</abbr> packet size'),
_('Maximum allowed size of EDNS.0 UDP packets'));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = 1280;
o = s.taboption('advanced', form.Value, 'dnsforwardmax',
_('<abbr title="maximal">Max.</abbr> concurrent queries'),
_('Maximum allowed number of concurrent DNS queries'));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = 150;
o = s.taboption('advanced', form.Value, 'cachesize',
_('Size of DNS query cache'),
_('Number of cached DNS entries (max is 10000, 0 is no caching)'));
o.optional = true;
o.datatype = 'range(0,10000)';
o.placeholder = 150;
s.taboption('tftp', form.Flag, 'enable_tftp',
_('Enable TFTP server')).optional = true;
o = s.taboption('tftp', form.Value, 'tftp_root',
_('TFTP server root'),
_('Root directory for files served via TFTP'));
o.optional = true;
o.depends('enable_tftp', '1');
o.placeholder = '/';
o = s.taboption('tftp', form.Value, 'dhcp_boot',
_('Network boot image'),
_('Filename of the boot image advertised to clients'));
o.optional = true;
o.depends('enable_tftp', '1');
o.placeholder = 'pxelinux.0';
o = s.taboption('general', form.Flag, 'localservice',
_('Local Service Only'),
_('Limit DNS service to subnets interfaces on which we are serving DNS.'));
o.optional = false;
o.rmempty = false;
o = s.taboption('general', form.Flag, 'nonwildcard',
_('Non-wildcard'),
_('Bind dynamically to interfaces rather than wildcard address (recommended as linux default)'));
o.default = o.enabled;
o.optional = false;
o.rmempty = true;
o = s.taboption('general', form.DynamicList, 'interface',
_('Listen Interfaces'),
_('Limit listening to these interfaces, and loopback.'));
o.optional = true;
o = s.taboption('general', form.DynamicList, 'notinterface',
_('Exclude interfaces'),
_('Prevent listening on these interfaces.'));
o.optional = true;
o = s.taboption('leases', form.SectionValue, '__leases__', form.GridSection, 'host', null,
_('Static leases are used to assign fixed IP addresses and symbolic hostnames to DHCP clients. They are also required for non-dynamic interface configurations where only hosts with a corresponding lease are served.') + '<br />' +
_('Use the <em>Add</em> Button to add a new lease entry. The <em>MAC address</em> identifies the host, the <em>IPv4 address</em> specifies the fixed address to use, and the <em>Hostname</em> is assigned as a symbolic name to the requesting host. The optional <em>Lease time</em> can be used to set non-standard host-specific lease time, e.g. 12h, 3d or infinite.'));
ss = o.subsection;
ss.addremove = true;
ss.anonymous = true;
so = ss.option(form.Value, 'name', _('Hostname'));
so.validate = validateHostname;
so.rmempty = true;
so.write = function(section, value) {
uci.set('dhcp', section, 'name', value);
uci.set('dhcp', section, 'dns', '1');
};
so.remove = function(section) {
uci.unset('dhcp', section, 'name');
uci.unset('dhcp', section, 'dns');
};
so = ss.option(form.Value, 'mac', _('<abbr title="Media Access Control">MAC</abbr>-Address'));
so.datatype = 'list(unique(macaddr))';
so.rmempty = true;
so.cfgvalue = function(section) {
var macs = L.toArray(uci.get('dhcp', section, 'mac')),
result = [];
for (var i = 0, mac; (mac = macs[i]) != null; i++)
if (/^([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2})$/.test(mac))
result.push('%02X:%02X:%02X:%02X:%02X:%02X'.format(
parseInt(RegExp.$1, 16), parseInt(RegExp.$2, 16),
parseInt(RegExp.$3, 16), parseInt(RegExp.$4, 16),
parseInt(RegExp.$5, 16), parseInt(RegExp.$6, 16)));
return result.length ? result.join(' ') : null;
};
so.renderWidget = function(section_id, option_index, cfgvalue) {
var node = form.Value.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]),
ipopt = this.section.children.filter(function(o) { return o.option == 'ip' })[0];
node.addEventListener('cbi-dropdown-change', L.bind(function(ipopt, section_id, ev) {
var mac = ev.detail.value.value;
if (mac == null || mac == '' || !hosts[mac])
return;
var iphint = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
if (iphint == null)
return;
var ip = ipopt.formvalue(section_id);
if (ip != null && ip != '')
return;
var node = ipopt.map.findElement('id', ipopt.cbid(section_id));
if (node)
dom.callClassMethod(node, 'setValue', iphint);
}, this, ipopt, section_id));
return node;
};
Object.keys(hosts).forEach(function(mac) {
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
});
so.write = function(section, value) {
var ip = this.map.lookupOption('ip', section)[0].formvalue(section);
var hosts = uci.sections('dhcp', 'host');
var section_removed = false;
for (var i = 0; i < hosts.length; i++) {
if (ip == hosts[i].ip) {
uci.set('dhcp', hosts[i]['.name'], 'mac', [hosts[i].mac, value].join(' '));
uci.remove('dhcp', section);
section_removed = true;
break;
}
}
if (!section_removed) {
uci.set('dhcp', section, 'mac', value);
}
}
so = ss.option(form.Value, 'ip', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address'));
so.datatype = 'or(ip4addr,"ignore")';
so.validate = function(section, value) {
var mac = this.map.lookupOption('mac', section),
name = this.map.lookupOption('name', section),
m = mac ? mac[0].formvalue(section) : null,
n = name ? name[0].formvalue(section) : null;
if ((m == null || m == '') && (n == null || n == ''))
return _('One of hostname or mac address must be specified!');
return true;
};
var ipaddrs = {};
Object.keys(hosts).forEach(function(mac) {
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
for (var i = 0; i < addrs.length; i++)
ipaddrs[addrs[i]] = hosts[mac].name;
});
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
so.value(ipv4, ipaddrs[ipv4] ? '%s (%s)'.format(ipv4, ipaddrs[ipv4]) : ipv4);
});
so = ss.option(form.Value, 'gw', _('Gateway IPv4 Address'));
so.rmempty = true;
so.datatype = 'or(ip4addr,"ignore")';
Object.keys(hosts).forEach(function(mac) {
if (hosts[mac].ipv4)
so.value(hosts[mac].ipv4);
});
so = ss.option(form.Value, 'leasetime', _('Lease time'));
so.rmempty = true;
so = ss.option(form.Value, 'duid', _('<abbr title="The DHCP Unique Identifier">DUID</abbr>'));
so.datatype = 'and(rangelength(20,36),hexstring)';
Object.keys(duids).forEach(function(duid) {
so.value(duid, '%s (%s)'.format(duid, duids[duid].hostname || duids[duid].macaddr || duids[duid].ip6addr || '?'));
});
so = ss.option(form.Value, 'hostid', _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Suffix (hex)'));
o = s.taboption('leases', CBILeaseStatus, '__status__');
if (has_dhcpv6)
o = s.taboption('leases', CBILease6Status, '__status6__');
return m.render().then(function(mapEl) {
poll.add(function() {
return callDHCPLeases().then(function(leaseinfo) {
var leases = Array.isArray(leaseinfo.dhcp_leases) ? leaseinfo.dhcp_leases : [],
leases6 = Array.isArray(leaseinfo.dhcp6_leases) ? leaseinfo.dhcp6_leases : [];
cbi_update_table(mapEl.querySelector('#lease_status_table'),
leases.map(function(lease) {
var exp;
if (lease.expires === false)
exp = E('em', _('unlimited'));
else if (lease.expires <= 0)
exp = E('em', _('expired'));
else
exp = '%t'.format(lease.expires);
return [
lease.hostname || '?',
lease.ipaddr,
lease.macaddr,
exp
];
}),
E('em', _('There are no active leases')));
if (has_dhcpv6) {
cbi_update_table(mapEl.querySelector('#lease6_status_table'),
leases6.map(function(lease) {
var exp;
if (lease.expires === false)
exp = E('em', _('unlimited'));
else if (lease.expires <= 0)
exp = E('em', _('expired'));
else
exp = '%t'.format(lease.expires);
var hint = lease.macaddr ? hosts[lease.macaddr] : null,
name = hint ? (hint.name || L.toArray(hint.ipaddrs || hint.ipv4)[0] || L.toArray(hint.ip6addrs || hint.ipv6)[0]) : null,
host = null;
if (name && lease.hostname && lease.hostname != name && lease.ip6addr != name)
host = '%s (%s)'.format(lease.hostname, name);
else if (lease.hostname)
host = lease.hostname;
else if (name)
host = name;
return [
host || '-',
lease.ip6addrs ? lease.ip6addrs.join(' ') : lease.ip6addr,
lease.duid,
exp
];
}),
E('em', _('There are no active leases')));
}
});
});
return mapEl;
});
}
});

View file

@ -1,139 +0,0 @@
'use strict';
'require view';
'require dom';
'require fs';
'require ui';
'require uci';
return view.extend({
handleCommand: function(exec, args) {
var buttons = document.querySelectorAll('.diag-action > .cbi-button');
for (var i = 0; i < buttons.length; i++)
buttons[i].setAttribute('disabled', 'true');
return fs.exec(exec, args).then(function(res) {
var out = document.querySelector('.command-output');
out.style.display = '';
dom.content(out, [ res.stdout || '', res.stderr || '' ]);
}).catch(function(err) {
ui.addNotification(null, E('p', [ err ]))
}).finally(function() {
for (var i = 0; i < buttons.length; i++)
buttons[i].removeAttribute('disabled');
});
},
handlePing: function(ev, cmd) {
var exec = cmd || 'ping',
addr = ev.currentTarget.parentNode.previousSibling.value,
args = (exec == 'ping') ? [ '-4', '-c', '5', '-W', '1', addr ] : [ '-6', '-c', '5', addr ];
return this.handleCommand(exec, args);
},
handleTraceroute: function(ev, cmd) {
var exec = cmd || 'traceroute',
addr = ev.currentTarget.parentNode.previousSibling.value,
args = (exec == 'traceroute') ? [ '-q', '1', '-w', '1', '-n', addr ] : [ '-q', '1', '-w', '2', '-n', addr ];
return this.handleCommand(exec, args);
},
handleNslookup: function(ev, cmd) {
var addr = ev.currentTarget.parentNode.previousSibling.value;
return this.handleCommand('nslookup', [ addr ]);
},
load: function() {
return Promise.all([
L.resolveDefault(fs.stat('/bin/ping6'), {}),
L.resolveDefault(fs.stat('/usr/bin/ping6'), {}),
L.resolveDefault(fs.stat('/bin/traceroute6'), {}),
L.resolveDefault(fs.stat('/usr/bin/traceroute6'), {}),
uci.load('luci')
]);
},
render: function(res) {
var has_ping6 = res[0].path || res[1].path,
has_traceroute6 = res[2].path || res[3].path,
dns_host = uci.get('luci', 'diag', 'dns') || 'openwrt.org',
ping_host = uci.get('luci', 'diag', 'ping') || 'openwrt.org',
route_host = uci.get('luci', 'diag', 'route') || 'openwrt.org';
return E([], [
E('h2', {}, [ _('Network Utilities') ]),
E('table', { 'class': 'table' }, [
E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td left' }, [
E('input', {
'style': 'margin:5px 0',
'type': 'text',
'value': ping_host
}),
E('span', { 'class': 'diag-action' }, [
has_ping6 ? new ui.ComboButton('ping', {
'ping': '%s %s'.format(_('IPv4'), _('Ping')),
'ping6': '%s %s'.format(_('IPv6'), _('Ping')),
}, {
'click': ui.createHandlerFn(this, 'handlePing'),
'classes': {
'ping': 'btn cbi-button cbi-button-action',
'ping6': 'btn cbi-button cbi-button-action'
}
}).render() : E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handlePing')
}, [ _('Ping') ])
])
]),
E('td', { 'class': 'td left' }, [
E('input', {
'style': 'margin:5px 0',
'type': 'text',
'value': route_host
}),
E('span', { 'class': 'diag-action' }, [
has_traceroute6 ? new ui.ComboButton('traceroute', {
'traceroute': '%s %s'.format(_('IPv4'), _('Traceroute')),
'traceroute6': '%s %s'.format(_('IPv6'), _('Traceroute')),
}, {
'click': ui.createHandlerFn(this, 'handleTraceroute'),
'classes': {
'traceroute': 'btn cbi-button cbi-button-action',
'traceroute6': 'btn cbi-button cbi-button-action'
}
}).render() : E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handleTraceroute')
}, [ _('Traceroute') ])
])
]),
E('td', { 'class': 'td left' }, [
E('input', {
'style': 'margin:5px 0',
'type': 'text',
'value': dns_host
}),
E('span', { 'class': 'diag-action' }, [
E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handleNslookup')
}, [ _('Nslookup') ])
])
])
])
]),
E('pre', { 'class': 'command-output', 'style': 'display:none' })
]);
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

View file

@ -1,50 +0,0 @@
'use strict';
'require view';
'require rpc';
'require form';
return view.extend({
callHostHints: rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
}),
load: function() {
return this.callHostHints();
},
render: function(hosts) {
var m, s, o;
m = new form.Map('dhcp', _('Hostnames'));
s = m.section(form.GridSection, 'domain', _('Host entries'));
s.addremove = true;
s.anonymous = true;
s.sortable = true;
o = s.option(form.Value, 'name', _('Hostname'));
o.datatype = 'hostname';
o.rmempty = true;
o = s.option(form.Value, 'ip', _('IP address'));
o.datatype = 'ipaddr';
o.rmempty = true;
var ipaddrs = {};
Object.keys(hosts).forEach(function(mac) {
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
for (var i = 0; i < addrs.length; i++)
ipaddrs[addrs[i]] = hosts[mac].name || mac;
});
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
o.value(ipv4, '%s (%s)'.format(ipv4, ipaddrs[ipv4]));
});
return m.render();
}
});

View file

@ -1,108 +0,0 @@
'use strict';
'require view';
'require form';
'require network';
'require tools.widgets as widgets';
return view.extend({
load: function() {
return network.getDevices();
},
render: function(netdevs) {
var m, s, o;
m = new form.Map('network', _('Routes'), _('Routes specify over which interface and gateway a certain host or network can be reached.'));
m.tabbed = true;
for (var i = 4; i <= 6; i += 2) {
s = m.section(form.GridSection, (i == 4) ? 'route' : 'route6', (i == 4) ? _('Static IPv4 Routes') : _('Static IPv6 Routes'));
s.anonymous = true;
s.addremove = true;
s.sortable = true;
s.nodescriptions = true;
s.tab('general', _('General Settings'));
s.tab('advanced', _('Advanced Settings'));
o = s.taboption('general', widgets.NetworkSelect, 'interface', _('Interface'));
o.rmempty = false;
o.nocreate = true;
o = s.taboption('general', form.Flag, 'disabled', _('Disable'), _('Disable this route'));
o.rmempty = true;
o.default = o.disabled;
o = s.taboption('general', form.Value, 'target', _('Target'), (i == 4) ? _('Host-<abbr title="Internet Protocol Address">IP</abbr> or Network') : _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Address or Network (CIDR)'));
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
o.rmempty = false;
if (i == 4) {
o = s.taboption('general', form.Value, 'netmask', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Netmask'), _('if target is a network'));
o.placeholder = '255.255.255.255';
o.datatype = 'ip4addr';
o.rmempty = true;
}
o = s.taboption('general', form.Value, 'gateway', (i == 4) ? _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway') : _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Gateway'));
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
o.rmempty = true;
o = s.taboption('advanced', form.Value, 'metric', _('Metric'));
o.placeholder = 0;
o.datatype = (i == 4) ? 'range(0,255)' : 'range(0,65535)';
o.rmempty = true;
o.textvalue = function(section_id) {
return this.cfgvalue(section_id) || 0;
};
o = s.taboption('advanced', form.Value, 'mtu', _('MTU'));
o.placeholder = 1500;
o.datatype = 'range(64,9000)';
o.rmempty = true;
o.modalonly = true;
o = s.taboption('advanced', form.ListValue, 'type', _('Route type'));
o.value('', 'unicast');
o.value('local');
o.value('broadcast');
o.value('multicast');
o.value('unreachable');
o.value('prohibit');
o.value('blackhole');
o.value('anycast');
o.default = '';
o.rmempty = true;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'table', _('Route table'));
o.value('local', 'local (255)');
o.value('main', 'main (254)');
o.value('default', 'default (253)');
o.rmempty = true;
o.modalonly = true;
o.cfgvalue = function(section_id) {
var cfgvalue = this.map.data.get('network', section_id, 'table');
return cfgvalue || 'main';
};
o = s.taboption('advanced', form.Value, 'source', _('Source Address'));
o.placeholder = E('em', _('automatic'));
for (var j = 0; j < netdevs.length; j++) {
var addrs = netdevs[j].getIPAddrs();
for (var k = 0; k < addrs.length; k++)
o.value(addrs[k].split('/')[0]);
}
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
o.default = '';
o.rmempty = true;
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'onlink', _('On-Link route'));
o.default = o.disabled;
o.rmempty = true;
}
return m.render();
}
});

View file

@ -1,375 +0,0 @@
'use strict';
'require view';
'require dom';
'require poll';
'require ui';
'require rpc';
'require uci';
'require form';
'require network';
function parse_portvalue(section_id) {
var ports = L.toArray(uci.get('network', section_id, 'ports'));
for (var i = 0; i < ports.length; i++) {
var m = ports[i].match(/^(\d+)([tu]?)/);
if (m && m[1] == this.option)
return m[2] || 'u';
}
return '';
}
function validate_portvalue(section_id, value) {
if (value != 'u')
return true;
var sections = this.section.cfgsections();
for (var i = 0; i < sections.length; i++) {
if (sections[i] == section_id)
continue;
if (this.formvalue(sections[i]) == 'u')
return _('%s is untagged in multiple VLANs!').format(this.title);
}
return true;
}
function update_interfaces(old_ifname, new_ifname) {
var interfaces = uci.sections('network', 'interface');
for (var i = 0; i < interfaces.length; i++) {
var old_ifnames = L.toArray(interfaces[i].ifname),
new_ifnames = [],
changed = false;
for (var j = 0; j < old_ifnames.length; j++) {
if (old_ifnames[j] == old_ifname) {
new_ifnames.push(new_ifname);
changed = true;
}
else {
new_ifnames.push(old_ifnames[j]);
}
}
if (changed) {
uci.set('network', interfaces[i]['.name'], 'ifname', new_ifnames.join(' '));
ui.addNotification(null, E('p', _('Interface %q device auto-migrated from %q to %q.')
.replace(/%q/g, '"%s"').format(interfaces[i]['.name'], old_ifname, new_ifname)));
}
}
}
function render_port_status(node, portstate) {
if (!node)
return null;
if (!portstate || !portstate.link)
dom.content(node, [
E('img', { src: L.resource('icons/port_down.png') }),
E('br'),
_('no link')
]);
else
dom.content(node, [
E('img', { src: L.resource('icons/port_up.png') }),
E('br'),
'%d'.format(portstate.speed) + _('baseT'),
E('br'),
portstate.duplex ? _('full-duplex') : _('half-duplex')
]);
return node;
}
function update_port_status(topologies) {
var tasks = [];
for (var switch_name in topologies)
tasks.push(callSwconfigPortState(switch_name).then(L.bind(function(switch_name, ports) {
for (var i = 0; i < ports.length; i++) {
var node = document.querySelector('[data-switch="%s"][data-port="%d"]'.format(switch_name, ports[i].port));
render_port_status(node, ports[i]);
}
}, topologies[switch_name], switch_name)));
return Promise.all(tasks);
}
var callSwconfigFeatures = rpc.declare({
object: 'luci',
method: 'getSwconfigFeatures',
params: [ 'switch' ],
expect: { '': {} }
});
var callSwconfigPortState = rpc.declare({
object: 'luci',
method: 'getSwconfigPortState',
params: [ 'switch' ],
expect: { result: [] }
});
return view.extend({
load: function() {
return network.getSwitchTopologies().then(function(topologies) {
var tasks = [];
for (var switch_name in topologies) {
tasks.push(callSwconfigFeatures(switch_name).then(L.bind(function(features) {
this.features = features;
}, topologies[switch_name])));
tasks.push(callSwconfigPortState(switch_name).then(L.bind(function(ports) {
this.portstate = ports;
}, topologies[switch_name])));
}
return Promise.all(tasks).then(function() { return topologies });
});
},
render: function(topologies) {
var m, s, o;
m = new form.Map('network', _('Switch'), _('The network ports on this device can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network.'));
var switchSections = uci.sections('network', 'switch');
for (var i = 0; i < switchSections.length; i++) {
var switchSection = switchSections[i],
sid = switchSection['.name'],
switch_name = switchSection.name || sid,
topology = topologies[switch_name];
if (!topology) {
ui.addNotification(null, _('Switch %q has an unknown topology - the VLAN settings might not be accurate.').replace(/%q/, switch_name));
topologies[switch_name] = topology = {
features: {},
netdevs: {
5: 'eth0'
},
ports: [
{ num: 0, label: 'Port 1' },
{ num: 1, label: 'Port 2' },
{ num: 2, label: 'Port 3' },
{ num: 3, label: 'Port 4' },
{ num: 4, label: 'Port 5' },
{ num: 5, label: 'CPU (eth0)', device: 'eth0', need_tag: false }
]
};
}
var feat = topology.features,
min_vid = feat.min_vid || 0,
max_vid = feat.max_vid || 16,
num_vlans = feat.num_vlans || 16,
switch_title = _('Switch %q').replace(/%q/, '"%s"'.format(switch_name)),
vlan_title = _('VLANs on %q').replace(/%q/, '"%s"'.format(switch_name));
if (feat.switch_title) {
switch_title += ' (%s)'.format(feat.switch_title);
vlan_title += ' (%s)'.format(feat.switch_title);
}
s = m.section(form.NamedSection, sid, 'switch', switch_title);
s.addremove = false;
if (feat.vlan_option)
s.option(form.Flag, feat.vlan_option, _('Enable VLAN functionality'));
if (feat.learning_option) {
o = s.option(form.Flag, feat.learning_option, _('Enable learning and aging'));
o.default = o.enabled;
}
if (feat.jumbo_option) {
o = s.option(form.Flag, feat.jumbo_option, _('Enable Jumbo Frame passthrough'));
o.enabled = '3';
o.rmempty = true;
}
if (feat.mirror_option) {
s.option(form.Flag, 'enable_mirror_rx', _('Enable mirroring of incoming packets'));
s.option(form.Flag, 'enable_mirror_tx', _('Enable mirroring of outgoing packets'));
var sp = s.option(form.ListValue, 'mirror_source_port', _('Mirror source port')),
mp = s.option(form.ListValue, 'mirror_monitor_port', _('Mirror monitor port'));
sp.depends('enable_mirror_rx', '1');
sp.depends('enable_mirror_tx', '1');
mp.depends('enable_mirror_rx', '1');
mp.depends('enable_mirror_tx', '1');
for (var j = 0; j < topology.ports.length; j++) {
sp.value(topology.ports[j].num, topology.ports[j].label);
mp.value(topology.ports[j].num, topology.ports[j].label);
}
}
s = m.section(form.TableSection, 'switch_vlan', vlan_title);
s.anonymous = true;
s.addremove = true;
s.addbtntitle = _('Add VLAN');
s.topology = topology;
s.device = switch_name;
s.filter = function(section_id) {
var device = uci.get('network', section_id, 'device');
return (device == switch_name);
};
s.cfgsections = function() {
var sections = form.TableSection.prototype.cfgsections.apply(this);
return sections.sort(function(a, b) {
var vidA = feat.vid_option ? uci.get('network', a, feat.vid_option) : null,
vidB = feat.vid_option ? uci.get('network', b, feat.vid_option) : null;
vidA = +(vidA != null ? vidA : uci.get('network', a, 'vlan') || 9999);
vidB = +(vidB != null ? vidB : uci.get('network', b, 'vlan') || 9999);
return (vidA - vidB);
});
};
s.handleAdd = function(ev) {
var sections = uci.sections('network', 'switch_vlan'),
section_id = uci.add('network', 'switch_vlan'),
max_vlan = 0,
max_vid = 0;
for (var j = 0; j < sections.length; j++) {
if (sections[j].device != s.device)
continue;
var vlan = +sections[j].vlan,
vid = feat.vid_option ? +sections[j][feat.vid_option] : null;
if (vlan > max_vlan)
max_vlan = vlan;
if (vid > max_vid)
max_vid = vid;
}
uci.set('network', section_id, 'device', s.device);
uci.set('network', section_id, 'vlan', max_vlan + 1);
if (feat.vid_option)
uci.set('network', section_id, feat.vid_option, max_vid + 1);
return this.map.save(null, true);
};
var port_opts = [];
o = s.option(form.Value, feat.vid_option || 'vlan', 'VLAN ID');
o.rmempty = false;
o.forcewrite = true;
o.vlan_used = {};
o.datatype = 'range(%u,%u)'.format(min_vid, feat.vid_option ? 4094 : num_vlans - 1);
o.description = _('Port status:');
o.validate = function(section_id, value) {
var v = +value,
m = feat.vid_option ? 4094 : num_vlans - 1;
if (isNaN(v) || v < min_vid || v > m)
return _('Invalid VLAN ID given! Only IDs between %d and %d are allowed.').format(min_vid, m);
var sections = this.section.cfgsections();
for (var i = 0; i < sections.length; i++) {
if (sections[i] == section_id)
continue;
if (this.formvalue(sections[i]) == v)
return _('Invalid VLAN ID given! Only unique IDs are allowed');
}
return true;
};
o.write = function(section_id, value) {
var topology = this.section.topology,
values = [];
for (var i = 0; i < port_opts.length; i++) {
var tagging = port_opts[i].formvalue(section_id),
portspec = Array.isArray(topology.ports) ? topology.ports[i] : null;
if (tagging == 't')
values.push(port_opts[i].option + tagging);
else if (tagging == 'u')
values.push(port_opts[i].option);
if (portspec && portspec.device) {
var old_tag = port_opts[i].cfgvalue(section_id),
old_vid = this.cfgvalue(section_id);
if (old_tag != tagging || old_vid != value) {
var old_ifname = portspec.device + (old_tag != 'u' ? '.' + old_vid : ''),
new_ifname = portspec.device + (tagging != 'u' ? '.' + value : '');
if (old_ifname != new_ifname)
update_interfaces(old_ifname, new_ifname);
}
}
}
if (feat.vlan4k_option)
uci.set('network', sid, feat.vlan4k_option, '1');
uci.set('network', section_id, 'ports', values.join(' '));
return form.Value.prototype.write.apply(this, [section_id, value]);
};
o.cfgvalue = function(section_id) {
var value = feat.vid_option ? uci.get('network', section_id, feat.vid_option) : null;
return (value || uci.get('network', section_id, 'vlan'));
};
s.option(form.Value, 'description', _('Description'));
for (var j = 0; Array.isArray(topology.ports) && j < topology.ports.length; j++) {
var portspec = topology.ports[j],
portstate = Array.isArray(topology.portstate) ? topology.portstate[portspec.num] : null;
o = s.option(form.ListValue, String(portspec.num), portspec.label);
o.value('', _('off'));
if (!portspec.need_tag)
o.value('u', _('untagged'));
o.value('t', _('tagged'));
o.cfgvalue = parse_portvalue;
o.validate = validate_portvalue;
o.write = function() {};
o.description = render_port_status(E('small', {
'data-switch': switch_name,
'data-port': portspec.num
}), portstate);
port_opts.push(o);
}
port_opts.sort(function(a, b) {
return a.option > b.option;
});
}
poll.add(L.bind(update_port_status, m, topologies));
return m.render();
}
});

View file

@ -1,22 +0,0 @@
#!/bin/sh
if [ "$(uci -q get luci.diag)" != "internal" ]; then
host=""
if [ -s /etc/os-release ]; then
. /etc/os-release
host="${HOME_URL:-${BUG_URL:-$OPENWRT_DEVICE_MANUFACTURER_URL}}"
host="${host#*://}"
host="${host%%/*}"
fi
uci -q batch <<-EOF >/dev/null
set luci.diag=internal
set luci.diag.dns='${host:-openwrt.org}'
set luci.diag.ping='${host:-openwrt.org}'
set luci.diag.route='${host:-openwrt.org}'
commit luci
EOF
fi
exit 0

View file

@ -1,46 +0,0 @@
#!/bin/sh
NL="
"
function ifaces_by_device() {
ubus call network.interface dump 2>/dev/null | \
jsonfilter -e "@.interface[@.device='$1' || @.l3_device='$1'].interface"
}
function device_by_addr() {
set -- $(ip route get "$1" ${2:+from "$2"} 2>/dev/null)
echo "$5"
}
for inbound_device in $(device_by_addr "$REMOTE_ADDR" "$SERVER_ADDR"); do
inbound_devices="$inbound_device"
inbound_interfaces=""
for iface in $(ifaces_by_device "$inbound_device"); do
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
for peeraddr in $(uci get "network.$iface.peeraddr"); do
for ipaddr in $(resolveip -t 1 "$peeraddr" 2>/dev/null); do
for peerdev in $(device_by_addr "$ipaddr"); do
for iface in $(ifaces_by_device "$peerdev"); do
inbound_devices="${inbound_devices:+$inbound_devices$NL}$peerdev"
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
done
done
done
done
done
done
inbound_devices="$(echo "$inbound_devices" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
inbound_interfaces="$(echo "$inbound_interfaces" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
cat <<JSON
{
"remote_addr": "$REMOTE_ADDR",
"server_addr": "$SERVER_ADDR",
"inbound_devices": [ ${inbound_devices:+\"$inbound_devices\"} ],
"inbound_interfaces": [ ${inbound_interfaces:+\"$inbound_interfaces\"} ]
}
JSON

View file

@ -1,98 +0,0 @@
{
"admin/network/switch": {
"title": "Switch",
"order": 20,
"action": {
"type": "view",
"path": "network/switch"
},
"depends": {
"acl": [ "luci-mod-network-config" ],
"fs": { "/sbin/swconfig": "executable" },
"uci": { "network": { "@switch": true } }
}
},
"admin/network/wireless": {
"title": "Wireless",
"order": 15,
"action": {
"type": "view",
"path": "network/wireless"
},
"depends": {
"acl": [ "luci-mod-network-config" ],
"uci": { "wireless": { "@wifi-device": true } }
}
},
"admin/network/remote_addr/*": {
"action": {
"type": "call",
"module": "luci.controller.admin.network",
"function": "remote_addr"
}
},
"admin/network/network": {
"title": "Interfaces",
"order": 10,
"action": {
"type": "view",
"path": "network/interfaces"
},
"depends": {
"acl": [ "luci-mod-network-config" ]
}
},
"admin/network/dhcp": {
"title": "DHCP and DNS",
"order": 30,
"action": {
"type": "view",
"path": "network/dhcp"
},
"depends": {
"acl": [ "luci-mod-network-dhcp" ],
"uci": { "dhcp": true }
}
},
"admin/network/hosts": {
"title": "Hostnames",
"order": 40,
"action": {
"type": "view",
"path": "network/hosts"
},
"depends": {
"acl": [ "luci-mod-network-dhcp" ],
"uci": { "dhcp": true }
}
},
"admin/network/routes": {
"title": "Static Routes",
"order": 50,
"action": {
"type": "view",
"path": "network/routes"
},
"depends": {
"acl": [ "luci-mod-network-config" ]
}
},
"admin/network/diagnostics": {
"title": "Diagnostics",
"order": 60,
"action": {
"type": "view",
"path": "network/diagnostics"
},
"depends": {
"acl": [ "luci-mod-network-diagnostics" ]
}
}
}

View file

@ -1,69 +0,0 @@
{
"luci-mod-network-config": {
"description": "Grant access to network configuration",
"read": {
"cgi-io": [ "exec" ],
"file": {
"/etc/iproute2/rt_tables": [ "read" ],
"/proc/sys/net/ipv6/conf/*/mtu": [ "read" ],
"/proc/sys/net/ipv6/conf/*/hop_limit": [ "read" ],
"/usr/libexec/luci-peeraddr": [ "exec" ],
"/usr/lib/opkg/info/netifd.control": [ "read" ]
},
"ubus": {
"file": [ "exec" ],
"iwinfo": [ "assoclist", "countrylist", "freqlist", "txpowerlist" ],
"luci": [ "getSwconfigFeatures", "getSwconfigPortState" ]
},
"uci": [ "dhcp", "firewall", "network", "wireless" ]
},
"write": {
"cgi-io": [ "exec" ],
"file": {
"/sbin/ifup": [ "exec" ],
"/sbin/ifdown": [ "exec" ],
"/sbin/wifi": [ "exec" ]
},
"ubus": {
"file": [ "exec" ],
"hostapd.*": [ "del_client" ],
"iwinfo": [ "scan" ]
},
"uci": [ "dhcp", "firewall", "network", "wireless" ]
}
},
"luci-mod-network-dhcp": {
"description": "Grant access to DHCP configuration",
"read": {
"ubus": {
"luci-rpc": [ "getDHCPLeases", "getDUIDHints" ]
},
"uci": [ "dhcp" ]
},
"write": {
"uci": [ "dhcp" ]
}
},
"luci-mod-network-diagnostics": {
"description": "Grant access to network diagnostic tools",
"read": {
"file": {
"/bin/ping": [ "exec" ],
"/bin/ping6": [ "exec", "list" ],
"/bin/traceroute": [ "exec" ],
"/bin/traceroute6": [ "exec", "list" ],
"/usr/bin/nslookup": [ "exec" ],
"/usr/bin/ping": [ "exec" ],
"/usr/bin/ping6": [ "exec", "list" ],
"/usr/bin/traceroute": [ "exec" ],
"/usr/bin/traceroute6": [ "exec", "list" ]
},
"ubus": {
"file": [ "exec", "stat" ]
},
"uci": [ "luci" ]
}
}
}

View file

@ -1,14 +0,0 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Support for MBIM
LUCI_DEPENDS:=+umbim
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -1,100 +0,0 @@
'use strict';
'require rpc';
'require form';
'require network';
var callFileList = rpc.declare({
object: 'file',
method: 'list',
params: [ 'path' ],
expect: { entries: [] },
filter: function(list, params) {
var rv = [];
for (var i = 0; i < list.length; i++)
if (list[i].name.match(/^cdc-wdm/))
rv.push(params.path + list[i].name);
return rv.sort();
}
});
network.registerPatternVirtual(/^mbim-.+$/);
return network.registerProtocol('mbim', {
getI18n: function() {
return _('MBIM Cellular');
},
getIfname: function() {
return this._ubus('l3_device') || 'mbim-%s'.format(this.sid);
},
getOpkgPackage: function() {
return 'umbim';
},
isFloating: function() {
return true;
},
isVirtual: function() {
return true;
},
getDevices: function() {
return null;
},
containsDevice: function(ifname) {
return (network.getIfnameOf(ifname) == this.getIfname());
},
renderFormOptions: function(s) {
var dev = this.getL3Device() || this.getDevice(), o;
o = s.taboption('general', form.Value, 'device', _('Modem device'));
o.rmempty = false;
o.load = function(section_id) {
return callFileList('/dev/').then(L.bind(function(devices) {
for (var i = 0; i < devices.length; i++)
this.value(devices[i]);
return form.Value.prototype.load.apply(this, [section_id]);
}, this));
};
s.taboption('general', form.Value, 'apn', _('APN'));
s.taboption('general', form.Value, 'pincode', _('PIN'));
o = s.taboption('general', form.ListValue, 'auth', _('Authentication Type'));
o.value('both', 'PAP/CHAP');
o.value('pap', 'PAP');
o.value('chap', 'CHAP');
o.value('none', 'NONE');
o.default = 'none';
o = s.taboption('general', form.Value, 'username', _('PAP/CHAP username'));
o.depends('auth', 'pap');
o.depends('auth', 'chap');
o.depends('auth', 'both');
o = s.taboption('general', form.Value, 'password', _('PAP/CHAP password'));
o.depends('auth', 'pap');
o.depends('auth', 'chap');
o.depends('auth', 'both');
o.password = true;
if (L.hasSystemFeature('ipv6')) {
o = s.taboption('advanced', form.Flag, 'ipv6', _('Enable IPv6 negotiation'));
o.default = o.disabled;
}
o = s.taboption('advanced', form.Value, 'delay', _('Modem init timeout'), _('Maximum amount of seconds to wait for the modem to become ready'));
o.placeholder = '10';
o.datatype = 'min(1)';
o = s.taboption('general', form.ListValue, 'pdptype', _('PDP Type'));
o.value('ipv4v6', 'IPv4/IPv6');
o.value('ipv4', 'IPv4');
o.value('ipv6', 'IPv6');
o.default = 'ipv4v6';
}
});