This commit is contained in:
derekcentrico 2025-04-06 18:43:06 -07:00 committed by GitHub
commit d433023523
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import { type MaybeRef, get } from '@vueuse/core';
import QRCode, { type QRCodeToDataURLOptions } from 'qrcode';
import { isRef, ref, watch } from 'vue';
export const wifiEncryptions = ['WEP', 'WPA', 'nopass', 'WPA2-EAP'] as const;
export const wifiEncryptions = ['WEP', 'WPA', 'WPA3', 'WPA2/WPA3', 'nopass', 'WPA2-EAP'] as const;
export type WifiEncryption = typeof wifiEncryptions[number];
// @see https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol
@ -70,7 +70,13 @@ function getQrCodeText(options: GetQrCodeTextOptions): string | null {
if (encryption === 'nopass') {
return `WIFI:S:${escapeString(ssid)};;`; // type can be omitted in that case, and password is not needed, makes the QR Code smaller
}
if (encryption !== 'WPA2-EAP' && password) {
if (encryption === 'WPA3' && password) {
return `WIFI:S:${escapeString(ssid)};T:WPA3;P:${escapeString(password)};${isHiddenSSID ? 'H:true;' : ''}R:1;;`;
}
if (encryption === 'WPA2/WPA3' && password) {
return `WIFI:S:${escapeString(ssid)};T:WPA3;P:${escapeString(password)};${isHiddenSSID ? 'H:true;' : ''};`;
}
if (encryption !== 'WPA2-EAP' && password) {
// EAP has a lot of options, so we'll handle it separately
// WPA and WEP are pretty simple though.
return `WIFI:S:${escapeString(ssid)};T:${encryption};P:${escapeString(password)};${isHiddenSSID ? 'H:true' : ''};`;

View file

@ -56,6 +56,14 @@ const { download } = useDownloadFileFromBase64({ source: qrcode, filename: 'qr-c
label: 'WPA/WPA2',
value: 'WPA',
},
{
label: 'WPA3-only (No WPA2 fallback)',
value: 'WPA3',
},
{
label: 'WPA2/WPA3 (Mixed Mode)',
value: 'WPA2/WPA3',
},
{
label: 'WEP',
value: 'WEP',