🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

@@ -0,0 +1,83 @@
'use strict';
'require form';
'require fs';
'require view';
'require uci';
'require ui';
'require tools.widgets as widgets'
/*
Copyright 2021-2024 Rafał Wabik - IceG - From eko.one.pl forum
Licensed to the GNU General Public License v3.0.
*/
return view.extend({
load: function() {
return fs.list('/dev').then(function(devs) {
return devs.filter(function(dev) {
return dev.name.match(/^ttyUSB/) || dev.name.match(/^cdc-wdm/) || dev.name.match(/^ttyACM/) || dev.name.match(/^mhi_/) || dev.name.match(/^wwan/);
});
});
},
render: function(devs) {
var m, s, o;
m = new form.Map('3ginfo', _('Configuration 3ginfo-lite'), _('Configuration panel for the 3ginfo-lite application.'));
s = m.section(form.TypedSection, '3ginfo', '', null);
s.anonymous = true;
/* Old config
o = s.option(widgets.DeviceSelect, 'network', _('Interface'),
_('Network interface for Internet access.')
);
o.noaliases = false;
o.default = 'wan';
o.rmempty = false;
*/
o = s.option(widgets.NetworkSelect, 'network', _('Interface'),
_('Network interface for Internet access.')
);
o.exclude = s.section;
o.nocreate = true;
o.rmempty = false;
o.default = 'wan';
o = s.option(form.Value, 'device',
_('IP adress / Port for communication with the modem'),
_("Select the appropriate settings. <br /> \
<br />Traditional modem. <br /> \
Select one of the available ttyUSBX ports.<br /> \
<br />HiLink modem. <br /> \
Enter the IP address 192.168.X.X under which the modem is available."));
devs.sort((a, b) => a.name > b.name);
devs.forEach(dev => o.value('/dev/' + dev.name));
o.placeholder = _('Please select a port');
o.rmempty = true;
s = m.section(form.TypedSection, '3ginfo', null);
s.anonymous = true;
s.addremove = false;
s.tab('bts1', _('BTS search settings'));
s.anonymous = true;
o = s.taboption('bts1', form.DummyValue, '_dummy');
o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' +
_('Hint: To set up a BTS search engine, all you have to do is select the dedicated website for your location.') +
'</div>';
o = s.taboption('bts1',form.ListValue, 'website', _('Website to search for BTS'),
_('Select a website for searching.')
);
o.value('http://www.btsearch.pl/szukaj.php?mode=std&search=', _('btsearch.pl'));
o.value('https://lteitaly.it/internal/map.php#bts=', _('lteitaly.it'));
o.default = 'http://www.btsearch.pl/szukaj.php?mode=std&search=';
o.modalonly = true;
return m.render();
}
});
@@ -0,0 +1,182 @@
'use strict';
'require view';
'require dom';
'require fs';
'require ui';
'require uci';
/*
Copyright 2021-2024 Rafał Wabik - IceG - From eko.one.pl forum
Licensed to the GNU General Public License v3.0.
*/
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('textarea');
out.style.display = '';
dom.content(out, [ res.stdout || '', res.stderr || '' ]);
fs.write('/tmp/debug_result.txt', [ res.stdout || '' ]);
}).catch(function(err) {
ui.addNotification(null, E('p', [ err ]))
}).finally(function() {
var viewbc = document.getElementById('clear');
viewbc.style.display = '';
var viewbd = document.getElementById('download');
viewbd.style.display = '';
for (var i = 0; i < buttons.length; i++)
buttons[i].removeAttribute('disabled');
});
},
handleUSB: function(ev, cmd) {
return this.handleCommand('/bin/cat', ['/sys/kernel/debug/usb/devices']);
},
handleTTY: function(ev, cmd) {
return this.handleCommand('/bin/ls', ['/dev']);
},
handleDBG: function(ev, cmd) {
return this.handleCommand('/bin/sh', ['-x', '/usr/share/3ginfo-lite/3ginfo.sh']);
},
handleClear: function(ev) {
var out = document.getElementById('pre');
out.style.display = 'none';
var viewbc = document.getElementById('clear');
viewbc.style.display = 'none';
var viewbd = document.getElementById('download');
viewbd.style.display = 'none';
fs.write('/tmp/debug_result.txt', '');
},
handleDownload: function(ev) {
return L.resolveDefault(fs.read_direct('/tmp/debug_result.txt'), null).then(function (res) {
if (res) {
var link = E('a', {
'download': 'debug_result.txt',
'href': URL.createObjectURL(
new Blob([ res ], { type: 'text/plain' })),
});
link.click();
URL.revokeObjectURL(link.href);
}
}).catch(() => {
ui.addNotification(null, E('p', {}, _('Download error') + ': ' + err.message));
});
},
load: function() {
return L.resolveDefault(uci.load('luci'));
},
render: function(res) {
var table = E('table', { 'class': 'table' }, [
E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td left', 'style': 'overflow:initial' }, [
E('label', { 'class': 'cbi-value-title' },
_("USB debug information")
),
E('p'),
E('label', { 'class': 'cbi-value-title' },
_("<code>cat /sys/kernel/debug/usb/devices</code>.")
),
E('p'),
E('span', { 'class': 'diag-action' }, [
E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handleUSB')
}, [ _('Show devices') ])
])
]),
E('td', { 'class': 'td left', 'style': 'overflow:initial' }, [
E('label', { 'class': 'cbi-value-title' },
_("Check availability of ttyX ports.")
),
E('p'),
E('label', { 'class': 'cbi-value-title' },
_("<code>ls /dev</code>.")
),
E('p'),
E('span', { 'class': 'diag-action' }, [
E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handleTTY')
}, [ _('Show devices') ])
])
]),
E('td', { 'class': 'td left' }, [
E('label', { 'class': 'cbi-value-title' },
_("Check data read by the 3ginfo scripts.")
),
E('p'),
E('label', { 'class': 'cbi-value-title' },
_("<code>sh -x /usr/share/3ginfo-lite/3ginfo.sh</code>.")
),
E('p'),
E('span', { 'class': 'diag-action' }, [
E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handleDBG')
}, [ _('Debug') ])
])
]),
])
]);
var info = _('More information about the 3ginfo on the %seko.one.pl forum%s.').format('<a href="https://eko.one.pl/?p=openwrt-3ginfo" target="_blank">', '</a>');
var view = E('div', { 'class': 'cbi-map'}, [
E('h2', {}, [ _('Diagnostics') ]),
E('div', { 'class': 'cbi-map-descr'}, _('Execution of various commands to check the availability of the modem and eliminate errors in the data collected by the scripts.') + '<br />' + info),
table,
E('hr'),
E('div', {'class': 'cbi-section'}, [
E('p'),
E('textarea', {
'id': 'pre',
'style':'display:none; border: 1px solid var(--border-color-medium); border-radius: 5px; font-family: monospace; font-size:12px; white-space:pre; width: 100%; resize: none;',
'readonly': true,
'wrap': 'off',
'rows': '25'
}, []),
E('p'),
E('div', { 'class': 'right' }, [
E('button', {
'class': 'cbi-button cbi-button-remove',
'id': 'clear',
'style': 'display:none',
'click': ui.createHandlerFn(this, 'handleClear')
}, [ _('Clear') ]),
'\xa0\xa0\xa0',
E('button', {
'class': 'cbi-button cbi-button-apply important',
'id': 'download',
'style': 'display:none',
'click': ui.createHandlerFn(this, 'handleDownload')
}, [ _('Download') ]),
]),
])
]);
return view;
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});
File diff suppressed because it is too large. Load diff