Improve a11y
This commit is contained in:
1 parent
e9818aaeda
commit
00b2ec7d5c
8 files changed
+105
-35
No files matched your search
@@ -34,6 +34,7 @@ const dragover = ref(false);
|
||||
const iceEndpoint = import.meta.env.VITE_ICE_ENDPOINT || '';
|
||||
const defaultStun = import.meta.env.VITE_STUN_URL || '';
|
||||
const settings = ref<NetworkSettingsModel>({ stunChoice: defaultStun ? 'custom' : 'google', customStun: defaultStun, allowTurn: false, managedTurn: !!iceEndpoint, turnUrl: '', username: '', credential: '' });
|
||||
const managedCredentials = ref<IceOptions | null>(null);
|
||||
const canSaveToDisk = typeof window.showSaveFilePicker === 'function';
|
||||
let active: Session | null = null;
|
||||
let copyTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
@@ -70,6 +71,7 @@ function dispose() {
|
||||
}
|
||||
function reset(keepNetwork = false) {
|
||||
dispose(); revokeDownload(); clearTimeout(copyTimer);
|
||||
managedCredentials.value = null;
|
||||
if (!keepNetwork) settings.value.allowTurn = false;
|
||||
inputCode.value = outputCode.value = error.value = '';
|
||||
fps.value = incoming.value = null;
|
||||
@@ -79,6 +81,7 @@ function reset(keepNetwork = false) {
|
||||
function fail(session: Session, err: unknown) {
|
||||
if (active !== session) return;
|
||||
dispose(); revokeDownload();
|
||||
managedCredentials.value = null;
|
||||
fps.value = incoming.value = null;
|
||||
outputCode.value = ''; verified.value = false;
|
||||
settings.value.allowTurn = false;
|
||||
@@ -105,6 +108,7 @@ function attach(session: Session, channel: RTCDataChannel) {
|
||||
onComplete: ({ blob }) => {
|
||||
if (active !== session) return;
|
||||
progress.value = 100;
|
||||
managedCredentials.value = null;
|
||||
settings.value.allowTurn = false;
|
||||
if (blob) downloadUrl.value = URL.createObjectURL(blob);
|
||||
// The receiver leaves the channel open until its completion ACK reaches the sender.
|
||||
@@ -153,6 +157,7 @@ async function createCode() {
|
||||
const configured = await fetchTurnOptions(session.options, iceEndpoint, { signal: session.controller.signal });
|
||||
if (active !== session) return;
|
||||
session.pc.setConfiguration(iceConfiguration(configured));
|
||||
managedCredentials.value = session.options.allowTurn && session.options.managedTurn ? configured : null;
|
||||
const options = { ...session.options, signal: session.controller.signal };
|
||||
if (props.sending) attach(session, session.pc.createDataChannel('hellcon-v2'));
|
||||
const code = props.sending ? await createOfferCode(session.pc, options) : await createAnswerCode(session.pc, pasted, options);
|
||||
@@ -242,7 +247,7 @@ onBeforeUnmount(() => { dispose(); revokeDownload(); clearTimeout(copyTimer); })
|
||||
</div>
|
||||
<p v-if="file" class="file-chip"><span>{{ file.name }}</span><span>{{ formatBytes(file.size) }}</span></p>
|
||||
</template>
|
||||
<NetworkSettings v-model="settings" :disabled="busy" />
|
||||
<NetworkSettings v-model="settings" :disabled="busy" :managed-credentials="managedCredentials" />
|
||||
<p class="status">Connection codes are not encrypted: they can reveal your IP address and connection details to anyone who sees them. Exchange them privately with your intended peer.</p>
|
||||
<template v-if="!sending">
|
||||
<label class="step" for="offer-input">Paste the sender’s connection code</label>
|
||||
@@ -260,7 +265,7 @@ onBeforeUnmount(() => { dispose(); revokeDownload(); clearTimeout(copyTimer); })
|
||||
<button class="primary" :disabled="step !== 'offer-ready' || !inputCode.trim()" @click="useAnswer">Connect</button>
|
||||
</template>
|
||||
<div v-if="fps" class="fingerprint">
|
||||
<label class="step">Verify both full SHA-256 fingerprints</label>
|
||||
<h2 class="step">Verify both full SHA-256 fingerprints</h2>
|
||||
<div class="fp-row"><span>Your fingerprint</span><code>{{ fps.local }}</code></div>
|
||||
<div class="fp-row"><span>Their fingerprint</span><code>{{ fps.remote }}</code></div>
|
||||
<p class="status">Compare every byte over an authenticated channel an attacker cannot alter (for example, an in-person comparison). Your fingerprint must match their “Their fingerprint”, and vice versa. If either differs, cancel. Both people must confirm before the filename or contents are sent.</p>
|
||||
|
||||
Reference in new issue
Block a user