Merge branch 'master' into feature/wireguard

This commit is contained in:
Bill Zimmerman 2020-10-15 11:40:45 +02:00
commit 0ba767c387
9 changed files with 80 additions and 54 deletions

View file

@ -80,7 +80,7 @@ By default RaspAP configures a routed AP for your clients to connect to. A bridg
More information on Bridged AP mode is provided [on our wiki](https://github.com/billz/raspap-webgui/wiki/Bridged-AP-mode). More information on Bridged AP mode is provided [on our wiki](https://github.com/billz/raspap-webgui/wiki/Bridged-AP-mode).
## Simultaneous AP and Wifi client ## Simultaneous AP and Wifi client
RaspAP lets you create an AP with a Wifi client configuration, often called AP-STA mode. With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart. RaspAP lets you create an AP with a Wifi client configuration, often called [AP-STA mode](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode). With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart.
**Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled [_before_ a reboot](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode). **Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled [_before_ a reboot](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode).

View file

@ -90,7 +90,7 @@ function DisplayDashboard(&$extraFooterScripts)
define('SSIDMAXLEN', 32); define('SSIDMAXLEN', 32);
// Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable." // Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable."
exec('iw dev ' .$_SESSION['wifi_client_interface']. ' link ', $stdoutIw); exec('iw dev ' .$_SESSION['wifi_client_interface']. ' link ', $stdoutIw);
$stdoutIwAllLinesGlued = implode(' ', $stdoutIw); $stdoutIwAllLinesGlued = implode('+', $stdoutIw); // Break lines with character illegal in SSID and MAC addr
$stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued); $stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued);
preg_match('/Connected to (([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}))/', $stdoutIwWRepSpaces, $matchesBSSID) || $matchesBSSID[1] = ''; preg_match('/Connected to (([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}))/', $stdoutIwWRepSpaces, $matchesBSSID) || $matchesBSSID[1] = '';
@ -102,7 +102,7 @@ function DisplayDashboard(&$extraFooterScripts)
$wlanHasLink = true; $wlanHasLink = true;
} }
if (!preg_match('/SSID: ([^ ]{1,'.SSIDMAXLEN.'})/', $stdoutIwWRepSpaces, $matchesSSID)) { if (!preg_match('/SSID: ([^+]{1,'.SSIDMAXLEN.'})/', $stdoutIwWRepSpaces, $matchesSSID)) {
$wlanHasLink = false; $wlanHasLink = false;
$matchesSSID[1] = 'None'; $matchesSSID[1] = 'None';
} }

Binary file not shown.

View file

@ -35,10 +35,10 @@ msgid "Hotspot"
msgstr "Hotspot" msgstr "Hotspot"
msgid "Memory Use" msgid "Memory Use"
msgstr "" msgstr "Usage mémoire"
msgid "CPU Temp" msgid "CPU Temp"
msgstr "" msgstr "T°C CPU"
msgid "Networking" msgid "Networking"
msgstr "Réseau" msgstr "Réseau"
@ -127,7 +127,7 @@ msgid "Rescan"
msgstr "Actualiser" msgstr "Actualiser"
msgid "Update" msgid "Update"
msgstr "Mettre à jour" msgstr "Mise à jour"
msgid "Add" msgid "Add"
msgstr "Ajouter" msgstr "Ajouter"
@ -182,7 +182,7 @@ msgid "Transferred Bytes"
msgstr "Octets transférés" msgstr "Octets transférés"
msgid "Wireless Client" msgid "Wireless Client"
msgstr "" msgstr "Client WIFI"
msgid "Connected To" msgid "Connected To"
msgstr "Connecté à" msgstr "Connecté à"
@ -230,13 +230,13 @@ msgid "Interface is down"
msgstr "L'interface est arrêté" msgstr "L'interface est arrêté"
msgid "Interface already down" msgid "Interface already down"
msgstr "Interface déjà arrêté" msgstr "Interface déjà arrêtée"
msgid "Start wlan0" msgid "Start wlan0"
msgstr "Démarrer wlan0" msgstr "Démarrer wlan0"
msgid "Stop wlan0" msgid "Stop wlan0"
msgstr "Arrêtez wlan0" msgstr "Arrêter wlan0"
msgid "Connected Devices" msgid "Connected Devices"
msgstr "Appareils connectés" msgstr "Appareils connectés"
@ -276,7 +276,7 @@ msgid "Active DHCP leases"
msgstr "Baux DHCP actifs" msgstr "Baux DHCP actifs"
msgid "Expire time" msgid "Expire time"
msgstr "Temps d'expiration" msgstr "Temps avant expiration"
msgid "MAC Address" msgid "MAC Address"
msgstr "Adresse Mac" msgstr "Adresse Mac"
@ -291,7 +291,7 @@ msgid "Information provided by Dnsmasq"
msgstr "Informations fournies par Dnsmasq" msgstr "Informations fournies par Dnsmasq"
msgid "Stop dnsmasq" msgid "Stop dnsmasq"
msgstr "Arrêtez dnsmasq" msgstr "Arrêter dnsmasq"
msgid "Start dnsmasq" msgid "Start dnsmasq"
msgstr "Démarrer dnsmasq" msgstr "Démarrer dnsmasq"
@ -324,7 +324,7 @@ msgid "Dnsmasq is not running"
msgstr "Dnsmasq n'est pas en fonctionnement" msgstr "Dnsmasq n'est pas en fonctionnement"
msgid "Upstream DNS servers" msgid "Upstream DNS servers"
msgstr "Serveurs DNS amont" msgstr "Serveurs DNS en amont"
msgid "Only ever query DNS servers configured below" msgid "Only ever query DNS servers configured below"
msgstr "Uniquement les serveurs DNS de requête configurés ci-dessous" msgstr "Uniquement les serveurs DNS de requête configurés ci-dessous"
@ -336,7 +336,7 @@ msgid "This option adds <code>no-resolv</code> to the dnsmasq configuration."
msgstr "Cette option ajoute <code>no-resolv</code> à la configuration dnsmasq." msgstr "Cette option ajoute <code>no-resolv</code> à la configuration dnsmasq."
msgid "Add upstream DNS server" msgid "Add upstream DNS server"
msgstr "Ajouter un serveur DNS amont" msgstr "Ajouter un serveur DNS en amont"
msgid "Format" msgid "Format"
msgstr "Format" msgstr "Format"
@ -418,7 +418,7 @@ msgid "Start hotspot"
msgstr "Démarrer le point d'accès" msgstr "Démarrer le point d'accès"
msgid "Stop hotspot" msgid "Stop hotspot"
msgstr "Arrêté le point d'accès" msgstr "Arrêter le point d'accès"
msgid "Restart hotspot" msgid "Restart hotspot"
msgstr "Redémarrer le point d'accès" msgstr "Redémarrer le point d'accès"
@ -495,7 +495,7 @@ msgid "Select a language"
msgstr "Sélectionnez une langue" msgstr "Sélectionnez une langue"
msgid "Language setting saved" msgid "Language setting saved"
msgstr "Paramètre de langue enregistré" msgstr "Paramètre de langue enregistrée"
msgid "Console" msgid "Console"
msgstr "Console" msgstr "Console"
@ -687,10 +687,10 @@ msgid "Remove"
msgstr "arrêté" msgstr "arrêté"
msgid "up" msgid "up"
msgstr "vers le haut" msgstr "activé"
msgid "down" msgid "down"
msgstr "vers le bas" msgstr "désactivé"
msgid "adblock" msgid "adblock"
msgstr "AdBlock" msgstr "AdBlock"
@ -720,10 +720,10 @@ msgid "Choose a blocklist provider"
msgstr "Choisir un fournisseur de liste noire" msgstr "Choisir un fournisseur de liste noire"
msgid "Hostnames blocklist last updated" msgid "Hostnames blocklist last updated"
msgstr "" msgstr "Dernière mise à jour de la liste de blocage des noms d'hôtes"
msgid "Domains blocklist last updated" msgid "Domains blocklist last updated"
msgstr "" msgstr "Dernière mise à jour de la liste de blocage des domaines"
msgid "Update now" msgid "Update now"
msgstr "Mettre à jour" msgstr "Mettre à jour"

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,16 @@
<?php
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
if ($arrHostapdConf['WifiAPEnable'] == 1) {
$client_interface = 'uap0';
} else {
$client_interface = $_SESSION['wifi_client_interface'];
}
exec('ip a show '.$client_interface, $stdoutIp);
$stdoutIpAllLinesGlued = implode(" ", $stdoutIp);
$stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued);
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState) || $matchesState[1] = 'unknown';
$ifaceStatus = strtolower($matchesState[1]) ? "up" : "down";
?>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card"> <div class="card">
@ -6,6 +19,12 @@
<div class="col"> <div class="col">
<i class="fas fa-wifi mr-2"></i><?php echo _("WiFi client"); ?> <i class="fas fa-wifi mr-2"></i><?php echo _("WiFi client"); ?>
</div> </div>
<div class="col">
<button class="btn btn-light btn-icon-split btn-sm service-status float-right">
<span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span>
<span class="text service-status"><?php echo strtolower($client_interface) .' '. _($ifaceStatus) ?></span>
</button>
</div>
</div><!-- /.row --> </div><!-- /.row -->
</div><!-- /.card-header --> </div><!-- /.card-header -->
<div class="card-body"> <div class="card-body">
@ -21,7 +40,7 @@
<form method="POST" action="?page=wpa_conf" name="wpa_conf_form" class="row"> <form method="POST" action="?page=wpa_conf" name="wpa_conf_form" class="row">
<?php echo CSRFTokenFieldTag() ?> <?php echo CSRFTokenFieldTag() ?>
<input type="hidden" name="client_settings" ?> <input type="hidden" name="client_settings" ?>
<div class="js-wifi-stations loading-spinner"></div> <div class="row js-wifi-stations w-100 loading-spinner"></div>
</form> </form>
</div><!-- ./ card-body --> </div><!-- ./ card-body -->
<div class="card-footer"><?php echo _("<strong>Note:</strong> WEP access points appear as 'Open'. RaspAP does not currently support connecting to WEP"); ?></div> <div class="card-footer"><?php echo _("<strong>Note:</strong> WEP access points appear as 'Open'. RaspAP does not currently support connecting to WEP"); ?></div>

View file

@ -55,6 +55,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
<div class="row justify-content-md-center"> <div class="row justify-content-md-center">
<div class="col-md"> <div class="col-md">
<div class="info-item"><?php echo _("Connected To"); ?></div><div><?php echo htmlspecialchars($connectedSSID, ENT_QUOTES); ?></div> <div class="info-item"><?php echo _("Connected To"); ?></div><div><?php echo htmlspecialchars($connectedSSID, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Interface"); ?></div><div><?php echo htmlspecialchars($_SESSION['wifi_client_interface']); ?></div>
<div class="info-item"><?php echo _("AP Mac Address"); ?></div><div><?php echo htmlspecialchars($connectedBSSID, ENT_QUOTES); ?></div> <div class="info-item"><?php echo _("AP Mac Address"); ?></div><div><?php echo htmlspecialchars($connectedBSSID, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Bitrate"); ?></div><div><?php echo htmlspecialchars($bitrate, ENT_QUOTES); ?></div> <div class="info-item"><?php echo _("Bitrate"); ?></div><div><?php echo htmlspecialchars($bitrate, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Signal Level"); ?></div><div><?php echo htmlspecialchars($signalLevel, ENT_QUOTES); ?></div> <div class="info-item"><?php echo _("Signal Level"); ?></div><div><?php echo htmlspecialchars($signalLevel, ENT_QUOTES); ?></div>

View file

@ -1,22 +1,27 @@
<?php if (empty($networks)) : ?> <?php if (empty($networks)) { ?>
<p class="lead text-center"><?php echo _('No Wifi stations found') ?></p> <p class="lead text-center"><?php echo _('No Wifi stations found') ?></p>
<p class="text-center"><?php echo _('Click "Rescan" to search for nearby Wifi stations.') ?></p> <p class="text-center"><?php echo _('Click "Rescan" to search for nearby Wifi stations.') ?></p>
<?php endif ?> <?php } elseif (count($networks) == 1) {
$prop_col = "col-sm-12";
$prop_w = "w-50";
} else {
$prop_col = "col-sm-6";
$prop_w = "w-100";
}
?>
<?php $index = 0; ?> <?php $index = 0; ?>
<div class="row ml-1 mr-1"> <div class="row ml-1 mr-1 w-100">
<?php foreach ($networks as $ssid => $network) : ?>
<?php foreach ($networks as $ssid => $network) : ?> <div class="<?php echo $prop_col; ?> align-items-stretch mb-3">
<div class="col-sm-6 align-items-stretch mb-3"> <div class="card h-100 <?php echo $prop_w; ?>">
<div class="card h-100">
<div class="card-body"> <div class="card-body">
<input type="hidden" name="ssid<?php echo $index ?>" value="<?php echo htmlentities($ssid, ENT_QUOTES) ?>" /> <input type="hidden" name="ssid<?php echo $index ?>" value="<?php echo htmlentities($ssid, ENT_QUOTES) ?>" />
<?php if (strlen($ssid) == 0) { <?php if (strlen($ssid) == 0) {
$ssid = "(unknown)"; $ssid = "(unknown)";
} ?> } ?>
<h5 class="card-title"><?php echo htmlspecialchars($ssid, ENT_QUOTES); ?></h5> <h5 class="card-title"><?php echo htmlspecialchars($ssid, ENT_QUOTES); ?></h5>
<div class="info-item-wifi"><?php echo _("Status"); ?></div> <div class="info-item-wifi"><?php echo _("Status"); ?></div>
<div> <div>
<?php if ($network['configured']) { ?> <?php if ($network['configured']) { ?>
<i class="fas fa-check-circle"></i> <i class="fas fa-check-circle"></i>
@ -29,7 +34,7 @@
} ?> } ?>
</div> </div>
<div class="info-item-wifi"><?php echo _("Channel"); ?></div> <div class="info-item-wifi"><?php echo _("Channel"); ?></div>
<div> <div>
<?php if ($network['visible']) { ?> <?php if ($network['visible']) { ?>
<?php echo htmlspecialchars($network['channel'], ENT_QUOTES) ?> <?php echo htmlspecialchars($network['channel'], ENT_QUOTES) ?>
@ -38,7 +43,7 @@
<?php } ?> <?php } ?>
</div> </div>
<div class="info-item-wifi"><?php echo _("RSSI"); ?></div> <div class="info-item-wifi"><?php echo _("RSSI"); ?></div>
<div> <div>
<?php <?php
if (isset($network['RSSI']) && $network['RSSI'] >= -200) { if (isset($network['RSSI']) && $network['RSSI'] >= -200) {
@ -63,35 +68,36 @@
<?php } ?> <?php } ?>
<input type="hidden" name="protocol<?php echo $index ?>" value="<?php echo htmlspecialchars($network['protocol'], ENT_QUOTES); ?>" /> <input type="hidden" name="protocol<?php echo $index ?>" value="<?php echo htmlspecialchars($network['protocol'], ENT_QUOTES); ?>" />
<div class="info-item-wifi"><?php echo _("Security"); ?></div> <div class="info-item-wifi"><?php echo _("Security"); ?></div>
<div><?php echo $network['protocol'] ?></div> <div><?php echo $network['protocol'] ?></div>
<div class="form-group"> <div class="form-group">
<div class="info-item-wifi"><?php echo _("Passphrase"); ?></div> <div class="info-item-wifi"><?php echo _("Passphrase"); ?></div>
<div class="input-group"> <div class="input-group">
<?php if ($network['protocol'] === 'Open') { ?> <?php if ($network['protocol'] === 'Open') { ?>
<input type="password" disabled class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="" /> <input type="password" disabled class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="" />
<?php } else { ?> <?php } else { ?>
<input type="password" class="form-control js-validate-psk" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" data-target="#update<?php echo $index ?>" data-colors="#ffd0d0,#d0ffd0"> <input type="password" class="form-control js-validate-psk" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" data-target="#update<?php echo $index ?>" data-colors="#ffd0d0,#d0ffd0">
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-outline-secondary js-toggle-password" type="button" data-target="[name=passphrase<?php echo $index ?>]" data-toggle-with="<?php echo _("Hide") ?>">Show</button> <button class="btn btn-outline-secondary js-toggle-password" type="button" data-target="[name=passphrase<?php echo $index ?>]" data-toggle-with="<?php echo _("Hide") ?>">Show</button>
</div>
<?php } ?>
</div> </div>
<?php } ?> </div>
</div>
</div>
<div class="btn-group btn-block "> <div class="btn-group btn-block ">
<?php if ($network['configured']) { ?> <?php if ($network['configured']) { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-warning" value="<?php echo _("Update"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> /> <input type="submit" class="col-xs-4 col-md-4 btn btn-warning" value="<?php echo _("Update"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> />
<button type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo $index?>" name="connect"><?php echo _("Connect"); ?></button> <button type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo $index?>" name="connect"><?php echo _("Connect"); ?></button>
<?php } else { ?> <?php } else { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo _("Add"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>" <?php echo ($network['protocol'] === 'Open' ? '' : ' disabled')?> /> <input type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo _("Add"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>" <?php echo ($network['protocol'] === 'Open' ? '' : ' disabled')?> />
<?php } ?> <?php } ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-danger" value="<?php echo _("Delete"); ?>" name="delete<?php echo $index ?>"<?php echo ($network['configured'] ? '' : ' disabled')?> /> <input type="submit" class="col-xs-4 col-md-4 btn btn-danger" value="<?php echo _("Delete"); ?>" name="delete<?php echo $index ?>"<?php echo ($network['configured'] ? '' : ' disabled')?> />
</div><!-- /.btn-group --> </div><!-- /.btn-group -->
</div><!-- /.card-body --> </div><!-- /.card-body -->
</div><!-- /.card --> </div><!-- /.card -->
</div><!-- /.col-sm --> </div><!-- /.col-sm -->
<?php $index += 1; ?> <?php $index += 1; ?>
<?php endforeach ?> <?php endforeach ?>
</div><!-- /.row --> </div><!-- /.row -->