Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ssid avec espace #26

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions core/class/luna.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,27 +364,27 @@ public static function saveWifi($interface = 1, $data) {
}
if($wifiMode == "client"){
log::add(__CLASS__, 'debug', 'save wifi >>bbbb'.luna::convertIP($wifiIp, $wifiMask));
shell_exec('sudo nmcli dev wifi connect '.$wifiSsid.' password '.$wifiPassword);
shell_exec('sudo nmcli con down '.$wifiSsid);
shell_exec('sudo nmcli con modify '.$wifiSsid.' ifname wlan'.$device);
shell_exec('sudo nmcli dev wifi connect "'.$wifiSsid.'" password "'.$wifiPassword.'"');
shell_exec('sudo nmcli con down "'.$wifiSsid.'"');
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ifname wlan'.$device);
if($typeAdressage == 'dhcp'){
shell_exec('sudo nmcli con modify '.$wifiSsid.' ipv4.method auto');
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ipv4.method auto');
if($wifiDnsOpt!=""){
shell_exec('sudo nmcli con modify '.$wifiSsid.' ipv4.ignore-auto-dns yes');
shell_exec('sudo nmcli con modify '.$wifiSsid.' ipv4.dns '.$wifiDnsOpt);
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ipv4.ignore-auto-dns yes');
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ipv4.dns '.$wifiDnsOpt);
}else{
shell_exec('sudo nmcli con modify '.$wifiSsid.' ipv4.ignore-auto-dns no');
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ipv4.ignore-auto-dns no');
}
shell_exec('sudo nmcli con up '.$wifiSsid);
shell_exec('sudo nmcli con up "'.$wifiSsid.'"');
}else{
shell_exec('sudo nmcli con modify '.$wifiSsid.' ipv4.addresses '.luna::convertIP($wifiIp, $wifiMask).' ipv4.gateway '.$wifiRouter.' ipv4.dns '.$wifiDns.' ipv4.method manual');
shell_exec('sudo nmcli con modify '.$wifiSsid.' ifname wlan'.$device);
shell_exec('sudo nmcli con up '.$wifiSsid);
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ipv4.addresses '.luna::convertIP($wifiIp, $wifiMask).' ipv4.gateway '.$wifiRouter.' ipv4.dns '.$wifiDns.' ipv4.method manual');
shell_exec('sudo nmcli con modify "'.$wifiSsid.'" ifname wlan'.$device);
shell_exec('sudo nmcli con up "'.$wifiSsid.'"');
}
sleep(5);
}else if($wifiMode == "hotspot"){
log::add(__CLASS__, 'debug', 'save wifi >>hotspot');
shell_exec('sudo nmcli con add type wifi ifname wlan'.$device.' con-name Hostspot-wlan'.$device.' autoconnect yes ssid '.$wifiHotspotName);
shell_exec('sudo nmcli con add type wifi ifname wlan'.$device.' con-name Hostspot-wlan'.$device.' autoconnect yes ssid "'.$wifiHotspotName.'"');
shell_exec('sudo nmcli con modify Hostspot-wlan'.$device.' 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared');
shell_exec('sudo nmcli con modify Hostspot-wlan'.$device.' wifi-sec.key-mgmt wpa-psk');
shell_exec('sudo nmcli con modify Hostspot-wlan'.$device.' wifi-sec.psk "'.$wifiHotspotPwd.'"');
Expand Down
Loading