Improve a11y
This commit is contained in:
1 parent
e9818aaeda
commit
00b2ec7d5c
8 files changed
+97
-27
No files matched your search
@@ -76,7 +76,9 @@ relay candidates it accepts, not arbitrary software run by the other person.
|
||||
When a credential endpoint is configured (including the local development setup
|
||||
below), **Use the configured relay with temporary credentials** replaces manual
|
||||
credential entry. The app fetches fresh credentials for each new connection,
|
||||
only after TURN opt-in. Uncheck it to use a different relay manually.
|
||||
only after TURN opt-in. The issued relay address, username and masked password
|
||||
appear in read-only fields while the connection is active. Uncheck it to use a
|
||||
different relay manually.
|
||||
|
||||
TURN credentials stay in the current component's memory; the app does not persist
|
||||
them or include them in codes. The relay receives its authentication exchange and
|
||||
@@ -150,7 +152,7 @@ bun run test # protocol and temporary-credential unit tests
|
||||
bun run test:turn # real Chromium file transfer, forced TURN/UDP
|
||||
bun run test:turn --tcp # same test, TURN/TCP only
|
||||
bun run build
|
||||
bun run test:browser # direct-path browser regressions
|
||||
bun run test:browser # direct-path browser regressions and axe accessibility checks
|
||||
docker compose --env-file .env.development logs --tail=50 coturn
|
||||
```
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
"vue": "^3.5.43",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22",
|
||||
"@types/node": "^26.6.4",
|
||||
"@vitejs/plugin-vue": "^6.0.9",
|
||||
"typescript": "~5.9.3",
|
||||
"vite": "^8",
|
||||
"axe-core": "^4.14.0",
|
||||
"typescript": "~6.0.3",
|
||||
"vite": "^8.3.4",
|
||||
"vue-tsc": "^3.3.12",
|
||||
},
|
||||
},
|
||||
@@ -61,7 +62,7 @@
|
||||
|
||||
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
|
||||
|
||||
"@types/node": ["@types/node@22.20.5", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA=="],
|
||||
"@types/node": ["@types/node@26.6.4", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg=="],
|
||||
|
||||
"@vitejs/plugin-vue": ["@vitejs/plugin-vue@6.0.9", "", { "dependencies": { "@rolldown/pluginutils": "^1.0.1" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", "vue": "^3.2.25" } }, "sha512-rD/MORlhaZMlXWW0rEn4FB4wMinWC0z/D7Ye160S5+Rs1mC8ZDAdcDp4SjKfUhG5t8q1ktcPVw4xuTkPRlzrSA=="],
|
||||
|
||||
@@ -93,6 +94,8 @@
|
||||
|
||||
"alien-signals": ["alien-signals@3.2.1", "", {}, "sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g=="],
|
||||
|
||||
"axe-core": ["axe-core@4.14.0", "", {}, "sha512-9WTZxEjsZ7b13TH8JPmbV2z8CHbl80/2hm3XPEG4JgNdQLK81IBRXmSxHfMAOkSqQeRxT/0dwNDz2GOm3zzpcQ=="],
|
||||
|
||||
"csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="],
|
||||
|
||||
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
||||
@@ -149,9 +152,9 @@
|
||||
|
||||
"tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="],
|
||||
|
||||
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
||||
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
||||
|
||||
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
"undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="],
|
||||
|
||||
"vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="],
|
||||
|
||||
|
||||
+4
-3
@@ -21,10 +21,11 @@
|
||||
"vue": "^3.5.43"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22",
|
||||
"@types/node": "^26.6.4",
|
||||
"@vitejs/plugin-vue": "^6.0.9",
|
||||
"typescript": "~5.9.3",
|
||||
"vite": "^8",
|
||||
"axe-core": "^4.14.0",
|
||||
"typescript": "~6.0.3",
|
||||
"vite": "^8.3.4",
|
||||
"vue-tsc": "^3.3.12"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -9,6 +9,7 @@ import { tmpdir } from 'node:os';
|
||||
import { dirname, extname, join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const axeSource = await readFile(join(root, 'node_modules/axe-core/axe.min.js'), 'utf8');
|
||||
const provider = process.argv.includes('--default-network') ? 'google' : 'none';
|
||||
const turn = process.argv.includes('--turn');
|
||||
const transport = process.argv.includes('--tcp') ? 'tcp' : 'udp';
|
||||
@@ -103,6 +104,16 @@ async function page() {
|
||||
await wait(sessionId, () => !!document.querySelector('#stun-provider'));
|
||||
return sessionId;
|
||||
}
|
||||
async function checkAccessibility(session: string, mode: string) {
|
||||
const injected = await call('Runtime.evaluate', { expression: axeSource }, session);
|
||||
assert.equal(injected.exceptionDetails, undefined, 'axe-core should load in the page');
|
||||
const violations = await evaluate(session, async () => {
|
||||
const axe = (window as unknown as { axe: { run: (context: Document) => Promise<{ violations: Array<{ id: string; nodes: Array<{ target: string[] }> }> }> } }).axe;
|
||||
const results = await axe.run(document);
|
||||
return results.violations.map(({ id, nodes }) => ({ id, targets: nodes.map(({ target }) => target) }));
|
||||
});
|
||||
assert.deepEqual(violations, [], `${mode} mode accessibility violations`);
|
||||
}
|
||||
const click = (session: string, label: string) => evaluate(session, (label: string) => window.__hellcon.click(label), label);
|
||||
const input = (session: string, selector: string, value: string) => evaluate(session, (selector: string, value: string) => window.__hellcon.input(selector, value), selector, value);
|
||||
const enableTurn = (session: string) => evaluate(session, () => {
|
||||
@@ -149,10 +160,18 @@ async function connect(sender: string, receiver: string, size: number) {
|
||||
try {
|
||||
const sender = await page(), receiver = await page();
|
||||
await click(receiver, 'Receive');
|
||||
await checkAccessibility(sender, 'Send');
|
||||
await checkAccessibility(receiver, 'Receive');
|
||||
console.log('PASS: axe-core accessibility scan in initial Send and Receive modes.');
|
||||
assert.equal(await evaluate(sender, () => window.__hellcon.element<HTMLInputElement>('.checkbox input').checked), false);
|
||||
await connect(sender, receiver, 2 * 1024 * 1024 + 7);
|
||||
await checkAccessibility(sender, 'Send during transfer');
|
||||
await checkAccessibility(receiver, 'Receive before accepting a file');
|
||||
await click(receiver, 'Receive in memory (up to 64 MiB)');
|
||||
await wait(sender, () => window.__hellcon.element('[role=status]').textContent?.includes('confirmed the complete file'));
|
||||
await checkAccessibility(sender, 'Send after transfer');
|
||||
await checkAccessibility(receiver, 'Receive after transfer');
|
||||
console.log('PASS: axe-core accessibility scan during and after transfer.');
|
||||
const data = await evaluate(receiver, async () => {
|
||||
const response = await fetch(window.__hellcon.element<HTMLAnchorElement>('a.download').href);
|
||||
const bytes = new Uint8Array(await response.arrayBuffer());
|
||||
|
||||
+6
-3
@@ -7,19 +7,22 @@ const mode = ref<'send' | 'receive'>('send');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<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 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 />
|
||||
</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