Welcome to ethernet
This commit is contained in:
parent
896becce45
commit
3620e93ae6
@ -7,18 +7,18 @@
|
|||||||
<div class="container interfaces-container">
|
<div class="container interfaces-container">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-6">
|
<div class="column col-6">
|
||||||
<span class="interface-label">First interface</span>
|
<span class="interface-label">Wireless AP interface</span>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-group btn-group-block">
|
<div class="btn-group btn-group-block">
|
||||||
<button class="btn btn-sm btn-iface" @click="change_interface('in', iface)" :class="iface == config.network.in ? 'active' : ''" v-for="iface in config.interfaces" :key="iface">{{ iface.toUpperCase() }}</button>
|
<button class="btn btn-sm btn-iface" @click="change_interface('in', iface)" :class="iface == config.network.in ? 'active' : ''" v-for="iface in config.ifaces_in" :key="iface">{{ iface.toUpperCase() }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6">
|
<div class="column col-6">
|
||||||
<span class="interface-label">Second interface</span>
|
<span class="interface-label">Internet link interface</span>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-group btn-group-block">
|
<div class="btn-group btn-group-block">
|
||||||
<button class="btn btn-sm btn-iface" @click="change_interface('out', iface)" :class="iface == config.network.out ? 'active' : ''" v-for="iface in config.interfaces" :key="iface">{{ iface.toUpperCase() }}</button>
|
<button class="btn btn-sm btn-iface" @click="change_interface('out', iface)" :class="iface == config.network.out ? 'active' : ''" v-for="iface in config.ifaces_out" :key="iface">{{ iface.toUpperCase() }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
160
app/frontend/package-lock.json
generated
160
app/frontend/package-lock.json
generated
@ -1806,6 +1806,16 @@
|
|||||||
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
|
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cacache": {
|
"cacache": {
|
||||||
"version": "13.0.1",
|
"version": "13.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz",
|
||||||
@ -1832,6 +1842,34 @@
|
|||||||
"unique-filename": "^1.1.1"
|
"unique-filename": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chalk": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"find-cache-dir": {
|
"find-cache-dir": {
|
||||||
"version": "3.3.1",
|
"version": "3.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
|
||||||
@ -1853,6 +1891,25 @@
|
|||||||
"path-exists": "^4.0.0"
|
"path-exists": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"loader-utils": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"big.js": "^5.2.2",
|
||||||
|
"emojis-list": "^3.0.0",
|
||||||
|
"json5": "^2.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"locate-path": {
|
"locate-path": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||||
@ -1917,6 +1974,16 @@
|
|||||||
"minipass": "^3.1.1"
|
"minipass": "^3.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"terser-webpack-plugin": {
|
"terser-webpack-plugin": {
|
||||||
"version": "2.3.8",
|
"version": "2.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
|
||||||
@ -1933,6 +2000,18 @@
|
|||||||
"terser": "^4.6.12",
|
"terser": "^4.6.12",
|
||||||
"webpack-sources": "^1.4.3"
|
"webpack-sources": "^1.4.3"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"vue-loader-v16": {
|
||||||
|
"version": "npm:vue-loader@16.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
|
||||||
|
"integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "^4.1.0",
|
||||||
|
"hash-sum": "^2.0.0",
|
||||||
|
"loader-utils": "^2.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -11257,87 +11336,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vue-loader-v16": {
|
|
||||||
"version": "npm:vue-loader@16.0.0-rc.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-rc.1.tgz",
|
|
||||||
"integrity": "sha512-yR+BS90EOXTNieasf8ce9J3TFCpm2DGqoqdbtiwQ33hon3FyIznLX7sKavAq1VmfBnOeV6It0Htg4aniv8ph1g==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"hash-sum": "^2.0.0",
|
|
||||||
"loader-utils": "^2.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chalk": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^4.1.0",
|
|
||||||
"supports-color": "^7.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"loader-utils": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"big.js": "^5.2.2",
|
|
||||||
"emojis-list": "^3.0.0",
|
|
||||||
"json5": "^2.1.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vue-router": {
|
"vue-router": {
|
||||||
"version": "3.4.3",
|
"version": "3.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz",
|
||||||
|
@ -11,13 +11,21 @@ import router from '../router'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
props: { saved_ssid: String, list_ssids: Array, internet: Boolean },
|
props: { saved_ssid: String, iface_out: String, list_ssids: Array, internet: Boolean },
|
||||||
methods: {
|
methods: {
|
||||||
next: function() {
|
next: function() {
|
||||||
var saved_ssid = this.saved_ssid
|
var saved_ssid = this.saved_ssid
|
||||||
var list_ssids = this.list_ssids
|
var list_ssids = this.list_ssids
|
||||||
var internet = this.internet
|
var internet = this.internet
|
||||||
router.push({ name: 'wifi-select', params: { saved_ssid: saved_ssid, list_ssids: list_ssids, internet:internet } });
|
console.log(this.iface_out)
|
||||||
|
if (this.iface_out.charAt(0) == "e"){
|
||||||
|
router.push({ name: 'generate-ap' });
|
||||||
|
} else {
|
||||||
|
router.push({ name: 'wifi-select',
|
||||||
|
params: { saved_ssid: saved_ssid,
|
||||||
|
list_ssids: list_ssids,
|
||||||
|
internet:internet } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,35 +15,58 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list_ssids: [],
|
list_ssids: [],
|
||||||
internet: false
|
internet: false,
|
||||||
|
iface_out:""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// Check if the device is already connected to internet.
|
// Check if the device is connected to internet.
|
||||||
internet_check: function() {
|
internet_check: function() {
|
||||||
axios.get(`/api/network/status`, { timeout: 10000 })
|
axios.get(`/api/network/status`, { timeout: 10000 })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.internet) this.internet = true
|
if (response.data.internet){
|
||||||
this.get_wifi_networks()
|
this.internet = true
|
||||||
|
this.load_config()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(err => (console.log(err)))
|
.catch(err => (console.log(err)))
|
||||||
},
|
},
|
||||||
// Get the WiFi networks around the box.
|
// Get the WiFi networks around the box.
|
||||||
get_wifi_networks: function() {
|
get_wifi_networks: function() {
|
||||||
axios.get(`/api/network/wifi/list`, { timeout: 10000 })
|
axios.get(`/api/network/wifi/list`, { timeout: 10000 })
|
||||||
.then(response => (this.append_ssids(response.data.networks)))
|
.then(response => {
|
||||||
|
this.list_ssids = response.data.networks
|
||||||
|
this.goto_home();
|
||||||
|
})
|
||||||
.catch(err => (console.log(err)))
|
.catch(err => (console.log(err)))
|
||||||
},
|
},
|
||||||
// Handle the get_wifi_networks answer and call goto_home.
|
// Forward the view to home, with some props
|
||||||
append_ssids: function(networks) {
|
// such as (SSIDs, internet & interface)
|
||||||
this.list_ssids = networks
|
|
||||||
this.goto_home()
|
|
||||||
},
|
|
||||||
// Pass the list of ssids and the internet status as a prop to the home view.
|
|
||||||
goto_home: function() {
|
goto_home: function() {
|
||||||
var list_ssids = this.list_ssids
|
var list_ssids = this.list_ssids
|
||||||
var internet = this.internet
|
var internet = this.internet
|
||||||
router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet } });
|
var iface_out = this.iface_out
|
||||||
|
router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet, iface_out : iface_out } });
|
||||||
|
},
|
||||||
|
// Get the network_out from the config
|
||||||
|
// to determine the next steps.
|
||||||
|
load_config: function() {
|
||||||
|
axios.get(`/api/misc/config`, { timeout: 60000 })
|
||||||
|
.then(response => {
|
||||||
|
if(response.data.iface_out){
|
||||||
|
this.iface_out = response.data.iface_out
|
||||||
|
// If ethernet, just goto the homepage.
|
||||||
|
// Else, get wifi networks and then go to home.
|
||||||
|
if(this.iface_out.charAt(0) == "e"){
|
||||||
|
setTimeout(function () { this.goto_home(); }.bind(this), 1000);
|
||||||
|
} else {
|
||||||
|
this.get_wifi_networks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function() {
|
created: function() {
|
||||||
|
@ -344,7 +344,7 @@ check_interfaces(){
|
|||||||
# Wi-Fi interface with AP mode available.
|
# Wi-Fi interface with AP mode available.
|
||||||
for iface in $IFACES;
|
for iface in $IFACES;
|
||||||
do
|
do
|
||||||
if echo "$iface" | grep -Eq "(wlan[0-9]|wlx[a-f0-9]{12})"; then
|
if echo "$iface" | grep -Eq "(wlan[0-9]|wl[a-z0-9]{20})"; then
|
||||||
config="$(ifconfig $iface)" # Get the iface logic configuration
|
config="$(ifconfig $iface)" # Get the iface logic configuration
|
||||||
if echo "$config" | grep -qv "inet "; then # Test if not currently connected
|
if echo "$config" | grep -qv "inet "; then # Test if not currently connected
|
||||||
hw="$(iw $iface info | grep wiphy | cut -d" " -f2)" # Get the iface hardware id.
|
hw="$(iw $iface info | grep wiphy | cut -d" " -f2)" # Get the iface hardware id.
|
||||||
|
@ -32,7 +32,8 @@ class Config(object):
|
|||||||
"""
|
"""
|
||||||
config = yaml.load(
|
config = yaml.load(
|
||||||
open(os.path.join(self.dir, "config.yaml"), "r"), Loader=yaml.SafeLoader)
|
open(os.path.join(self.dir, "config.yaml"), "r"), Loader=yaml.SafeLoader)
|
||||||
config["interfaces"] = self.get_wireless_interfaces()
|
config["ifaces_in"] = self.get_ifaces_in()
|
||||||
|
config["ifaces_out"] = self.get_ifaces_out()
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def write_config(self, cat, key, value):
|
def write_config(self, cat, key, value):
|
||||||
@ -55,10 +56,14 @@ class Config(object):
|
|||||||
|
|
||||||
# Changes for network interfaces.
|
# Changes for network interfaces.
|
||||||
if cat == "network" and key in ["in", "out"]:
|
if cat == "network" and key in ["in", "out"]:
|
||||||
if re.match("^(wlan[0-9]|wlx[a-f0-9]{12})$", value):
|
if re.match("^(wlan[0-9]|wl[a-z0-9]{20})$", value):
|
||||||
if key == "in":
|
if key == "in":
|
||||||
self.edit_configuration_files(value)
|
self.edit_configuration_files(value)
|
||||||
config[cat][key] = value
|
config[cat][key] = value
|
||||||
|
if key == "out":
|
||||||
|
config[cat][key] = value
|
||||||
|
elif re.match("^(eth[0-9]|en[a-z0-9]{20})$", value) and key == "out":
|
||||||
|
config[cat][key] = value
|
||||||
else:
|
else:
|
||||||
return {"status": False,
|
return {"status": False,
|
||||||
"message": "Wrong value specified"}
|
"message": "Wrong value specified"}
|
||||||
@ -114,15 +119,27 @@ class Config(object):
|
|||||||
as_attachment=True,
|
as_attachment=True,
|
||||||
attachment_filename='tinycheck-export-db.sqlite')
|
attachment_filename='tinycheck-export-db.sqlite')
|
||||||
|
|
||||||
def get_wireless_interfaces(self):
|
def get_ifaces_in(self):
|
||||||
"""
|
"""
|
||||||
List the Wireless interfaces installed on the box
|
List the Wireless interfaces on the box
|
||||||
|
which can be used as Access Points.
|
||||||
:return: list of the interfaces
|
:return: list of the interfaces
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return [i for i in os.listdir("/sys/class/net/") if i.startswith(("wlan", "wlx"))]
|
return [i for i in os.listdir("/sys/class/net/") if i.startswith("wl")]
|
||||||
except:
|
except:
|
||||||
return ["Interface not found", "Interface not found"]
|
return ["No wireless interface"]
|
||||||
|
|
||||||
|
def get_ifaces_out(self):
|
||||||
|
"""
|
||||||
|
List the network interfaces on the box
|
||||||
|
which can be used to access to Internet.
|
||||||
|
:return: list of the interfaces
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return [i for i in os.listdir("/sys/class/net/") if i.startswith(("wl", "et"))]
|
||||||
|
except:
|
||||||
|
return ["No network interfaces"]
|
||||||
|
|
||||||
def edit_configuration_files(self, iface):
|
def edit_configuration_files(self, iface):
|
||||||
"""
|
"""
|
||||||
|
@ -56,5 +56,6 @@ def get_config():
|
|||||||
"sparklines": read_config(("frontend", "sparklines")),
|
"sparklines": read_config(("frontend", "sparklines")),
|
||||||
"quit_option": read_config(("frontend", "quit_option")),
|
"quit_option": read_config(("frontend", "quit_option")),
|
||||||
"shutdown_option": read_config(("frontend", "shutdown_option")),
|
"shutdown_option": read_config(("frontend", "shutdown_option")),
|
||||||
"reboot_option": read_config(("frontend", "reboot_option"))
|
"reboot_option": read_config(("frontend", "reboot_option")),
|
||||||
|
"iface_out": read_config(("network", "iface_out"))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user