luci-app-travelmate: sync with travelmate 2.1.2-1
* fix a station scanning issue on single radio units (mainly a LuCI/JS issue) reported in the forum by multiple users Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
c5271fddb3
commit
465cea44e3
2 changed files with 103 additions and 102 deletions
|
@ -145,7 +145,7 @@ function handleStatus() {
|
||||||
poll.add(function () {
|
poll.add(function () {
|
||||||
L.resolveDefault(fs.stat('/var/state/travelmate.refresh'), null).then(function (res) {
|
L.resolveDefault(fs.stat('/var/state/travelmate.refresh'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
L.resolveDefault(fs.read_direct('/var/state/travelmate.refresh'), null).then(async function (res) {
|
L.resolveDefault(fs.read('/var/state/travelmate.refresh'), null).then(async function (res) {
|
||||||
fs.remove('/var/state/travelmate.refresh');
|
fs.remove('/var/state/travelmate.refresh');
|
||||||
if (res && res === 'ui_reload') {
|
if (res && res === 'ui_reload') {
|
||||||
location.reload();
|
location.reload();
|
||||||
|
@ -172,7 +172,7 @@ function handleStatus() {
|
||||||
});
|
});
|
||||||
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (res) {
|
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
L.resolveDefault(fs.read_direct('/tmp/trm_runtime.json'), null).then(function (res) {
|
L.resolveDefault(fs.read('/tmp/trm_runtime.json'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
var info = JSON.parse(res);
|
var info = JSON.parse(res);
|
||||||
if (info) {
|
if (info) {
|
||||||
|
@ -229,7 +229,7 @@ function handleStatus() {
|
||||||
return view.extend({
|
return view.extend({
|
||||||
load: function () {
|
load: function () {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
L.resolveDefault(fs.exec_direct('/etc/init.d/travelmate', ['assoc']), {}),
|
L.resolveDefault(fs.exec('/etc/init.d/travelmate', ['assoc']), null),
|
||||||
uci.load('wireless'),
|
uci.load('wireless'),
|
||||||
uci.load('travelmate')
|
uci.load('travelmate')
|
||||||
]);
|
]);
|
||||||
|
@ -488,8 +488,8 @@ return view.extend({
|
||||||
modal travelmate tab
|
modal travelmate tab
|
||||||
*/
|
*/
|
||||||
var mac, mac_array = [];
|
var mac, mac_array = [];
|
||||||
if (result[0]) {
|
if (result[0] && result[0].code === 0) {
|
||||||
mac_array = result[0].trim().split('\n');
|
mac_array = result[0].stdout.trim().split('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
o = s.taboption('travelmate', form.Value, '_ssid', _('SSID'));
|
o = s.taboption('travelmate', form.Value, '_ssid', _('SSID'));
|
||||||
|
@ -748,6 +748,7 @@ return view.extend({
|
||||||
modal 'scan' dialog
|
modal 'scan' dialog
|
||||||
*/
|
*/
|
||||||
s.handleScan = function (radio) {
|
s.handleScan = function (radio) {
|
||||||
|
poll.stop();
|
||||||
var table = E('table', { 'class': 'table' }, [
|
var table = E('table', { 'class': 'table' }, [
|
||||||
E('tr', { 'class': 'tr table-titles' }, [
|
E('tr', { 'class': 'tr table-titles' }, [
|
||||||
E('th', { 'class': 'th col-1 middle left' }, _('Strength')),
|
E('th', { 'class': 'th col-1 middle left' }, _('Strength')),
|
||||||
|
@ -778,107 +779,106 @@ return view.extend({
|
||||||
md.style.maxWidth = '90%';
|
md.style.maxWidth = '90%';
|
||||||
md.style.maxHeight = 'none';
|
md.style.maxHeight = 'none';
|
||||||
|
|
||||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/travelmate', ['scan', radio]), null)
|
return L.resolveDefault(fs.exec('/etc/init.d/travelmate', ['scan', radio]), null)
|
||||||
.then(L.bind(function (res) {
|
.then(L.bind(function () {
|
||||||
var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
|
return L.resolveDefault(fs.read('/var/run/travelmate.scan'), '')
|
||||||
if (res) {
|
.then(L.bind(function (res) {
|
||||||
lines = res.trim().split('\n');
|
var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
|
||||||
for (var i = 0; i < lines.length; i++) {
|
if (res) {
|
||||||
if (lines[i].match(/^\s+[0-9]/)) {
|
lines = res.split('\n');
|
||||||
encryption = lines[i].slice(80).trim();
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!encryption.includes('WEP')) {
|
if (lines[i].match(/^\s+[0-9]/)) {
|
||||||
strength = lines[i].slice(4, 7).trim();
|
encryption = lines[i].slice(80).trim();
|
||||||
channel = lines[i].slice(15, 18).trim();
|
if (!encryption.includes('WEP')) {
|
||||||
bssid = lines[i].slice(60, 77).trim();
|
strength = lines[i].slice(4, 7).trim();
|
||||||
ssid = lines[i].slice(25, 59).trim();
|
channel = lines[i].slice(15, 18).trim();
|
||||||
if (ssid.startsWith('"')) {
|
bssid = lines[i].slice(60, 77).trim();
|
||||||
ssid = ssid.slice(1, ssid.length - 1);
|
ssid = lines[i].slice(25, 59).trim();
|
||||||
tbl_ssid = ssid;
|
if (ssid.startsWith('"')) {
|
||||||
|
ssid = ssid.slice(1, ssid.length - 1);
|
||||||
|
tbl_ssid = ssid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ssid = "hidden";
|
||||||
|
tbl_ssid = "<em>hidden</em>";
|
||||||
|
}
|
||||||
|
switch (encryption) {
|
||||||
|
case 'WPA3 PSK (SAE)':
|
||||||
|
encryption = 'sae';
|
||||||
|
tbl_encryption = 'WPA3 Pers. (SAE)';
|
||||||
|
break;
|
||||||
|
case 'mixed WPA2/WPA3 PSK/SAE (CCMP)':
|
||||||
|
encryption = 'sae-mixed';
|
||||||
|
tbl_encryption = 'WPA2/WPA3 Pers. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA2 PSK (CCMP)':
|
||||||
|
encryption = 'psk2+ccmp';
|
||||||
|
tbl_encryption = 'WPA2 Pers. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA2 PSK (TKIP)':
|
||||||
|
encryption = 'psk2+tkip';
|
||||||
|
tbl_encryption = 'WPA2 Pers. (TKIP)';
|
||||||
|
break;
|
||||||
|
case 'mixed WPA/WPA2 PSK (TKIP, CCMP)':
|
||||||
|
encryption = 'psk-mixed+ccmp';
|
||||||
|
tbl_encryption = 'WPA/WPA2 Pers. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA PSK (CCMP)':
|
||||||
|
encryption = 'psk2+ccmp';
|
||||||
|
tbl_encryption = 'WPA Pers. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA PSK (TKIP)':
|
||||||
|
encryption = 'psk2+tkip';
|
||||||
|
tbl_encryption = 'WPA Pers. (TKIP)';
|
||||||
|
break;
|
||||||
|
case 'WPA3 802.1X (CCMP)':
|
||||||
|
encryption = 'wpa3';
|
||||||
|
tbl_encryption = 'WPA3 Ent. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'mixed WPA2/WPA3 802.1X (CCMP)':
|
||||||
|
encryption = 'wpa3-mixed';
|
||||||
|
tbl_encryption = 'WPA2/WPA3 Ent. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA2 802.1X':
|
||||||
|
encryption = 'wpa2';
|
||||||
|
tbl_encryption = 'WPA2 Ent.';
|
||||||
|
break;
|
||||||
|
case 'WPA2 802.1X (CCMP)':
|
||||||
|
encryption = 'wpa2+ccmp';
|
||||||
|
tbl_encryption = 'WPA2 Ent. (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'WPA3 OWE (CCMP)':
|
||||||
|
encryption = 'owe';
|
||||||
|
tbl_encryption = 'WPA3 OWE (CCMP)';
|
||||||
|
break;
|
||||||
|
case 'none':
|
||||||
|
encryption = 'none';
|
||||||
|
tbl_encryption = 'none';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rows.push([
|
||||||
|
strength,
|
||||||
|
channel,
|
||||||
|
tbl_ssid,
|
||||||
|
bssid,
|
||||||
|
tbl_encryption,
|
||||||
|
E('div', { 'class': 'right' }, E('button', {
|
||||||
|
'class': 'cbi-button cbi-button-action',
|
||||||
|
'click': ui.createHandlerFn(this, 'handleAdd', radio, iface, ssid, bssid, encryption)
|
||||||
|
}, _('Add Uplink...')))
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
ssid = "hidden";
|
|
||||||
tbl_ssid = "<em>hidden</em>";
|
|
||||||
}
|
|
||||||
switch (encryption) {
|
|
||||||
case 'WPA3 PSK (SAE)':
|
|
||||||
encryption = 'sae';
|
|
||||||
tbl_encryption = 'WPA3 Pers. (SAE)';
|
|
||||||
break;
|
|
||||||
case 'mixed WPA2/WPA3 PSK/SAE (CCMP)':
|
|
||||||
encryption = 'sae-mixed';
|
|
||||||
tbl_encryption = 'WPA2/WPA3 Pers. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA2 PSK (CCMP)':
|
|
||||||
encryption = 'psk2+ccmp';
|
|
||||||
tbl_encryption = 'WPA2 Pers. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA2 PSK (TKIP)':
|
|
||||||
encryption = 'psk2+tkip';
|
|
||||||
tbl_encryption = 'WPA2 Pers. (TKIP)';
|
|
||||||
break;
|
|
||||||
case 'mixed WPA/WPA2 PSK (TKIP, CCMP)':
|
|
||||||
encryption = 'psk-mixed+ccmp';
|
|
||||||
tbl_encryption = 'WPA/WPA2 Pers. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA PSK (CCMP)':
|
|
||||||
encryption = 'psk2+ccmp';
|
|
||||||
tbl_encryption = 'WPA Pers. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA PSK (TKIP)':
|
|
||||||
encryption = 'psk2+tkip';
|
|
||||||
tbl_encryption = 'WPA Pers. (TKIP)';
|
|
||||||
break;
|
|
||||||
case 'WPA3 802.1X (CCMP)':
|
|
||||||
encryption = 'wpa3';
|
|
||||||
tbl_encryption = 'WPA3 Ent. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'mixed WPA2/WPA3 802.1X (CCMP)':
|
|
||||||
encryption = 'wpa3-mixed';
|
|
||||||
tbl_encryption = 'WPA2/WPA3 Ent. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA2 802.1X':
|
|
||||||
encryption = 'wpa2';
|
|
||||||
tbl_encryption = 'WPA2 Ent.';
|
|
||||||
break;
|
|
||||||
case 'WPA2 802.1X (CCMP)':
|
|
||||||
encryption = 'wpa2+ccmp';
|
|
||||||
tbl_encryption = 'WPA2 Ent. (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'WPA3 OWE (CCMP)':
|
|
||||||
encryption = 'owe';
|
|
||||||
tbl_encryption = 'WPA3 OWE (CCMP)';
|
|
||||||
break;
|
|
||||||
case 'none':
|
|
||||||
encryption = 'none';
|
|
||||||
tbl_encryption = 'none';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
rows.push([
|
|
||||||
strength,
|
|
||||||
channel,
|
|
||||||
tbl_ssid,
|
|
||||||
bssid,
|
|
||||||
tbl_encryption,
|
|
||||||
E('div', { 'class': 'right' }, E('button', {
|
|
||||||
'class': 'cbi-button cbi-button-action',
|
|
||||||
'click': ui.createHandlerFn(this, 'handleAdd', radio, iface, ssid, bssid, encryption)
|
|
||||||
}, _('Add Uplink...')))
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lines[i] === '::: Empty resultset') {
|
else {
|
||||||
rows.push([
|
rows.push([
|
||||||
'No scan results (empty resultset)'
|
'Empty resultset'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
cbi_update_table(table, rows);
|
||||||
}
|
poll.start();
|
||||||
else {
|
}, this));
|
||||||
rows.push([
|
|
||||||
'No scan results (timeout)'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
cbi_update_table(table, rows);
|
|
||||||
}, this));
|
}, this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"file": {
|
"file": {
|
||||||
"/etc/travelmate/*.login": [ "list" ],
|
"/etc/travelmate/*.login": [ "list" ],
|
||||||
"/var/run/travelmate.pid": [ "read" ],
|
"/var/run/travelmate.pid": [ "read" ],
|
||||||
|
"/var/run/travelmate.scan": [ "read" ],
|
||||||
"/var/state/travelmate.refresh": [ "read" ],
|
"/var/state/travelmate.refresh": [ "read" ],
|
||||||
"/tmp/trm_runtime.json": [ "read" ],
|
"/tmp/trm_runtime.json": [ "read" ],
|
||||||
"/sbin/logread -e trm-": [ "exec" ],
|
"/sbin/logread -e trm-": [ "exec" ],
|
||||||
|
|
Loading…
Reference in a new issue