Improve a11y
This commit is contained in:
1 parent
e9818aaeda
commit
00b2ec7d5c
8 files changed
+105
-35
No files matched your search
+14
-11
@@ -7,19 +7,22 @@ const mode = ref<'send' | 'receive'>('send');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>HellCon</h1>
|
||||
<p class="subtitle">
|
||||
Browser-to-browser file sharing. No account or file-hosting backend.
|
||||
Direct WebRTC connections, with an optional relay you explicitly enable.
|
||||
</p>
|
||||
<a class="skip-link" href="#main-content">Skip to main content</a>
|
||||
<main id="main-content" tabindex="-1">
|
||||
<h1>HellCon</h1>
|
||||
<p class="subtitle">
|
||||
Browser-to-browser file sharing. No account or file-hosting backend.
|
||||
Direct WebRTC connections, with an optional relay you explicitly enable.
|
||||
</p>
|
||||
|
||||
<div class="tabs" style="width: 100%; max-width: 680px">
|
||||
<button :class="{ active: mode === 'send' }" @click="mode = 'send'">Send</button>
|
||||
<button :class="{ active: mode === 'receive' }" @click="mode = 'receive'">Receive</button>
|
||||
</div>
|
||||
<div class="tabs" role="group" aria-label="Transfer mode">
|
||||
<button :class="{ active: mode === 'send' }" :aria-pressed="mode === 'send'" @click="mode = 'send'">Send</button>
|
||||
<button :class="{ active: mode === 'receive' }" :aria-pressed="mode === 'receive'" @click="mode = 'receive'">Receive</button>
|
||||
</div>
|
||||
|
||||
<SendPanel v-if="mode === 'send'" />
|
||||
<ReceivePanel v-else />
|
||||
<SendPanel v-if="mode === 'send'" />
|
||||
<ReceivePanel v-else />
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { NetworkSettings } from '../lib/webrtc.ts';
|
||||
import type { IceOptions, NetworkSettings } from '../lib/webrtc.ts';
|
||||
import { STUN_PROVIDERS } from '../lib/webrtc.ts';
|
||||
const settings = defineModel<NetworkSettings>({ required: true });
|
||||
defineProps<{ disabled?: boolean }>();
|
||||
defineProps<{ disabled?: boolean; managedCredentials?: IceOptions | null }>();
|
||||
const iceEndpoint = import.meta.env.VITE_ICE_ENDPOINT || '';
|
||||
</script>
|
||||
|
||||
@@ -20,7 +20,13 @@ const iceEndpoint = import.meta.env.VITE_ICE_ENDPOINT || '';
|
||||
<template v-if="settings.allowTurn">
|
||||
<p class="status">Both people must opt in. Your browser may contact this relay and route encrypted file traffic through it. The operator sees addresses, timing and traffic volume, and may charge for bandwidth. Use credentials you are authorized to use; they remain in this tab.</p>
|
||||
<label v-if="iceEndpoint" class="checkbox"><input type="checkbox" v-model="settings.managedTurn" /> Use the configured relay with temporary credentials</label>
|
||||
<template v-if="!iceEndpoint || !settings.managedTurn">
|
||||
<template v-if="iceEndpoint && settings.managedTurn">
|
||||
<p v-if="!managedCredentials" class="status">The relay details will appear here when you create a connection code.</p>
|
||||
<input class="stun-input" aria-label="TURN address" :value="Array.isArray(managedCredentials?.turnUrl) ? managedCredentials.turnUrl.join(', ') : managedCredentials?.turnUrl || ''" placeholder="TURN address (filled when creating a code)" readonly />
|
||||
<input class="stun-input" aria-label="TURN username" :value="managedCredentials?.username || ''" placeholder="TURN username (filled when creating a code)" readonly />
|
||||
<input class="stun-input" type="password" aria-label="TURN password" :value="managedCredentials?.credential || ''" placeholder="TURN password (filled when creating a code)" autocomplete="off" readonly />
|
||||
</template>
|
||||
<template v-else>
|
||||
<input v-model="settings.turnUrl" class="stun-input" aria-label="TURN address" placeholder="turns:relay.example:5349?transport=tcp" autocomplete="off" />
|
||||
<input v-model="settings.username" class="stun-input" aria-label="TURN username" placeholder="TURN username" autocomplete="off" />
|
||||
<input v-model="settings.credential" class="stun-input" type="password" aria-label="TURN password" placeholder="TURN password" autocomplete="off" />
|
||||
|
||||
@@ -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>
|
||||
|
||||
+39
-8
@@ -3,8 +3,8 @@
|
||||
--bg: #0f1117;
|
||||
--panel: #181b24;
|
||||
--border: #2a2f3d;
|
||||
--accent: #e8452c;
|
||||
--accent-soft: rgba(232, 69, 44, 0.15);
|
||||
--accent: #ff9b3d;
|
||||
--accent-soft: rgba(255, 155, 61, 0.15);
|
||||
--text: #e8eaf0;
|
||||
--muted: #8b91a3;
|
||||
}
|
||||
@@ -28,6 +28,30 @@ body {
|
||||
padding-inline: 0.9rem;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
left: 0.9rem;
|
||||
top: 0.5rem;
|
||||
transform: translateY(-200%);
|
||||
z-index: 1;
|
||||
padding: 0.55rem 0.8rem;
|
||||
border-radius: 8px;
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.skip-link:focus {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.panel {
|
||||
width: 100%;
|
||||
max-width: 680px;
|
||||
@@ -55,6 +79,8 @@ h1 {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
width: 100%;
|
||||
max-width: 680px;
|
||||
}
|
||||
|
||||
.tabs button {
|
||||
@@ -67,7 +93,7 @@ button {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
padding: 0.55rem 1rem;
|
||||
font-size: 0.95rem;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -75,10 +101,15 @@ button:hover:not(:disabled) {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
:where(a, button, input, select, textarea):focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
button.primary {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
color: var(--bg);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -88,13 +119,14 @@ button:disabled {
|
||||
}
|
||||
|
||||
.tabs button.active {
|
||||
background: var(--accent-soft);
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
color: var(--bg);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
label.step {
|
||||
.step {
|
||||
margin: 0;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
@@ -231,7 +263,6 @@ footer p {
|
||||
|
||||
.stun-select:focus,
|
||||
.stun-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user