🍓 Sync 2026-06-04 16:10:22

This commit is contained in:
github-actions[bot] committed 2026-06-04 16:10:22 +08:00
1 parent 52c6346905
commit 37b3b0b2ee
289 files changed
+114950 -145

No files matched your search

+2 -2
View File
@@ -11,8 +11,8 @@ LUCI_DESCRIPTION:=LuCI JS interface for the modemband. The package allows set LT
LUCI_DEPENDS:=+modemband
PKG_NAME:=luci-app-modemband
PKG_VERSION:=1.0.25.20240519
PKG_RELEASE:=1
PKG_VERSION:=1.0.24
PKG_RELEASE:=2
PKG_MAINTAINER:=Rafał Wabik <4Rafal@gmail.com>
include $(TOPDIR)/feeds/luci/luci.mk
@@ -12,29 +12,29 @@
Copyright 2022-2024 Rafał Wabik - IceG - From eko.one.pl forum
*/
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gnsabands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gnsabands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gnsabands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gnsabands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
});
var BANDmagic = form.DummyValue.extend({
@@ -176,14 +176,14 @@ function handleAction(ev) {
if (ev === 'reload') {
location.reload();
}
if (ev === 'resetbandz') {
if (ev === 'resetbandz') {
if (confirm(_('Do you really want to set up all possible bands for the modem?')))
{
fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands5gnsa', 'default' ]);
return uci.load('modemband').then(function() {
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
@@ -202,7 +202,7 @@ function handleAction(ev) {
if (ev === 'restartwan') {
return uci.load('modemband').then(function() {
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
@@ -251,7 +251,7 @@ return view.extend({
modemen = modemen.includes('n0') == true ? modemen = _('Bands are disabled...') : modemen.trim();
for (var i = 0; i < json.supported5gnsa.length; i++)
for (var i = 0; i < json.supported5gnsa.length; i++)
{
var txtband = json.supported5gnsa[i].band.toString();
var numb = txtband.match(/\d+$/);
@@ -259,18 +259,18 @@ return view.extend({
sbands = sbands.replace('undefined', '');
}
sbands = sbands.trim();
pollData: poll.add(function() {
return L.resolveDefault(fs.exec_direct('/usr/bin/modemband.sh', [ 'json' ]))
.then(function(res) {
var json = JSON.parse(res);
//modemen = _('Waiting for device...');
if ( json != null ) {
if ( json != null ) {
var renderHTML = "";
var view = document.getElementById("modemlteb");
for (var i = 0; i < json.enabled5gnsa.length; i++)
for (var i = 0; i < json.enabled5gnsa.length; i++)
{
var txtband = json.enabled5gnsa[i].toString();
var numb = txtband.match(/\d+$/);
@@ -288,7 +288,7 @@ return view.extend({
});
});
}
}
}
else {
if (json.error.includes('No supported') == true) {
modemen = '-';
@@ -305,7 +305,7 @@ return view.extend({
} catch (err) {
console.log('Error: ', err.message);
}
}
}
var info = _('Configuration modem frequency bands. More information about the modemband application on the %seko.one.pl forum%s.').format('<a href="https://eko.one.pl/?p=openwrt-modemband" target="_blank">', '</a>');
@@ -347,21 +347,21 @@ return view.extend({
else {
s.tab('bandset', _('Preferred bands settings'));
o = s.taboption('bandset', cbiRichListValue, 'set_5gnsabands',
_('Modification of the bands'),
_('Modification of the bands'),
_("Select the preferred band(s) for the modem."));
for (var i = 0; i < json.supported5gnsa.length; i++)
for (var i = 0; i < json.supported5gnsa.length; i++)
{
o.value(json.supported5gnsa[i].band, _('n')+json.supported5gnsa[i].band,json.supported5gnsa[i].txt);
}
o.multiple = true;
o.placeholder = _('Please select a band(s)');
o.cfgvalue = function(section_id) {
return L.toArray((json.enabled5gnsa).join(' '));
};
o = s.taboption('bandset', CBISelectswitch, '_switch', _('Band selection switch'));
s = m.section(form.TypedSection);
@@ -383,7 +383,7 @@ return view.extend({
o = s.taboption('opt1', SYSTmagic);
}
return m.render();
},
@@ -396,7 +396,7 @@ return view.extend({
args.push(data.modemband.set_5gnsabands);
var ax = args.toString();
ax = ax.replace(/,/g, ' ')
ax.length >= 1 ? fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands5gnsa', ax ]) : ui.addNotification(null, E('p', _('Check if you have selected the bands correctly.')), 'info');
return uci.load('modemband').then(function() {
@@ -404,20 +404,20 @@ return view.extend({
var mrestart = (uci.get('modemband', '@modemband[0]', 'modemrestart'));
var cmdrestart = (uci.get('modemband', '@modemband[0]', 'restartcmd'));
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( ax.length >= 1 ) {
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
}
if (wrestart == '1') {
fs.exec('/sbin/ifdown', [ wname ]);
fs.exec('sleep 3');
@@ -13,29 +13,29 @@
*/
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gsabands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gsabands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gsabands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_5gsabands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
});
@@ -178,14 +178,14 @@ function handleAction(ev) {
if (ev === 'reload') {
location.reload();
}
if (ev === 'resetbandz') {
if (ev === 'resetbandz') {
if (confirm(_('Do you really want to set up all possible bands for the modem?')))
{
fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands5gsa', 'default' ]);
return uci.load('modemband').then(function() {
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
@@ -204,7 +204,7 @@ function handleAction(ev) {
if (ev === 'restartwan') {
return uci.load('modemband').then(function() {
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
@@ -243,7 +243,7 @@ return view.extend({
else {
var modem = json.modem;
for (var i = 0; i < json.enabled5gsa.length; i++)
for (var i = 0; i < json.enabled5gsa.length; i++)
{
var txtband = json.enabled5gsa[i].toString();
var numb = txtband.match(/\d+$/);
@@ -252,7 +252,7 @@ return view.extend({
}
modemen = modemen.includes('n0') == true ? modemen = _('Bands are disabled...') : modemen = modemen.trim();
for (var i = 0; i < json.supported5gsa.length; i++)
for (var i = 0; i < json.supported5gsa.length; i++)
{
var txtband = json.supported5gsa[i].band.toString();
var numb = txtband.match(/\d+$/);
@@ -260,17 +260,17 @@ return view.extend({
sbands = sbands.replace('undefined', '');
}
sbands = sbands.trim();
pollData: poll.add(function() {
return L.resolveDefault(fs.exec_direct('/usr/bin/modemband.sh', [ 'json' ]))
.then(function(res) {
var json = JSON.parse(res);
//modemen = _('Waiting for device...');
if ( json != null ) {
if ( json != null ) {
var renderHTML = "";
var view = document.getElementById("modemlteb");
for (var i = 0; i < json.enabled5gsa.length; i++)
for (var i = 0; i < json.enabled5gsa.length; i++)
{
var txtband = json.enabled5gsa[i].toString();
var numb = txtband.match(/\d+$/);
@@ -288,7 +288,7 @@ return view.extend({
});
});
}
}
}
else {
if (json.error.includes('No supported') == true) {
modemen = '-';
@@ -305,7 +305,7 @@ return view.extend({
} catch (err) {
console.log('Error: ', err.message);
}
}
}
var info = _('Configuration modem frequency bands. More information about the modemband application on the %seko.one.pl forum%s.').format('<a href="https://eko.one.pl/?p=openwrt-modemband" target="_blank">', '</a>');
@@ -347,15 +347,15 @@ return view.extend({
else {
s.tab('bandset', _('Preferred bands settings'));
o = s.taboption('bandset', cbiRichListValue, 'set_5gsabands',
_('Modification of the bands'),
_('Modification of the bands'),
_("Select the preferred band(s) for the modem."));
for (var i = 0; i < json.supported5gsa.length; i++)
for (var i = 0; i < json.supported5gsa.length; i++)
{
o.value(json.supported5gsa[i].band, _('n')+json.supported5gsa[i].band,json.supported5gsa[i].txt);
}
o.multiple = true;
o.placeholder = _('Please select a band(s)');
o.cfgvalue = function(section_id) {
@@ -383,7 +383,7 @@ return view.extend({
o = s.taboption('opt1', SYSTmagic);
}
return m.render();
},
@@ -396,7 +396,7 @@ return view.extend({
args.push(data.modemband.set_5gsabands);
var ax = args.toString();
ax = ax.replace(/,/g, ' ')
ax.length >= 1 ? fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands5gsa', ax ]) : ui.addNotification(null, E('p', _('Check if you have selected the bands correctly.')), 'info');
return uci.load('modemband').then(function() {
@@ -404,20 +404,20 @@ return view.extend({
var mrestart = (uci.get('modemband', '@modemband[0]', 'modemrestart'));
var cmdrestart = (uci.get('modemband', '@modemband[0]', 'restartcmd'));
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( ax.length >= 1 ) {
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
}
if (wrestart == '1') {
fs.exec('/sbin/ifdown', [ wname ]);
fs.exec('sleep 3');
@@ -12,29 +12,29 @@
Copyright 2022-2024 Rafał Wabik - IceG - From eko.one.pl forum
*/
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_bands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_bands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
var CBISelectswitch = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
var section = this.section;
return E([], [
E('span', { 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_bands');
dropdown.setValue([]);
}),
}, _('Deselect all')),
' ',
E('button', {
'class': 'cbi-button cbi-button-action important',
'click': ui.createHandlerFn(this, function() {
var dropdown = section.getUIElement(section_id, 'set_bands');
dropdown.setValue(Object.keys(dropdown.choices));
})
}, _('Select all'))
])
]);
},
});
var BANDmagic = form.DummyValue.extend({
@@ -224,14 +224,14 @@ function handleAction(ev) {
if (ev === 'reload') {
location.reload();
}
if (ev === 'resetbandz') {
if (ev === 'resetbandz') {
if (confirm(_('Do you really want to set up all possible bands for the modem?')))
{
fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands', 'default' ]);
return uci.load('modemband').then(function() {
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
@@ -250,7 +250,7 @@ function handleAction(ev) {
if (ev === 'restartwan') {
return uci.load('modemband').then(function() {
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
@@ -265,7 +265,7 @@ function handleAction(ev) {
//var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
fs.exec_direct('/usr/bin/sms_tool', [ '-d' , '/dev/ttyUSB1' , 'at' , 'AT+ZULCA=1' ]);
});
}
if (ev === 'offupload') {
return uci.load('modemband').then(function() {
@@ -304,7 +304,7 @@ return view.extend({
else {
var modem = json.modem;
for (var i = 0; i < json.enabled.length; i++)
for (var i = 0; i < json.enabled.length; i++)
{
var txtband = json.enabled[i].toString();
var numb = txtband.match(/\d+$/);
@@ -313,7 +313,7 @@ return view.extend({
}
modemen = modemen.trim();
for (var i = 0; i < json.supported.length; i++)
for (var i = 0; i < json.supported.length; i++)
{
var txtband = json.supported[i].band.toString();
var numb = txtband.match(/\d+$/);
@@ -321,17 +321,17 @@ return view.extend({
sbands = sbands.replace('undefined', '');
}
sbands = sbands.trim();
pollData: poll.add(function() {
return L.resolveDefault(fs.exec_direct('/usr/bin/modemband.sh', [ 'json' ]))
.then(function(res) {
var json = JSON.parse(res);
//modemen = _('Waiting for device...');
if ( json != null ) {
if ( json != null ) {
var renderHTML = "";
var view = document.getElementById("modemlteb");
for (var i = 0; i < json.enabled.length; i++)
for (var i = 0; i < json.enabled.length; i++)
{
var txtband = json.enabled[i].toString();
var numb = txtband.match(/\d+$/);
@@ -349,7 +349,7 @@ return view.extend({
});
});
}
}
}
else {
if (json.error.includes('No supported') == true) {
modemen = '-';
@@ -365,7 +365,7 @@ return view.extend({
} catch (err) {
console.log('Error: ', err.message);
}
}
}
var info = _('Configuration modem frequency bands. More information about the modemband application on the %seko.one.pl forum%s.').format('<a href="https://eko.one.pl/?p=openwrt-modemband" target="_blank">', '</a>');
@@ -408,23 +408,23 @@ return view.extend({
}
else {
s.tab('bandset', _('Preferred bands settings'));
o = s.taboption('bandset', cbiRichListValue, 'set_bands',
_('Modification of the bands'),
_('Modification of the bands'),
_("Select the preferred band(s) for the modem."));
for (var i = 0; i < json.supported.length; i++)
for (var i = 0; i < json.supported.length; i++)
{
o.value(json.supported[i].band, _('B')+json.supported[i].band,json.supported[i].txt);
}
o.multiple = true;
o.placeholder = _('Please select a band(s)');
o.cfgvalue = function(section_id) {
return L.toArray((json.enabled).join(' '));
};
o = s.taboption('bandset', CBISelectswitch, '_switch', _('Band selection switch'));
s = m.section(form.TypedSection);
@@ -466,7 +466,7 @@ return view.extend({
'</em></div>';
};
}
return m.render();
},
@@ -479,7 +479,7 @@ return view.extend({
args.push(data.modemband.set_bands);
var ax = args.toString();
ax = ax.replace(/,/g, ' ')
ax.length >= 1 ? fs.exec_direct('/usr/bin/modemband.sh', [ 'setbands', ax ]) : ui.addNotification(null, E('p', _('Check if you have selected the bands correctly.')), 'info');
return uci.load('modemband').then(function() {
@@ -487,20 +487,20 @@ return view.extend({
var mrestart = (uci.get('modemband', '@modemband[0]', 'modemrestart'));
var cmdrestart = (uci.get('modemband', '@modemband[0]', 'restartcmd'));
var wname = (uci.get('modemband', '@modemband[0]', 'iface'));
if (wname.includes('@')) {
wname = wname.replace(/@/g, '')
};
var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
var nuser = (uci.get('modemband', '@modemband[0]', 'notify'));
if ( ax.length >= 1 ) {
if ( nuser != '1' || nuser == null ) {
ui.addNotification(null, E('p', _('The new bands settings have been sent to the modem. If the changes are not visible, a restart of the connection, modem or router may be required.')), 'info');
}
}
if (wrestart == '1') {
fs.exec('/sbin/ifdown', [ wname ]);
fs.exec('sleep 3');
@@ -33,7 +33,7 @@ return view.extend({
o.noaliases = false;
o.default = 'wan';
*/
o = s.option(widgets.NetworkSelect, 'iface', _('Interface'),
_('Network interface for Internet access.')
);
@@ -42,11 +42,11 @@ return view.extend({
o.rmempty = false;
o.default = 'wan';
o = s.option(form.Value, 'set_port', _('Port for communication with the modem'),
o = s.option(form.Value, 'set_port', _('Port for communication with the modem'),
_("Select one of the available ttyUSBX ports."));
devs.sort((a, b) => a.name > b.name);
devs.forEach(dev => o.value('/dev/' + dev.name));
o.placeholder = _('Please select a port');
o.rmempty = false;
@@ -8,7 +8,7 @@
/*
Copyright 2022-2024 Rafał Wabik - IceG - From eko.one.pl forum
MIT License
*/