(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

@ -190,11 +190,9 @@ export default function Form() {
[save], [save],
); );
const isTauriEnv = isTauri();
return ( return (
<div className="flex md:flex-row flex-col gap-15"> <div className="flex md:flex-row flex-col gap-15">
{isTauriEnv ? ( {isTauri() ? (
<> <>
<QrCodeScanner <QrCodeScanner
onData={async (data) => { onData={async (data) => {

View file

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