-
First interface
+
Wireless AP interface
-
Second interface
+
Internet link interface
diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json
index 8a1af8c..ebba075 100644
--- a/app/frontend/package-lock.json
+++ b/app/frontend/package-lock.json
@@ -1806,6 +1806,16 @@
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
"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": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz",
@@ -1832,6 +1842,34 @@
"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": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
@@ -1853,6 +1891,25 @@
"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": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
@@ -1917,6 +1974,16 @@
"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": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
@@ -1933,6 +2000,18 @@
"terser": "^4.6.12",
"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": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz",
diff --git a/app/frontend/src/views/home.vue b/app/frontend/src/views/home.vue
index f10c89c..5714ebd 100644
--- a/app/frontend/src/views/home.vue
+++ b/app/frontend/src/views/home.vue
@@ -11,14 +11,22 @@ import router from '../router'
export default {
name: 'home',
- props: { saved_ssid: String, list_ssids: Array, internet: Boolean },
+ props: { saved_ssid: String, iface_out: String, list_ssids: Array, internet: Boolean },
methods: {
next: function() {
var saved_ssid = this.saved_ssid
var list_ssids = this.list_ssids
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 } });
+ }
+ }
}
}
diff --git a/app/frontend/src/views/splash-screen.vue b/app/frontend/src/views/splash-screen.vue
index f68f91e..6b794e4 100644
--- a/app/frontend/src/views/splash-screen.vue
+++ b/app/frontend/src/views/splash-screen.vue
@@ -15,35 +15,58 @@
data() {
return {
list_ssids: [],
- internet: false
+ internet: false,
+ iface_out:""
}
},
methods: {
- // Check if the device is already connected to internet.
+ // Check if the device is connected to internet.
internet_check: function() {
axios.get(`/api/network/status`, { timeout: 10000 })
.then(response => {
- if (response.data.internet) this.internet = true
- this.get_wifi_networks()
+ if (response.data.internet){
+ this.internet = true
+ this.load_config()
+ }
})
.catch(err => (console.log(err)))
},
// Get the WiFi networks around the box.
get_wifi_networks: function() {
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)))
},
- // Handle the get_wifi_networks answer and call goto_home.
- append_ssids: function(networks) {
- this.list_ssids = networks
- this.goto_home()
- },
- // Pass the list of ssids and the internet status as a prop to the home view.
+ // Forward the view to home, with some props
+ // such as (SSIDs, internet & interface)
goto_home: function() {
var list_ssids = this.list_ssids
- var internet = this.internet
- router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet } });
+ var internet = this.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() {
diff --git a/install.sh b/install.sh
index 83751b2..121b51d 100644
--- a/install.sh
+++ b/install.sh
@@ -344,7 +344,7 @@ check_interfaces(){
# Wi-Fi interface with AP mode available.
for iface in $IFACES;
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
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.
diff --git a/server/backend/app/classes/config.py b/server/backend/app/classes/config.py
index cd187dc..3839543 100644
--- a/server/backend/app/classes/config.py
+++ b/server/backend/app/classes/config.py
@@ -32,7 +32,8 @@ class Config(object):
"""
config = yaml.load(
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
def write_config(self, cat, key, value):
@@ -55,9 +56,13 @@ class Config(object):
# Changes for network interfaces.
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":
self.edit_configuration_files(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:
return {"status": False,
@@ -114,15 +119,27 @@ class Config(object):
as_attachment=True,
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
"""
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:
- 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):
"""
diff --git a/server/frontend/app/blueprints/misc.py b/server/frontend/app/blueprints/misc.py
index 250c821..00ed033 100644
--- a/server/frontend/app/blueprints/misc.py
+++ b/server/frontend/app/blueprints/misc.py
@@ -56,5 +56,6 @@ def get_config():
"sparklines": read_config(("frontend", "sparklines")),
"quit_option": read_config(("frontend", "quit_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"))
})