mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-07 06:47:13 -04:00
added WPA2/WPA3 and WPA3 only.
added WPA2/WPA3 and WPA3 only.
This commit is contained in:
parent
08d977b8cd
commit
acedd65366
2 changed files with 16 additions and 2 deletions
|
@ -2,7 +2,7 @@ import { type MaybeRef, get } from '@vueuse/core';
|
||||||
import QRCode, { type QRCodeToDataURLOptions } from 'qrcode';
|
import QRCode, { type QRCodeToDataURLOptions } from 'qrcode';
|
||||||
import { isRef, ref, watch } from 'vue';
|
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];
|
export type WifiEncryption = typeof wifiEncryptions[number];
|
||||||
|
|
||||||
// @see https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol
|
// @see https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol
|
||||||
|
@ -70,7 +70,13 @@ function getQrCodeText(options: GetQrCodeTextOptions): string | null {
|
||||||
if (encryption === 'nopass') {
|
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
|
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
|
// EAP has a lot of options, so we'll handle it separately
|
||||||
// WPA and WEP are pretty simple though.
|
// WPA and WEP are pretty simple though.
|
||||||
return `WIFI:S:${escapeString(ssid)};T:${encryption};P:${escapeString(password)};${isHiddenSSID ? 'H:true' : ''};`;
|
return `WIFI:S:${escapeString(ssid)};T:${encryption};P:${escapeString(password)};${isHiddenSSID ? 'H:true' : ''};`;
|
||||||
|
|
|
@ -56,6 +56,14 @@ const { download } = useDownloadFileFromBase64({ source: qrcode, filename: 'qr-c
|
||||||
label: 'WPA/WPA2',
|
label: 'WPA/WPA2',
|
||||||
value: 'WPA',
|
value: 'WPA',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'WPA3-only (No WPA2 fallback)',
|
||||||
|
value: 'WPA3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'WPA2/WPA3 (Mixed Mode)',
|
||||||
|
value: 'WPA2/WPA3',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'WEP',
|
label: 'WEP',
|
||||||
value: 'WEP',
|
value: 'WEP',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue