summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/htdocs/luci-static/resources
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-travelmate/htdocs/luci-static/resources')
-rw-r--r--applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js42
-rw-r--r--applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js29
-rw-r--r--applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js215
3 files changed, 130 insertions, 156 deletions
diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js
index d004ed4d2f..fc9323aa14 100644
--- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js
+++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js
@@ -1,42 +1,4 @@
'use strict';
-'require view';
-'require poll';
-'require fs';
+'require tools.views as views';
-return view.extend({
- load: function() {
- return Promise.all([
- L.resolveDefault(fs.stat('/sbin/logread'), null),
- L.resolveDefault(fs.stat('/usr/sbin/logread'), null)
- ]);
- },
- render: function(stat) {
- var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
- poll.add(function() {
- return L.resolveDefault(fs.exec_direct(logger, ['-e', 'trm-'])).then(function(res) {
- var log = document.getElementById("logfile");
- if (res) {
- log.value = res.trim();
- }
- else {
- log.value = _('No travelmate related logs yet!');
- }
- log.scrollTop = log.scrollHeight;
- });
- });
- return E('div', { class: 'cbi-map' },
- E('div', { class: 'cbi-section' }, [
- E('div', { class: 'cbi-section-descr' }, _('The syslog output, pre-filtered for travelmate related messages only.')),
- E('textarea', {
- 'id': 'logfile',
- 'style': 'width: 100% !important; padding: 5px; font-family: monospace',
- 'readonly': 'readonly',
- 'wrap': 'off',
- 'rows': 25
- })
- ]));
- },
- handleSaveApply: null,
- handleSave: null,
- handleReset: null
-});
+return views.LogreadBox("trm-", "travelmate");
diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
index a8069135a0..dc291c7538 100644
--- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
+++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
@@ -316,16 +316,26 @@ return view.extend({
o.rmempty = false;
o = s.taboption('general', form.Flag, 'trm_vpn', _('VPN processing'), _('VPN connections will be managed by travelmate.'));
- o.default = 1;
+ o.default = 0;
o.rmempty = false;
o = s.taboption('general', widgets.NetworkSelect, 'trm_vpnifacelist', _('Limit VPN processing'), _('Limit VPN processing to certain interfaces.'));
o.depends('trm_vpn', '1');
- o.unspecified = true;
o.multiple = true;
o.nocreate = true;
o.rmempty = true;
+ o = s.taboption('general', form.Value, 'trm_stdvpnservice', _('Standard VPN Service'), _('Standard VPN service which will be automatically added to new STA profiles.'));
+ o.depends('trm_vpn', '1');
+ o.value('wireguard');
+ o.value('openvpn');
+ o.rmempty = true;
+
+ o = s.taboption('general', widgets.NetworkSelect, 'trm_stdvpniface', _('Standard VPN interface'), _('Standard VPN interface which will be automatically added to new STA profiles.'));
+ o.depends('trm_vpn', '1');
+ o.nocreate = true;
+ o.rmempty = true;
+
o = s.taboption('general', form.Flag, 'trm_netcheck', _('Net Error Check'), _('Treat missing internet availability as an error.'));
o.depends('trm_captive', '1');
o.default = 0;
@@ -377,11 +387,6 @@ return view.extend({
o.datatype = 'range(30,300)';
o.rmempty = true;
- o = s.taboption('additional', form.Value, 'trm_maxscan', _('Scan Limit'), _('Limit the nearby scan results to process only the strongest uplinks.'));
- o.placeholder = '10';
- o.datatype = 'range(1,30)';
- o.rmempty = true;
-
o = s.taboption('additional', form.ListValue, 'trm_captiveurl', _('Captive Portal URL'), _('The selected URL will be used for connectivity- and captive portal checks.'));
o.value('http://detectportal.firefox.com', 'Firefox (default)');
o.value('http://connectivity-check.ubuntu.com', 'Ubuntu');
@@ -392,11 +397,11 @@ return view.extend({
o.rmempty = true;
o = s.taboption('additional', form.ListValue, 'trm_useragent', _('User Agent'), _('The selected user agent will be used for connectivity- and captive portal checks.'));
- o.value('Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0', 'Firefox (default)');
- o.value('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36', 'Chromium');
- o.value('Mozilla/5.0 (Macintosh; Intel Mac OS X 11_5_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15', 'Safari');
- o.value('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.55', 'Edge');
- o.value('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 OPR/77.0.4054.277', 'Opera');
+ o.value('Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0', 'Firefox (default)');
+ o.value('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'Chromium');
+ o.value('Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'Safari');
+ o.value('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61', 'Edge');
+ o.value('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 OPR/103.0.0.0', 'Opera');
o.optional = true;
o.rmempty = true;
diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
index fcd98fa37f..5bc5bf4951 100644
--- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
+++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
@@ -70,6 +70,7 @@ function handleSectionsAdd(iface) {
w_sections = uci.sections('wireless', 'wifi-iface');
t_sections = uci.sections('travelmate', 'uplink');
+
for (var i = 0; i < w_sections.length; i++) {
if (w_sections[i].mode !== 'sta' || w_sections[i].network !== iface) {
continue;
@@ -82,13 +83,21 @@ function handleSectionsAdd(iface) {
}
}
if (match === false) {
+ var vpn_stdservice = uci.get('travelmate', 'global', 'trm_stdvpnservice');
+ var vpn_stdiface = uci.get('travelmate', 'global', 'trm_stdvpniface');
var sid = uci.add('travelmate', 'uplink');
+
uci.set('travelmate', sid, 'enabled', '1');
uci.set('travelmate', sid, 'device', w_sections[i].device);
uci.set('travelmate', sid, 'ssid', w_sections[i].ssid);
uci.set('travelmate', sid, 'bssid', w_sections[i].bssid);
uci.set('travelmate', sid, 'con_start_expiry', '0');
uci.set('travelmate', sid, 'con_end_expiry', '0');
+ if (vpn_stdservice && vpn_stdiface) {
+ uci.set('travelmate', sid, 'vpn', '1');
+ uci.set('travelmate', sid, 'vpnservice', vpn_stdservice);
+ uci.set('travelmate', sid, 'vpniface', vpn_stdiface);
+ }
}
}
}
@@ -136,7 +145,7 @@ function handleStatus() {
poll.add(function () {
L.resolveDefault(fs.stat('/var/state/travelmate.refresh'), null).then(function (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');
if (res && res === 'ui_reload') {
location.reload();
@@ -163,7 +172,7 @@ function handleStatus() {
});
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (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) {
var info = JSON.parse(res);
if (info) {
@@ -220,7 +229,7 @@ function handleStatus() {
return view.extend({
load: function () {
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('travelmate')
]);
@@ -334,7 +343,7 @@ return view.extend({
cfgvalue = 'WPA2 Pers. (CCMP)';
break;
case 'psk2+tkip':
- cfgvalue = 'WPA2 Ent. (TKIP)';
+ cfgvalue = 'WPA2 Pers. (TKIP)';
break;
case 'psk':
cfgvalue = 'WPA Pers.';
@@ -479,8 +488,8 @@ return view.extend({
modal travelmate tab
*/
var mac, mac_array = [];
- if (result[0]) {
- mac_array = result[0].trim().split('\n');
+ if (result[0] && result[0].code === 0) {
+ mac_array = result[0].stdout.trim().split('\n');
}
o = s.taboption('travelmate', form.Value, '_ssid', _('SSID'));
@@ -557,7 +566,6 @@ return view.extend({
o.ucisection = 'uplink';
o.ucioption = 'macaddr';
o.nocreate = false;
- o.unspecified = true;
o.rmempty = true;
o.datatype = 'macaddr';
o.cfgvalue = function (section_id) {
@@ -699,7 +707,6 @@ return view.extend({
}
o = s.taboption('vpn', widgets.NetworkSelect, '_vpniface', _('VPN Interface'), _('The logical vpn network interface like \'wg0\'.'));
- o.unspecified = false;
o.nocreate = true;
o.optional = true;
o.modalonly = true;
@@ -741,6 +748,7 @@ return view.extend({
modal 'scan' dialog
*/
s.handleScan = function (radio) {
+ poll.stop();
var table = E('table', { 'class': 'table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th col-1 middle left' }, _('Strength')),
@@ -771,107 +779,106 @@ return view.extend({
md.style.maxWidth = '90%';
md.style.maxHeight = 'none';
- return L.resolveDefault(fs.exec_direct('/etc/init.d/travelmate', ['scan', radio]), null)
- .then(L.bind(function (res) {
- var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
- if (res) {
- lines = res.trim().split('\n');
- for (var i = 0; i < lines.length; i++) {
- if (lines[i].match(/^\s+[0-9]/)) {
- encryption = lines[i].slice(80).trim();
- if (!encryption.includes('WEP')) {
- strength = lines[i].slice(4, 7).trim();
- channel = lines[i].slice(15, 18).trim();
- bssid = lines[i].slice(60, 77).trim();
- ssid = lines[i].slice(25, 59).trim();
- 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;
+ return L.resolveDefault(fs.exec('/etc/init.d/travelmate', ['scan', radio]), null)
+ .then(L.bind(function () {
+ return L.resolveDefault(fs.read('/var/run/travelmate.scan'), '')
+ .then(L.bind(function (res) {
+ var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
+ if (res) {
+ lines = res.split('\n');
+ for (var i = 0; i < lines.length; i++) {
+ if (lines[i].match(/^\s+[0-9]/)) {
+ encryption = lines[i].slice(80).trim();
+ if (!encryption.includes('WEP')) {
+ strength = lines[i].slice(4, 7).trim();
+ channel = lines[i].slice(15, 18).trim();
+ bssid = lines[i].slice(60, 77).trim();
+ ssid = lines[i].slice(25, 59).trim();
+ 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...')))
+ ]);
+ }
}
- 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([
- 'No scan results (empty resultset)'
+ 'Empty resultset'
]);
}
- }
- }
- else {
- rows.push([
- 'No scan results (timeout)'
- ]);
- }
- cbi_update_table(table, rows);
+ cbi_update_table(table, rows);
+ poll.start();
+ }, this));
}, this));
};
@@ -992,7 +999,7 @@ return view.extend({
o2.depends({ encryption: 'sae', '!contains': true });
o2.depends({ encryption: 'owe', '!contains': true });
o2.depends({ encryption: 'wpa', '!contains': true });
- o2.depends({ encryption: 'psk', '!contains': true });
+ o2.depends({ encryption: 'psk', '!contains': true });
o2.value('', _('Disabled'));
o2.value('1', _('Optional'));
o2.value('2', _('Required'));