(fix): ttp_url missing in qrcode
All checks were successful
/ build-web (push) Successful in 1m7s
/ build-desktop (push) Successful in 11m6s
/ build-mobile (push) Successful in 15m35s
/ release (push) Successful in 23s

This commit is contained in:
Alois 2026-05-22 20:34:05 +02:00
commit 167036533c
2 changed files with 17 additions and 8 deletions

View file

@ -46,6 +46,7 @@ function QrCodeLogin() {
const [qrCodeBase64, setQrCodeBase64] = useState<string | undefined>(
undefined,
);
const [connectionString, setConnectionString] = useState<string | null>(null);
useEffect(() => {
load("private_key").then((value) => {
@ -58,15 +59,25 @@ function QrCodeLogin() {
setUserId(value);
}
});
load("ttp_url")
.then((value) => {
if (value) {
const url = new URL(value);
setConnectionString(`@${url.host}`);
} else {
setConnectionString("");
}
})
.catch(() => setConnectionString(""));
}, [load]);
useEffect(() => {
if (userId && privateKey) {
generateQR(`tensamin://tu::${userId}::${privateKey}`).then(
setQrCodeBase64,
);
if (userId && privateKey && connectionString !== null) {
generateQR(
`tensamin://tu::${userId}${connectionString}::${privateKey}`,
).then(setQrCodeBase64);
}
}, [userId, privateKey]);
}, [userId, privateKey, connectionString]);
const [qrCodeVisible, setQrCodeVisible] = useState(false);