Add QR code type "Wifi" + handle every request in index.php (#27)

QR codes types can now be chosen between the default text mode and the Wifi mode.

The WiFi form is on a dedicated page, and that has been implemented by managing every HTTP request from index.php

For more information about the format used for Wifi QR codes check https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11

Co-authored-by: Miraty <miraty+git@antopie.org>
Reviewed-on: #27 (https://code.antopie.org/miraty/libreqr/issues/27)
Reviewed-by: Miraty <miraty@noreply.code.antopie.org>
Co-authored-by: Denise <denisebitca@42l.fr>
Co-committed-by: Denise <denisebitca@42l.fr>

e4491752f2
This commit is contained in:
Bakhai Support 2025-09-07 17:17:32 +05:30
commit 1df83b89a1
8 changed files with 362 additions and 156 deletions

View file

@ -3,6 +3,12 @@ $loc = array(
'subtitle' => "QR codes generator",
'description' => "Generate QR codes freely. Choose content, size, colors…",
'tab_text' => "Text",
'tab_wifi' => "Wifi",
'tab_wifi_title' => "Wifi QR codes generation",
'label_wifi_ssid' => "Network name / SSID",
'label_wifi_password' => "Password",
'label_content' => "Text to encode",
'label_redundancy' => "Redundancy rate",
'label_margin' => "Margin size",
@ -11,7 +17,10 @@ $loc = array(
'label_fgColor' => "Foreground color",
'placeholder' => "Enter the text to encode in the QR code",
'placeholder_wifi_ssid' => "Box-A31B",
'placeholder_wifi_password' => "correct horse battery staple",
'help_wifi_password' => "The WPA, WPA2 or WPA3 key. Leave empty if it's an open network.",
'help_content' => "
<p>You can encode whatever text you want.</p>
<p>Software decoding these QR codes could suggest to open them with dedicated software, depending on their <a href='https://en.wikipedia.org/wiki/List_of_URI_schemes' hreflang='en' rel='help external noreferrer'>URI scheme</a>.</p>
@ -25,12 +34,16 @@ $loc = array(
'button_create' => "Generate",
'button_download' => "Save this QR code",
'button_edit' => "Edit",
'title_showOnlyQR' => "Show this QR code only",
'alt_QR_before' => 'QR code meaning "',
'alt_QR_after' => '"',
'wifi_raw_content_before' => "This QR code contains: ",
'wifi_raw_content_after' => "",
'metaText_qr' => "
<h3>What's a QR code?</h3>
A QR code is a 2 dimensional barcode in which text is written in binary. It can be decoded with a device equipped with a photo sensor and adequate software.
@ -39,4 +52,5 @@ $loc = array(
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " is free software whose <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>source code</a> is available under the terms of the <abbr title='GNU Affero General Public License version 3 or any later version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
'error_generation' => "An error occurred while generating the QR code. Try with different parameters.",
);
'error_404' => "This page doesn't exist.",
);

View file

@ -3,6 +3,12 @@ $loc = array(
'subtitle' => "Générer des codes QR",
'description' => "Générer des codes QR librement. Choix du contenu, de la taille, des couleurs…",
'tab_text' => "Texte",
'tab_wifi' => "Wifi",
'tab_wifi_title' => "Générer des codes QR Wifi",
'label_wifi_ssid' => "Nom du réseau / SSID",
'label_wifi_password' => "Mot de passe",
'label_content' => "Texte à encoder",
'label_redundancy' => "Taux de redondance",
'label_margin' => "Taille de la marge",
@ -11,7 +17,10 @@ $loc = array(
'label_fgColor' => "Couleur de premier plan",
'placeholder' => "Entrez le texte à encoder dans le code QR",
'placeholder_wifi_ssid' => "Box-A31B",
'placeholder_wifi_password' => "correct cheval batterie agrafe",
'help_wifi_password' => "La clé WPA, WPA2 ou WPA3. Laisser vide si c'est un réseau ouvert.",
'help_content' => "
<p>Vous pouvez encoder ce que vous voulez sous forme de texte.</p>
<p>Les logiciels qui décodent ces codes QR pourraient proposer de les ouvrir avec un logiciel dédié, en fonction de leur <a href='https://fr.wikipedia.org/wiki/Sch%C3%A9ma_d%27URI' hreflang='fr' rel='help external noreferrer'>schéma d'URI</a>.</p>
@ -25,12 +34,16 @@ $loc = array(
'button_create' => "Générer",
'button_download' => "Enregistrer ce code QR",
'button_edit' => "Modifier",
'title_showOnlyQR' => "Afficher uniquement ce code QR",
'alt_QR_before' => "Code QR signifiant « ",
'alt_QR_after' => " »",
'wifi_raw_content_before' => "Ce code QR contient&nbsp;: ",
'wifi_raw_content_after' => "",
'metaText_qr' => "
<h3>Qu'est-ce qu'un code QR ?</h3>
Un code QR est un code-barres en 2 dimensions dans lequel du texte est inscrit en binaire. Il peut être décodé avec un appareil muni d'un capteur photo et d'un logiciel adéquat.
@ -39,4 +52,5 @@ $loc = array(
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " est un logiciel libre dont le <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>code source</a> est disponible selon les termes de l'<abbr title='GNU Affero General Public License version 3 ou toute version ultérieure'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
'error_generation' => "Une erreur a eu lieu lors de la génération du code QR. Essayez avec des paramètres différents.",
);
'error_404' => "Cette page n'existe pas.",
);

View file

@ -3,6 +3,12 @@ $loc = array(
'subtitle' => "subtitle",
'description' => "description",
'tab_text' => "tab_text",
'tab_wifi' => "tab_wifi",
'tab_wifi_title' => "tab_wifi_title",
'label_wifi_ssid' => "label_wifi_ssid",
'label_wifi_password' => "label_wifi_password",
'label_content' => "label_content",
'label_redundancy' => "label_redundancy",
'label_margin' => "label_margin",
@ -11,9 +17,10 @@ $loc = array(
'label_fgColor' => "label_fgColor",
'placeholder' => "placeholder",
'placeholder_wifi_ssid' => "placeholder_wifi_ssid",
'placeholder_wifi_password' => "placeholder_wifi_password",
'value_default' => "value_default",
'help_wifi_password' => "help_wifi_password",
'help_content' => "help_content",
'help_redundancy' => "help_redundancy",
'help_margin' => "help_margin",
@ -21,14 +28,19 @@ $loc = array(
'button_create' => "button_create",
'button_download' => "button_download",
'button_edit' => "button_edit",
'title_showOnlyQR' => "title_showOnlyQR",
'alt_QR_before' => "alt_QR_before",
'alt_QR_after' => "alt_QR_after",
'wifi_raw_content_before' => "wifi_raw_content_before",
'wifi_raw_content_after' => "wifi_raw_content_after",
'metaText_qr' => "metaText_qr",
'metaText_legal' => "metaText_legal",
'error_generation' => "error_generation",
);
'error_404' => "error_404",
);