Skip to content

Commit 0b73c08

Browse files
committed
wip #92
1 parent 5e66ed1 commit 0b73c08

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

docker/default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ server {
2222
}
2323
location /wifi {
2424
rewrite /wifi/(.*) /$1 break;
25-
proxy_pass http://127.0.0.1:8080;
25+
proxy_pass http://127.0.0.1:9090;
2626
}
2727
}

src/common/wifi_connect.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
class WifiConnect {
22
constructor(CB, axios) {
3-
this.CB = CB + '/wifi';
3+
this.CB = CB + '/wifi/v1';
44
this.$axios = axios;
55
}
66

77
networks() {
8-
return this.$axios.get(`${this.CB}/networks`);
8+
return this.$axios.get(`${this.CB}/list_access_points`);
99
}
1010

11-
connect(ssid, identity, passphrase) {
11+
connect(ssid, conn_type, username, password) {
1212
return this.$axios.post(`${this.CB}/connect`, {
1313
ssid: ssid,
14-
identity: identity,
15-
passphrase: passphrase,
14+
conn_type: conn_type,
15+
username: username,
16+
password: password,
1617
});
1718
}
1819

19-
disconnect(ssid) {
20-
return this.$axios.post(`${this.CB}/disconnect`, {
21-
ssid: ssid,
20+
disconnect() {
21+
return this.$axios.post(`${this.CB}/forget`, {
22+
all_networks: true
2223
});
2324
}
25+
26+
set_hotspot_ssid(ssid) {
27+
return this.$axios.post(`${this.CB}/sset_hotspot_ssid`, {
28+
ssid: ssid
29+
});
30+
}
31+
32+
set_hotspot_password(password) {
33+
return this.$axios.post(`${this.CB}/set_hotspot_password`, {
34+
ssid: password
35+
});
36+
}
37+
38+
connection_status() {
39+
return this.$axios.get(`${this.CB}/connection_status`);
40+
}
2441
}
2542

2643
export default WifiConnect;

src/components/Settings.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,12 @@
396396
>
397397
</v-select>
398398
<v-text-field
399+
v-if="network_require_user()"
400+
:disabled="settings.wifiMode!='client'"
401+
v-model="settings.wifiUser"
402+
:type="text"
403+
v-bind:label="$t('message.settings_network_user')"></v-text-field>
404+
<v-text-field
399405
:disabled="settings.wifiMode!='client'"
400406
v-model="settings.wifiPsw"
401407
:append-icon="wifi_pwd_show ? 'mdi-eye' : 'mdi-eye-off'"
@@ -765,6 +771,12 @@ export default {
765771
next();
766772
}
767773
},
774+
computed: {
775+
network_require_user() {
776+
const network = this.networks.find(item => { return item.ssid==this.v$.settings.wifiSSID });
777+
return network.conn_type == "ENTERPRISE";
778+
}
779+
},
768780
methods: {
769781
pickFile() {
770782
this.$refs.file.click();
@@ -937,14 +949,15 @@ export default {
937949
});
938950
if (this.v$.settings.wifiMode.$dirty || this.v$.settings.wifiSSID.$dirty || this.v$.settings.wifiPsw.$dirty) {
939951
if(this.settings.wifiMode=="client") {
940-
this.$wifi_connect.connect(this.settings.wifiSSID, "", this.settings.wifiPsw)
952+
const network = this.networks.find(item => { return item.ssid==this.v$.settings.wifiSSID });
953+
this.$wifi_connect.connect(network.ssid, network.conn_type, this.settings.wifiUser, this.settings.wifiPsw)
941954
.then(() => {
942955
console.log('connect Sent');
943956
this.snackText = this.$i18n.t('message.settings_network_updated');
944957
this.snackbar = true;
945958
});
946959
} else {
947-
this.$wifi_connect.disconnect(this.settings.wifiSSID)
960+
this.$wifi_connect.disconnect()
948961
.then(() => {
949962
console.log('disconnect Sent');
950963
this.snackText = this.$i18n.t('message.settings_network_updated');
@@ -1035,6 +1048,7 @@ export default {
10351048
btnFun: null,
10361049
wifiMode: 'ap',
10371050
wifiSSID: null,
1051+
wifiUser: null,
10381052
wifiPsw: null,
10391053
10401054
hardwareVersion: null,

0 commit comments

Comments
 (0)