WIP improve UX [snapshot task 2]

This commit is contained in:
Schluffe committed 2026-10-16 15:39:31 +02:00
1 parent 3ae47dde8e
commit cd66321ea6
13 files changed
+703 -87

No files matched your search

+2 -2
View File
@@ -132,7 +132,7 @@ export function getFingerprints(pc: { localDescription: { sdp: string } | null;
}
export function encodeSignal(sdp: string) {
const code = btoa(JSON.stringify({ version: 2, sdp })).replace(/=+$/, '');
const code = btoa(JSON.stringify({ version: 3, sdp })).replace(/=+$/, '');
if (code.length > MAX_SIGNAL_LENGTH) throw new Error('Connection code is too large. Reduce the configured network interfaces and try again.');
return code;
}
@@ -142,7 +142,7 @@ export function decodeSignal(text: unknown, options?: Pick<IceOptions, 'allowTur
try {
const clean = text.trim().replace(/\s+/g, '');
const data: unknown = JSON.parse(atob(clean));
if (!isRecord(data) || data.version !== 2) throw new Error('Both people need the current HellCon version.');
if (!isRecord(data) || data.version !== 3) throw new Error('Both people need the current HellCon version.');
if (typeof data.sdp !== 'string') throw new Error('Invalid connection description.');
validateDescription(data.sdp, options);
return data.sdp;