Lint and format with Biome, and retire used share codes

Biome formats and lints the TypeScript, the Vue templates and the CSS:
pnpm lint checks, pnpm format fixes. It keeps the existing style, single
quotes and 120 columns, and leaves the vendored logo alone. Besides its
recommended rules it looks for promises nobody awaits. Rules that only
flagged deliberate code are off: non-null assertions that state what the
code guarantees, CSS order where no two rules set the same property, and
fieldset for role="group". The one-time formatting pass mostly splits
long chains.

Promises that are deliberately not awaited are marked with void, none of
them can reject today. Buttons say type="button", the any for peer
messages and the checkbox switch keep their reasons in ignore comments.

The sender's code also counts as no longer valid once a transfer started:
that closes the trackers, so another receiver would wait for nothing,
yet the card still offered the code with Copy. The tracker transfer
tests check it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-24 18:46:33 +02:00
1 parent 2167b528b2
commit b6b6e7c29b
9 files changed
+330 -81

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": { "includes": ["**", "!**/node_modules", "!**/dist", "!**/test-results", "!**/*.svg"] },
"formatter": { "indentStyle": "space", "lineWidth": 120 },
"javascript": { "formatter": { "quoteStyle": "single" } },
"css": { "formatter": { "quoteStyle": "single" } },
"html": {
"experimentalFullSupportEnabled": true,
"formatter": { "enabled": true, "selfCloseVoidElements": "always" }
},
"linter": {
"rules": {
"preset": "recommended",
"nursery": { "noFloatingPromises": "error", "noMisusedPromises": "error" },
"style": { "noNonNullAssertion": "off", "noDescendingSpecificity": "off" },
"a11y": { "useSemanticElements": "off" }
}
}
}
+58 -19
View File
@@ -4,15 +4,15 @@ import { createReadStream } from 'node:fs';
import { open as openFile, readFile, writeFile } from 'node:fs/promises'; import { open as openFile, readFile, writeFile } from 'node:fs/promises';
import { networkInterfaces } from 'node:os'; import { networkInterfaces } from 'node:os';
import { import {
chromium,
expect,
firefox,
test,
type Browser, type Browser,
type BrowserContext, type BrowserContext,
type BrowserType, type BrowserType,
chromium,
expect,
firefox,
type Page, type Page,
type WebSocket as PageSocket, type WebSocket as PageSocket,
test,
type WebSocketRoute, type WebSocketRoute,
} from '@playwright/test'; } from '@playwright/test';
import { build, createServer, preview, type ViteDevServer } from 'vite'; import { build, createServer, preview, type ViteDevServer } from 'vite';
@@ -130,7 +130,8 @@ test.afterAll(async () => {
// init runs in the page before the app. base is the app's URL, the dev server's by default. // init runs in the page before the app. base is the app's URL, the dev server's by default.
async function open(name: string, { init, base = url }: { init?: () => void; base?: string } = {}) { async function open(name: string, { init, base = url }: { init?: () => void; base?: string } = {}) {
const browser = await (browsers[name] ??= BROWSERS[name]!.launch()); browsers[name] ??= BROWSERS[name]!.launch();
const browser = await browsers[name];
const context = await browser.newContext({ permissions: PERMISSIONS[name] }); const context = await browser.newContext({ permissions: PERMISSIONS[name] });
contexts.push(context); contexts.push(context);
const page = await context.newPage(); const page = await context.newPage();
@@ -192,8 +193,10 @@ function trackPeers() {
// Everything the page opened for a transfer is closed again: its peer connections and tracker sockets. // Everything the page opened for a transfer is closed again: its peer connections and tracker sockets.
async function expectClosed(page: Page) { async function expectClosed(page: Page) {
const peers = () => const peers = () =>
page.evaluate(() => page.evaluate(
(window as unknown as { peers: RTCPeerConnection[] }).peers.filter((pc) => pc.signalingState !== 'closed').length, () =>
(window as unknown as { peers: RTCPeerConnection[] }).peers.filter((pc) => pc.signalingState !== 'closed')
.length,
); );
await expect.poll(peers).toBe(0); await expect.poll(peers).toBe(0);
await expect.poll(() => sockets.get(page)!.filter((ws) => !ws.isClosed()).length).toBe(0); await expect.poll(() => sockets.get(page)!.filter((ws) => !ws.isClosed()).length).toBe(0);
@@ -289,7 +292,10 @@ async function withLogs(sender: Page, receiver: Page, fn: () => Promise<void>) {
try { try {
await fn(); await fn();
} finally { } finally {
for (const [name, page] of [['sender', sender], ['receiver', receiver]] as const) { for (const [name, page] of [
['sender', sender],
['receiver', receiver],
] as const) {
await test.info().attach(`${name} log`, { body: (await log(page).catch(() => null)) ?? '' }); await test.info().attach(`${name} log`, { body: (await log(page).catch(() => null)) ?? '' });
} }
} }
@@ -353,6 +359,11 @@ async function transfer(
expect(await hash(await download.path())).toBe(await hash(source)); expect(await hash(await download.path())).toBe(await hash(source));
await expect(receiver.locator('#log')).toContainText('download complete'); await expect(receiver.locator('#log')).toContainText('download complete');
await expect(sender.locator('#log')).toContainText('delivered'); await expect(sender.locator('#log')).toContainText('delivered');
if (mode === 'tracker') {
// The transfer used the share up, another receiver would wait for nothing.
await expect(sender.locator('label[for=send-code]')).toHaveText('Code, no longer valid:');
await expect(sender.locator('#copy-send-code')).toBeDisabled();
}
await expect(sender.locator('#send-progress')).toHaveJSProperty('value', 100); await expect(sender.locator('#send-progress')).toHaveJSProperty('value', 100);
await expect(receiver.locator('#receive-progress')).toHaveJSProperty('value', 100); await expect(receiver.locator('#receive-progress')).toHaveJSProperty('value', 100);
// Removed hidden pages release the service worker for updates. // Removed hidden pages release the service worker for updates.
@@ -383,7 +394,10 @@ for (const from of Object.keys(BROWSERS)) {
// Through the public STUN servers and trackers. The signaling doesn't depend on the browser pair, one // Through the public STUN servers and trackers. The signaling doesn't depend on the browser pair, one
// pairing each way is enough. // pairing each way is enough.
for (const mode of ['manual', 'tracker']) { for (const mode of ['manual', 'tracker']) {
for (const [from, to] of [['chromium', 'firefox'], ['firefox', 'chromium']] as const) { for (const [from, to] of [
['chromium', 'firefox'],
['firefox', 'chromium'],
] as const) {
test(`live ${mode}: ${from} sends to ${to}`, async () => { test(`live ${mode}: ${from} sends to ${to}`, async () => {
const [sender, receiver] = await Promise.all([open(from), open(to)]); const [sender, receiver] = await Promise.all([open(from), open(to)]);
await transfer(mode, sender, receiver, await payload(randomBytes(SIZE)), SIZE); await transfer(mode, sender, receiver, await payload(randomBytes(SIZE)), SIZE);
@@ -409,7 +423,10 @@ for (const name of Object.keys(BROWSERS)) {
test(`servers: ${name} skips invalid lines and keeps the lists over a reload`, async () => { test(`servers: ${name} skips invalid lines and keeps the lists over a reload`, async () => {
const page = await open(name); const page = await open(name);
const core = () => const core = () =>
page.evaluate((path) => import(path).then(({ settings }) => [settings.stunServers, settings.trackers]), '/src/core.ts'); page.evaluate(
(path) => import(path).then(({ settings }) => [settings.stunServers, settings.trackers]),
'/src/core.ts',
);
await page.click('#servers summary'); await page.click('#servers summary');
// Both would make the constructors throw. // Both would make the constructors throw.
await page.fill('#stun-servers', 'stun:stun.example:99999'); await page.fill('#stun-servers', 'stun:stun.example:99999');
@@ -465,7 +482,9 @@ for (const name of Object.keys(BROWSERS)) {
await updateWorker(receiver); await updateWorker(receiver);
// The update has to wait instead of replacing the worker that feeds the download. // The update has to wait instead of replacing the worker that feeds the download.
await expect await expect
.poll(() => receiver.evaluate(async () => !!(await navigator.serviceWorker.getRegistration('download/'))?.waiting)) .poll(() =>
receiver.evaluate(async () => !!(await navigator.serviceWorker.getRegistration('download/'))?.waiting),
)
.toBe(true); .toBe(true);
expect(await updated(receiver)).toBe(false); expect(await updated(receiver)).toBe(false);
await release(receiver); await release(receiver);
@@ -633,7 +652,9 @@ for (const name of Object.keys(BROWSERS)) {
await inject(sender, 10_000); await inject(sender, 10_000);
const { download } = await started; const { download } = await started;
await inject(sender, 10_001); await inject(sender, 10_001);
await expect(receiver.locator('#receive-error')).toHaveText('download failed: the sender sent more than it offered'); await expect(receiver.locator('#receive-error')).toHaveText(
'download failed: the sender sent more than it offered',
);
await expect(receiver.locator('iframe')).toHaveCount(0); await expect(receiver.locator('iframe')).toHaveCount(0);
// Firefox leaves the download stalled instead of failing it, see TODO.md. // Firefox leaves the download stalled instead of failing it, see TODO.md.
if (name === 'chromium') expect(await download.failure()).not.toBeNull(); if (name === 'chromium') expect(await download.failure()).not.toBeNull();
@@ -730,7 +751,12 @@ for (const name of Object.keys(BROWSERS)) {
await receiver.fill('#receive-code', (await sender.locator('#send-code').textContent())!); await receiver.fill('#receive-code', (await sender.locator('#send-code').textContent())!);
await receiver.click('#receive'); await receiver.click('#receive');
await expect(receiver.locator('#receive-error')).toHaveText(rejected); await expect(receiver.locator('#receive-error')).toHaveText(rejected);
await expect.poll(() => trackers.map(({ sockets, open }) => [sockets.length, open])).toEqual([[2, 0], [2, 0]]); await expect
.poll(() => trackers.map(({ sockets, open }) => [sockets.length, open]))
.toEqual([
[2, 0],
[2, 0],
]);
}); });
}); });
@@ -739,7 +765,8 @@ for (const name of Object.keys(BROWSERS)) {
test(`tracker: ${name} sender keeps nothing of repeated unusable offers`, async () => { test(`tracker: ${name} sender keeps nothing of repeated unusable offers`, async () => {
const sender = await open(name, { init: countAbortListeners }); const sender = await open(name, { init: countAbortListeners });
const trackers = await mockTrackers(sender, ({ info_hash }) => ({ action: 'announce', interval: 120, info_hash })); const trackers = await mockTrackers(sender, ({ info_hash }) => ({ action: 'announce', interval: 120, info_hash }));
const listeners = () => sender.evaluate(() => (window as unknown as { abortListeners: () => number }).abortListeners()); const listeners = () =>
sender.evaluate(() => (window as unknown as { abortListeners: () => number }).abortListeners());
const unusable = async () => (await log(sender))!.match(/unusable offer/g)?.length ?? 0; const unusable = async () => (await log(sender))!.match(/unusable offer/g)?.length ?? 0;
await withLogs(sender, sender, async () => { await withLogs(sender, sender, async () => {
@@ -765,6 +792,7 @@ for (const name of Object.keys(BROWSERS)) {
test(`tracker: ${name} both sides announce again until they give up after 6 minutes`, async () => { test(`tracker: ${name} both sides announce again until they give up after 6 minutes`, async () => {
const pages = await Promise.all([open(name), open(name)]); const pages = await Promise.all([open(name), open(name)]);
const [sender, receiver] = pages as [Page, Page]; const [sender, receiver] = pages as [Page, Page];
// biome-ignore lint/suspicious/noExplicitAny: raw tracker messages, the test reads nested fields as it needs them
const announced = pages.map(() => [] as Record<string, any>[]); const announced = pages.map(() => [] as Record<string, any>[]);
// 0 would announce in a loop, the app waits 30 s at least. // 0 would announce in a loop, the app waits 30 s at least.
const trackers = await Promise.all( const trackers = await Promise.all(
@@ -795,10 +823,16 @@ for (const name of Object.keys(BROWSERS)) {
await expect.poll(() => again().map((msgs) => msgs.length)).toEqual([2, 2]); await expect.poll(() => again().map((msgs) => msgs.length)).toEqual([2, 2]);
// The receiver's offers again, a busy sender may have dropped them. // The receiver's offers again, a busy sender may have dropped them.
const offers = announced[1]!.filter((msg) => msg.event === 'started').map((msg) => msg.offers[0].offer_id); const offers = announced[1]!.filter((msg) => msg.event === 'started').map((msg) => msg.offers[0].offer_id);
expect(again()[1]!.map((msg) => msg.offers[0].offer_id).sort()).toEqual(offers.sort()); expect(
again()[1]!
.map((msg) => msg.offers[0].offer_id)
.sort(),
).toEqual(offers.sort());
await fastForward(330_000); await fastForward(330_000);
await expect(sender.locator('#send-error')).toHaveText('nobody received the file within 6 minutes, share it again'); await expect(sender.locator('#send-error')).toHaveText(
'nobody received the file within 6 minutes, share it again',
);
await expect(sender.locator('label[for=send-code]')).toHaveText('Code, no longer valid:'); await expect(sender.locator('label[for=send-code]')).toHaveText('Code, no longer valid:');
await expect(sender.locator('#copy-send-code')).toBeDisabled(); await expect(sender.locator('#copy-send-code')).toBeDisabled();
await expect(receiver.locator('#receive-error')).toHaveText( await expect(receiver.locator('#receive-error')).toHaveText(
@@ -823,7 +857,9 @@ for (const name of Object.keys(BROWSERS)) {
), ),
); );
const deadlines = () => const deadlines = () =>
Promise.all(pages.map((page) => page.evaluate(() => (window as unknown as { deadlines: () => number }).deadlines()))); Promise.all(
pages.map((page) => page.evaluate(() => (window as unknown as { deadlines: () => number }).deadlines())),
);
await withLogs(sender, receiver, async () => { await withLogs(sender, receiver, async () => {
await sender.setInputFiles('input[type=file]', await payload(randomBytes(1000))); await sender.setInputFiles('input[type=file]', await payload(randomBytes(1000)));
@@ -886,9 +922,12 @@ for (const name of Object.keys(BROWSERS)) {
// The sender notices the receiver left, Chromium only once the connection counts as failed. // The sender notices the receiver left, Chromium only once the connection counts as failed.
await expect(sender.locator('#log')).toContainText('waiting for the next receiver', { timeout: 30_000 }); await expect(sender.locator('#log')).toContainText('waiting for the next receiver', { timeout: 30_000 });
await expect(receiver.locator('#check-local')).toHaveText(new RegExp(`^(?!${first}$)([0-9A-F]{2} ){7}[0-9A-F]{2}$`), { await expect(receiver.locator('#check-local')).toHaveText(
new RegExp(`^(?!${first}$)([0-9A-F]{2} ){7}[0-9A-F]{2}$`),
{
timeout: 45_000, timeout: 45_000,
}); },
);
await expect(sender.locator('#check-remote')).toHaveText((await receiver.locator('#check-local').textContent())!); await expect(sender.locator('#check-remote')).toHaveText((await receiver.locator('#check-local').textContent())!);
const started = downloadStarts(receiver); const started = downloadStarts(receiver);
await sender.click('#confirm'); await sender.click('#confirm');
+3
View File
@@ -9,6 +9,8 @@
"build": "vue-tsc && vite build", "build": "vue-tsc && vite build",
"preview": "vite preview", "preview": "vite preview",
"typecheck": "vue-tsc", "typecheck": "vue-tsc",
"lint": "biome check",
"format": "biome check --write",
"test": "playwright test", "test": "playwright test",
"test:install": "playwright install chromium firefox", "test:install": "playwright install chromium firefox",
"test:large": "LARGE=1 playwright test -g large" "test:large": "LARGE=1 playwright test -g large"
@@ -17,6 +19,7 @@
"vue": "^3.5.44" "vue": "^3.5.44"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "2.5.15",
"@playwright/test": "^1.64.1", "@playwright/test": "^1.64.1",
"@types/node": "^26.6.5", "@types/node": "^26.6.5",
"@vitejs/plugin-vue": "^6.0.10", "@vitejs/plugin-vue": "^6.0.10",
+95
View File
@@ -170,6 +170,9 @@ importers:
specifier: ^3.5.44 specifier: ^3.5.44
version: 3.5.44(typescript@6.0.3) version: 3.5.44(typescript@6.0.3)
devDependencies: devDependencies:
'@biomejs/biome':
specifier: 2.5.15
version: 2.5.15
'@playwright/test': '@playwright/test':
specifier: ^1.64.1 specifier: ^1.64.1
version: 1.64.1 version: 1.64.1
@@ -208,6 +211,63 @@ packages:
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==} resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@biomejs/biome@2.5.15':
resolution: {integrity: sha512-WZTW4slm/pdkh92K6t/3aEN++44JD1PQ7squ7RCMLI1flHGl43DVOIGXvCjHiZgBMO1V4uYxoFNtqrIA4qGuIQ==}
engines: {node: '>=14.21.3'}
hasBin: true
'@biomejs/cli-darwin-arm64@2.5.15':
resolution: {integrity: sha512-BZVzFhJ/mUvTLMYbc9x6el0o2Uv5zP7bACYyhFb6fSc1giroXm7PL0a5KqMJ9F+/BnkYRjagD/ROSDVOZ6eapg==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [darwin]
'@biomejs/cli-darwin-x64@2.5.15':
resolution: {integrity: sha512-V5Kw63V+fVGNFhFrizDxMbGXAzZCh8kYzJpy3GI6gTapWDg7bZK9oYC9CbVgQSEdTnupz0U5Efz8Ev+5vdBBXw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [darwin]
'@biomejs/cli-linux-arm64-musl@2.5.15':
resolution: {integrity: sha512-tGzZUTcJCV7tj5Adh/Gn6nR4MycqA3iohq2LEcrarAgRBkU0h0OKd2UzCRkOsOYOuUGaUJb4YmqRqyy2feGGSw==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
libc: [musl]
'@biomejs/cli-linux-arm64@2.5.15':
resolution: {integrity: sha512-XaG7P7eeSLYETD3K9grfB0mQmpLQZjygdbsxekWBJAg4am79fGAtRpfRyNnTvXB2fZFNnJZG3nXm7HBat0+VUw==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@biomejs/cli-linux-x64-musl@2.5.15':
resolution: {integrity: sha512-IlxUcyxilVGPsE008x13pWdkTbU3nQpP2i9b5UrbOYj6goBkKsRX1XB7yJLcV+O1H9LBchIIm4adOaVLZBX0ZQ==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
libc: [musl]
'@biomejs/cli-linux-x64@2.5.15':
resolution: {integrity: sha512-xE4iEW/3LqlYj9GFgGrFsFSH51dEEpUbYWBfeOv0q87WkUDxK2o/HhreSb7qMJqck70RVM6Lg96hgedcAYcOkA==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
libc: [glibc]
'@biomejs/cli-win32-arm64@2.5.15':
resolution: {integrity: sha512-2kPKzhNlm8C+Ru3GcO0Me2ODkCBLrVOUNuyi84RJyWDVKAA4+Kjj3jMjL938lF6BRfvltC4vB2nPY9SvN51Ovg==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [win32]
'@biomejs/cli-win32-x64@2.5.15':
resolution: {integrity: sha512-yAzh4UqEImV6Hcy0zjUqNfJAsUhoD64FBQCdTG8Md/Z2wQeVP/ZmJ3XRYAs1g8J9fjTFyl2fCtc5FB5til47+g==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [win32]
'@jridgewell/sourcemap-codec@1.6.0': '@jridgewell/sourcemap-codec@1.6.0':
resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==}
@@ -608,6 +668,41 @@ snapshots:
'@babel/helper-string-parser': 7.29.7 '@babel/helper-string-parser': 7.29.7
'@babel/helper-validator-identifier': 7.29.7 '@babel/helper-validator-identifier': 7.29.7
'@biomejs/biome@2.5.15':
optionalDependencies:
'@biomejs/cli-darwin-arm64': 2.5.15
'@biomejs/cli-darwin-x64': 2.5.15
'@biomejs/cli-linux-arm64': 2.5.15
'@biomejs/cli-linux-arm64-musl': 2.5.15
'@biomejs/cli-linux-x64': 2.5.15
'@biomejs/cli-linux-x64-musl': 2.5.15
'@biomejs/cli-win32-arm64': 2.5.15
'@biomejs/cli-win32-x64': 2.5.15
'@biomejs/cli-darwin-arm64@2.5.15':
optional: true
'@biomejs/cli-darwin-x64@2.5.15':
optional: true
'@biomejs/cli-linux-arm64-musl@2.5.15':
optional: true
'@biomejs/cli-linux-arm64@2.5.15':
optional: true
'@biomejs/cli-linux-x64-musl@2.5.15':
optional: true
'@biomejs/cli-linux-x64@2.5.15':
optional: true
'@biomejs/cli-win32-arm64@2.5.15':
optional: true
'@biomejs/cli-win32-x64@2.5.15':
optional: true
'@jridgewell/sourcemap-codec@1.6.0': {} '@jridgewell/sourcemap-codec@1.6.0': {}
'@oxc-project/types@0.154.0': {} '@oxc-project/types@0.154.0': {}
+12 -3
View File
@@ -23,7 +23,10 @@ function open(id, { name, size }, port) {
if (chunk) { if (chunk) {
download.read += chunk.byteLength; download.read += chunk.byteLength;
// Every MiB, src/core.ts forwards it to the sender for its flow control window. // Every MiB, src/core.ts forwards it to the sender for its flow control window.
if (download.read - download.reported >= 2 ** 20) port.postMessage((download.reported = download.read)); if (download.read - download.reported >= 2 ** 20) {
download.reported = download.read;
port.postMessage(download.read);
}
return controller.enqueue(chunk); return controller.enqueue(chunk);
} }
controller.close(); controller.close();
@@ -41,7 +44,10 @@ function open(id, { name, size }, port) {
downloads.set(id, download); downloads.set(id, download);
// RFC 8187 encoding, which leaves nothing in the name that could end the header value. // RFC 8187 encoding, which leaves nothing in the name that could end the header value.
const encoded = encodeURIComponent(name.toWellFormed()).replace(/['()*]/g, (char) => `%${char.charCodeAt(0).toString(16)}`); const encoded = encodeURIComponent(name.toWellFormed()).replace(
/['()*]/g,
(char) => `%${char.charCodeAt(0).toString(16)}`,
);
const headers = { const headers = {
'Content-Type': 'application/octet-stream', 'Content-Type': 'application/octet-stream',
'Content-Length': String(size), 'Content-Length': String(size),
@@ -72,7 +78,10 @@ self.addEventListener('message', ({ data, ports: [port] }) => {
self.addEventListener('fetch', (event) => { self.addEventListener('fetch', (event) => {
const id = new URL(event.request.url).pathname.split('/').pop(); const id = new URL(event.request.url).pathname.split('/').pop();
// download/ itself is the empty page src/core.ts keeps open to hold this worker during a transfer. // download/ itself is the empty page src/core.ts keeps open to hold this worker during a transfer.
if (!id) return event.respondWith(new Response('<!doctype html>', { headers: { 'Content-Type': 'text/html; charset=utf-8' } })); if (!id)
return event.respondWith(
new Response('<!doctype html>', { headers: { 'Content-Type': 'text/html; charset=utf-8' } }),
);
const response = responses.get(id); const response = responses.get(id);
responses.delete(id); responses.delete(id);
event.respondWith(response ?? new Response('download expired', { status: 404 })); event.respondWith(response ?? new Response('download expired', { status: 404 }));
+57 -25
View File
@@ -2,17 +2,17 @@
import { computed, reactive, ref, watch } from 'vue'; import { computed, reactive, ref, watch } from 'vue';
import { import {
answerOffer, answerOffer,
type Check,
settings as coreSettings,
createOffer, createOffer,
DEFAULT_STUN_SERVERS, DEFAULT_STUN_SERVERS,
DEFAULT_TRACKERS, DEFAULT_TRACKERS,
receiveViaTracker,
sendViaTracker,
settings as coreSettings,
TRACKER_WAIT,
type Check,
type Events, type Events,
type Incoming, type Incoming,
type ReceiveEvents, type ReceiveEvents,
receiveViaTracker,
sendViaTracker,
TRACKER_WAIT,
} from './core'; } from './core';
const SETTINGS_KEY = 'hellcon:settings'; const SETTINGS_KEY = 'hellcon:settings';
@@ -61,7 +61,12 @@ const isTracker = (url: string) =>
// A textarea with one URL per line for the list at settings[key], invalid lines are listed and skipped. // A textarea with one URL per line for the list at settings[key], invalid lines are listed and skipped.
function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) { function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) {
const text = ref(settings[key].join('\n')); const text = ref(settings[key].join('\n'));
const lines = computed(() => text.value.split('\n').map((line) => line.trim()).filter(Boolean)); const lines = computed(() =>
text.value
.split('\n')
.map((line) => line.trim())
.filter(Boolean),
);
const invalid = computed(() => lines.value.filter((line) => !valid(line))); const invalid = computed(() => lines.value.filter((line) => !valid(line)));
// Immediate, a saved list may hold lines this browser rejects. // Immediate, a saved list may hold lines this browser rejects.
watch(lines, (lines) => (settings[key] = lines.filter(valid)), { immediate: true }); watch(lines, (lines) => (settings[key] = lines.filter(valid)), { immediate: true });
@@ -236,8 +241,9 @@ async function onShare() {
sendTimer = window.setTimeout(() => (sendExpired.value = true), TRACKER_WAIT); sendTimer = window.setTimeout(() => (sendExpired.value = true), TRACKER_WAIT);
} }
// Also once the share failed, every error on the tracker ends it. // Also once the transfer started, which closes the trackers, and once the share failed: every error on
const codeGone = computed(() => sendExpired.value || !!error.value); // the tracker ends it.
const codeGone = computed(() => sendExpired.value || !!sent.value || !!error.value);
function onReceive() { function onReceive() {
const signal = begin('receive'); const signal = begin('receive');
@@ -250,6 +256,7 @@ function onReceive() {
<img src="/HellNet_alt.png" alt="" width="40" height="40" /> <img src="/HellNet_alt.png" alt="" width="40" height="40" />
<h1>HellCon</h1> <h1>HellCon</h1>
<label> <label>
<!-- biome-ignore lint/a11y/useAriaPropsForRole: a checkbox reports its own state, aria-checked on it is not allowed -->
<input id="stun" v-model="settings.stun" type="checkbox" role="switch" /> <input id="stun" v-model="settings.stun" type="checkbox" role="switch" />
Use STUN Use STUN
</label> </label>
@@ -258,8 +265,8 @@ function onReceive() {
<main> <main>
<aside v-if="check" role="alert"> <aside v-if="check" role="alert">
<p> <p>
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is transferred
transferred before. before.
</p> </p>
<dl> <dl>
<dt>You</dt> <dt>You</dt>
@@ -268,8 +275,8 @@ function onReceive() {
<dd><output id="check-remote">{{ check.remote }}</output></dd> <dd><output id="check-remote">{{ check.remote }}</output></dd>
</dl> </dl>
<div v-if="!confirmed"> <div v-if="!confirmed">
<button id="confirm" @click="onConfirm">Codes match</button> <button id="confirm" type="button" @click="onConfirm">Codes match</button>
<button id="reject" @click="check.reject()">Codes don't match</button> <button id="reject" type="button" @click="check.reject()">Codes don't match</button>
</div> </div>
</aside> </aside>
@@ -296,13 +303,15 @@ function onReceive() {
<section> <section>
<h3>Tracker</h3> <h3>Tracker</h3>
<button id="share" :disabled="!file || !settings.trackers.length" @click="onShare">Share via tracker</button> <button id="share" type="button" :disabled="!file || !settings.trackers.length" @click="onShare">
Share via tracker
</button>
<template v-if="sendCode"> <template v-if="sendCode">
<label v-if="codeGone" for="send-code">Code, no longer valid:</label> <label v-if="codeGone" for="send-code">Code, no longer valid:</label>
<label v-else for="send-code">Code, give this to the receiver, valid until {{ sendUntil }}:</label> <label v-else for="send-code">Code, give this to the receiver, valid until {{ sendUntil }}:</label>
<div role="group"> <div role="group">
<output id="send-code" :data-expired="codeGone || undefined">{{ sendCode }}</output> <output id="send-code" :data-expired="codeGone || undefined">{{ sendCode }}</output>
<button id="copy-send-code" data-copy :disabled="codeGone" @click="onCopy(sendCode)"> <button id="copy-send-code" type="button" data-copy :disabled="codeGone" @click="onCopy(sendCode)">
{{ copied === sendCode ? 'Copied' : 'Copy' }} {{ copied === sendCode ? 'Copied' : 'Copy' }}
</button> </button>
</div> </div>
@@ -312,14 +321,18 @@ function onReceive() {
<details id="send-manual"> <details id="send-manual">
<summary>Manual</summary> <summary>Manual</summary>
<section> <section>
<button id="create-offer" :disabled="!file" @click="onCreateOffer">Create offer</button> <button id="create-offer" type="button" :disabled="!file" @click="onCreateOffer">Create offer</button>
<template v-if="offer"> <template v-if="offer">
<label for="offer">Offer, send this to the receiver:</label> <label for="offer">Offer, send this to the receiver:</label>
<textarea id="offer" readonly :value="offer"></textarea> <textarea id="offer" readonly :value="offer"></textarea>
<button id="copy-offer" data-copy @click="onCopy(offer)">{{ copied === offer ? 'Copied' : 'Copy' }}</button> <button id="copy-offer" type="button" data-copy @click="onCopy(offer)">
{{ copied === offer ? 'Copied' : 'Copy' }}
</button>
<label for="answer-input">Answer from the receiver:</label> <label for="answer-input">Answer from the receiver:</label>
<textarea id="answer-input" v-model="answerInput"></textarea> <textarea id="answer-input" v-model="answerInput"></textarea>
<button id="accept-answer" :disabled="!answerInput.trim()" @click="onAcceptAnswer">Connect</button> <button id="accept-answer" type="button" :disabled="!answerInput.trim()" @click="onAcceptAnswer">
Connect
</button>
</template> </template>
</section> </section>
</details> </details>
@@ -331,7 +344,7 @@ function onReceive() {
<template v-if="incoming"> <template v-if="incoming">
<strong>{{ incoming.name }}</strong> <strong>{{ incoming.name }}</strong>
{{ formatSize(incoming.size) }} {{ formatSize(incoming.size) }}
<button v-if="!received" id="download" @click="incoming.download()">Download</button> <button v-if="!received" id="download" type="button" @click="incoming.download()">Download</button>
</template> </template>
<template v-else>The sender's file shows up here after the security check</template> <template v-else>The sender's file shows up here after the security check</template>
</div> </div>
@@ -353,7 +366,14 @@ function onReceive() {
autocorrect="off" autocorrect="off"
spellcheck="false" spellcheck="false"
/> />
<button id="receive" :disabled="!settings.trackers.length || !receiveCode.trim()" @click="onReceive">Receive</button> <button
id="receive"
type="button"
:disabled="!settings.trackers.length || !receiveCode.trim()"
@click="onReceive"
>
Receive
</button>
</div> </div>
</section> </section>
@@ -362,11 +382,15 @@ function onReceive() {
<section> <section>
<label for="offer-input">Offer from the sender:</label> <label for="offer-input">Offer from the sender:</label>
<textarea id="offer-input" v-model="offerInput"></textarea> <textarea id="offer-input" v-model="offerInput"></textarea>
<button id="create-answer" :disabled="!offerInput.trim()" @click="onCreateAnswer">Create answer</button> <button id="create-answer" type="button" :disabled="!offerInput.trim()" @click="onCreateAnswer">
Create answer
</button>
<template v-if="answer"> <template v-if="answer">
<label for="answer">Answer, send this back to the sender:</label> <label for="answer">Answer, send this back to the sender:</label>
<textarea id="answer" readonly :value="answer"></textarea> <textarea id="answer" readonly :value="answer"></textarea>
<button id="copy-answer" data-copy @click="onCopy(answer)">{{ copied === answer ? 'Copied' : 'Copy' }}</button> <button id="copy-answer" type="button" data-copy @click="onCopy(answer)">
{{ copied === answer ? 'Copied' : 'Copy' }}
</button>
</template> </template>
</section> </section>
</details> </details>
@@ -378,16 +402,24 @@ function onReceive() {
<section> <section>
<h3>STUN</h3> <h3>STUN</h3>
<label for="stun-servers">Tell each side its public address, one URL per line:</label> <label for="stun-servers">Tell each side its public address, one URL per line:</label>
<textarea id="stun-servers" v-model="stunServers.text" :aria-invalid="!!stunServers.invalid.length"></textarea> <textarea
<p v-if="stunServers.invalid.length">Skipped, not a STUN URL this browser accepts: {{ stunServers.invalid.join(', ') }}</p> id="stun-servers"
v-model="stunServers.text"
:aria-invalid="!!stunServers.invalid.length"
></textarea>
<p v-if="stunServers.invalid.length">
Skipped, not a STUN URL this browser accepts: {{ stunServers.invalid.join(', ') }}
</p>
</section> </section>
<section> <section>
<h3>Trackers</h3> <h3>Trackers</h3>
<label for="trackers">WebTorrent trackers for the code exchange, one URL per line:</label> <label for="trackers">WebTorrent trackers for the code exchange, one URL per line:</label>
<textarea id="trackers" v-model="trackers.text" :aria-invalid="!!trackers.invalid.length"></textarea> <textarea id="trackers" v-model="trackers.text" :aria-invalid="!!trackers.invalid.length"></textarea>
<p v-if="trackers.invalid.length">Skipped, not a ws: or wss: URL without #: {{ trackers.invalid.join(', ') }}</p> <p v-if="trackers.invalid.length">
Skipped, not a ws: or wss: URL without #: {{ trackers.invalid.join(', ') }}
</p>
</section> </section>
<button id="reset-servers" @click="onResetServers">Reset to defaults</button> <button id="reset-servers" type="button" @click="onResetServers">Reset to defaults</button>
</div> </div>
</details> </details>
+31 -15
View File
@@ -106,6 +106,7 @@ function createPeerConnection(signal: AbortSignal) {
// Peers and trackers send JSON objects. Anything else, malformed or not an object, counts as nothing. // Peers and trackers send JSON objects. Anything else, malformed or not an object, counts as nothing.
// Whatever is read from one has to be checked, the any only saves the casts for that. // Whatever is read from one has to be checked, the any only saves the casts for that.
// biome-ignore lint/suspicious/noExplicitAny: checked field by field, see above
type Message = Record<string, any>; type Message = Record<string, any>;
function parse(data: unknown): Message | undefined { function parse(data: unknown): Message | undefined {
@@ -185,7 +186,12 @@ async function gatherIce(pc: RTCPeerConnection) {
// versa, otherwise someone interposed on the signaling. // versa, otherwise someone interposed on the signaling.
function securityCheck(pc: RTCPeerConnection) { function securityCheck(pc: RTCPeerConnection) {
const short = (sdp = '') => const short = (sdp = '') =>
sdp.match(/a=fingerprint:\S+ ([0-9A-F:]+)/i)?.[1]?.toUpperCase().split(':').slice(0, 8).join(' ') ?? '?'; sdp
.match(/a=fingerprint:\S+ ([0-9A-F:]+)/i)?.[1]
?.toUpperCase()
.split(':')
.slice(0, 8)
.join(' ') ?? '?';
return { local: short(pc.localDescription?.sdp), remote: short(pc.remoteDescription?.sdp) }; return { local: short(pc.localDescription?.sdp), remote: short(pc.remoteDescription?.sdp) };
} }
@@ -308,7 +314,10 @@ async function sendFile(
await new Promise<void>((resolve) => (wake = resolve)); await new Promise<void>((resolve) => (wake = resolve));
} }
// E.g. the file was changed or deleted since it was picked. // E.g. the file was changed or deleted since it was picked.
const chunk = await file.slice(offset, offset + CHUNK_SIZE).arrayBuffer().catch(() => undefined); const chunk = await file
.slice(offset, offset + CHUNK_SIZE)
.arrayBuffer()
.catch(() => undefined);
if (!chunk) return stop(`could not read ${file.name} anymore`); if (!chunk) return stop(`could not read ${file.name} anymore`);
if (!open()) return; if (!open()) return;
channel.send(chunk); channel.send(chunk);
@@ -381,9 +390,9 @@ function receiveFile(
let complete = false; let complete = false;
let ended = false; let ended = false;
// Chunks can arrive before the worker is held, chaining every post on this keeps them in order. // Chunks can arrive before the worker is held, chaining every post on this keeps them in order.
let worker: Promise<ServiceWorker | void> = Promise.resolve(); let worker: Promise<ServiceWorker | undefined> = Promise.resolve(undefined);
const post = (message: object, transfer: Transferable[] = []) => const post = (message: object, transfer: Transferable[] = []) =>
worker.then((worker) => worker?.postMessage({ id, ...message }, transfer)); void worker.then((worker) => worker?.postMessage({ id, ...message }, transfer));
// To the sender, see sendFile. // To the sender, see sendFile.
const reply = (message: object) => channel.readyState === 'open' && channel.send(JSON.stringify(message)); const reply = (message: object) => channel.readyState === 'open' && channel.send(JSON.stringify(message));
// A data channel closes only after sending what it buffered, so the last reply still arrives. // A data channel closes only after sending what it buffered, so the last reply still arrives.
@@ -409,7 +418,8 @@ function receiveFile(
} }
function startDownload() { function startDownload() {
worker = holdWorker().then(({ frame, worker }) => { worker = holdWorker().then(
({ frame, worker }) => {
frames.push(frame); frames.push(frame);
keepalive = setInterval(() => post({ ping: true }), KEEPALIVE); keepalive = setInterval(() => post({ ping: true }), KEEPALIVE);
// Only if something else than an update stops it, e.g. clearing the site data. It can't answer. // Only if something else than an update stops it, e.g. clearing the site data. It can't answer.
@@ -450,10 +460,12 @@ function receiveFile(
}; };
worker.postMessage({ id, ...meta }, [port2]); worker.postMessage({ id, ...meta }, [port2]);
return worker; return worker;
}, (error) => fail(String(error))); },
(error) => void fail(String(error)),
);
} }
handshake.checked.then(() => { void handshake.checked.then(() => {
confirmed = true; confirmed = true;
reply({ ok: true }); reply({ ok: true });
events.log('waiting for the sender'); events.log('waiting for the sender');
@@ -528,8 +540,7 @@ export async function createOffer(file: File, events: Events, signal: AbortSigna
events = live(events, signal); events = live(events, signal);
const pc = createPeerConnection(signal); const pc = createPeerConnection(signal);
const channel = pc.createDataChannel('file'); const channel = pc.createDataChannel('file');
channel.onopen = () => channel.onopen = () => sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
failUnconnected(pc, () => channel.readyState !== 'connecting', events); failUnconnected(pc, () => channel.readyState !== 'connecting', events);
await pc.setLocalDescription(); await pc.setLocalDescription();
await gatherIce(pc); await gatherIce(pc);
@@ -655,7 +666,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
let shared = false; let shared = false;
let expired = false; let expired = false;
// The latest offer that came while busy, answered once that peer is out. // The latest offer that came while busy, answered once that peer is out.
let waiting: (() => void) | undefined; let waiting: (() => Promise<void>) | undefined;
// Without a tracker no further receiver can find the share. // Without a tracker no further receiver can find the share.
const stranded = () => !shared && !busy && !trackers.some((tracker) => tracker.alive()); const stranded = () => !shared && !busy && !trackers.some((tracker) => tracker.alive());
@@ -678,10 +689,14 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
events.log('waiting for the next receiver'); events.log('waiting for the next receiver');
const offer = waiting; const offer = waiting;
waiting = undefined; waiting = undefined;
offer?.(); void offer?.();
} }
async function answer(ws: WebSocket, url: string, msg: { offer: { sdp: string }; peer_id: string; offer_id: string }) { async function answer(
ws: WebSocket,
url: string,
msg: { offer: { sdp: string }; peer_id: string; offer_id: string },
) {
busy = true; busy = true;
events.log(`offer via ${url}`); events.log(`offer via ${url}`);
const pc = createPeerConnection(signal); const pc = createPeerConnection(signal);
@@ -708,7 +723,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
expiry.close(); expiry.close();
for (const tracker of trackers) tracker.close(); for (const tracker of trackers) tracker.close();
}; };
sendFile(pc, channel, file, events, { ...handshake, start }, signal); void sendFile(pc, channel, file, events, { ...handshake, start }, signal);
}; };
pc.addEventListener('connectionstatechange', () => { pc.addEventListener('connectionstatechange', () => {
if (pc.connectionState === 'failed') giveUp('receiver did not connect'); if (pc.connectionState === 'failed') giveUp('receiver did not connect');
@@ -740,7 +755,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
if (typeof msg.offer_id !== 'string') return; if (typeof msg.offer_id !== 'string') return;
const offer = { offer: { sdp: msg.offer.sdp }, peer_id: msg.peer_id, offer_id: msg.offer_id }; const offer = { offer: { sdp: msg.offer.sdp }, peer_id: msg.peer_id, offer_id: msg.offer_id };
if (busy) waiting = () => answer(tracker.ws, url, offer); if (busy) waiting = () => answer(tracker.ws, url, offer);
else answer(tracker.ws, url, offer); else void answer(tracker.ws, url, offer);
}, },
() => stranded() && end(noTracker(trackers)), () => stranded() && end(noTracker(trackers)),
() => announce(tracker.ws, hash, peerId, { left: 0 }), () => announce(tracker.ws, hash, peerId, { left: 0 }),
@@ -830,7 +845,8 @@ export async function receiveViaTracker(code: string, events: ReceiveEvents, sig
receiveFile(pc, channel, events, { ...handshake, start }, signal); receiveFile(pc, channel, events, { ...handshake, start }, signal);
}; };
pc.addEventListener('connectionstatechange', () => { pc.addEventListener('connectionstatechange', () => {
if (pc.connectionState === 'failed' && channel.readyState === 'connecting') retry(`sender via ${url} did not connect`); if (pc.connectionState === 'failed' && channel.readyState === 'connecting')
retry(`sender via ${url} did not connect`);
}); });
pc.setLocalDescription() pc.setLocalDescription()
+53 -18
View File
@@ -1,4 +1,6 @@
*, *::before, *::after { *,
*::before,
*::after {
box-sizing: border-box; box-sizing: border-box;
} }
@@ -17,16 +19,29 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
img, picture, video, canvas, svg { img,
picture,
video,
canvas,
svg {
display: block; display: block;
max-width: 100%; max-width: 100%;
} }
input, button, textarea, select { input,
button,
textarea,
select {
font: inherit; font: inherit;
} }
p, h1, h2, h3, h4, h5, h6 { p,
h1,
h2,
h3,
h4,
h5,
h6 {
overflow-wrap: break-word; overflow-wrap: break-word;
} }
@@ -34,7 +49,12 @@ p {
text-wrap: pretty; text-wrap: pretty;
} }
h1, h2, h3, h4, h5, h6 { h1,
h2,
h3,
h4,
h5,
h6 {
text-wrap: balance; text-wrap: balance;
} }
@@ -85,7 +105,9 @@ body {
/* Layout */ /* Layout */
header, main, footer { header,
main,
footer {
max-width: 64rem; max-width: 64rem;
margin-inline: auto; margin-inline: auto;
padding-inline: var(--space-4); padding-inline: var(--space-4);
@@ -114,13 +136,15 @@ main {
padding-bottom: var(--space-8); padding-bottom: var(--space-8);
} }
main > aside, main > details { main > aside,
main > details {
grid-column: 1 / -1; grid-column: 1 / -1;
} }
/* Cards */ /* Cards */
article, details { article,
details {
background: var(--color-surface); background: var(--color-surface);
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
border-radius: var(--radius); border-radius: var(--radius);
@@ -147,7 +171,8 @@ section {
border-top: 1px solid var(--color-border); border-top: 1px solid var(--color-border);
} }
h3, article summary { h3,
article summary {
font-size: var(--text-sm); font-size: var(--text-sm);
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
@@ -155,7 +180,8 @@ h3, article summary {
color: var(--color-text-muted); color: var(--color-text-muted);
} }
label, section p { label,
section p {
font-size: var(--text-sm); font-size: var(--text-sm);
color: var(--color-text-muted); color: var(--color-text-muted);
} }
@@ -166,7 +192,8 @@ header label {
/* Forms */ /* Forms */
input, textarea { input,
textarea {
width: 100%; width: 100%;
padding: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3);
background: var(--color-input); background: var(--color-input);
@@ -176,12 +203,14 @@ input, textarea {
transition: border-color var(--transition); transition: border-color var(--transition);
} }
input:focus, textarea:focus { input:focus,
textarea:focus {
border-color: var(--color-secondary); border-color: var(--color-secondary);
} }
/* Text fields show focus with their border, everything else, the switch too, with :focus-visible */ /* Text fields show focus with their border, everything else, the switch too, with :focus-visible */
input:not([type='checkbox'], [type='file']):focus-visible, textarea:focus-visible { input:not([type='checkbox'], [type='file']):focus-visible,
textarea:focus-visible {
outline: none; outline: none;
} }
@@ -229,7 +258,8 @@ button:disabled {
} }
/* The tracker code on both sides. The sender's is read only like an input, one click selects it. */ /* The tracker code on both sides. The sender's is read only like an input, one click selects it. */
#send-code, #receive-code { #send-code,
#receive-code {
color: var(--color-secondary-text); color: var(--color-secondary-text);
font-family: ui-monospace, monospace; font-family: ui-monospace, monospace;
font-size: var(--text-lg); font-size: var(--text-lg);
@@ -286,7 +316,8 @@ article details section {
/* Drop zone, the invisible file input covers the whole label. The incoming file looks alike. */ /* Drop zone, the invisible file input covers the whole label. The incoming file looks alike. */
label:has(> [type='file']), #incoming { label:has(> [type='file']),
#incoming {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -297,10 +328,13 @@ label:has(> [type='file']), #incoming {
border: 2px dashed var(--color-border); border: 2px dashed var(--color-border);
border-radius: var(--radius); border-radius: var(--radius);
text-align: center; text-align: center;
transition: border-color var(--transition), background-color var(--transition); transition:
border-color var(--transition),
background-color var(--transition);
} }
label:has(> [type='file']):hover, label[data-dragging] { label:has(> [type='file']):hover,
label[data-dragging] {
border-color: var(--color-primary); border-color: var(--color-primary);
} }
@@ -330,7 +364,8 @@ label:has(> [type='file']:focus-visible) {
cursor: pointer; cursor: pointer;
} }
label strong, #incoming strong { label strong,
#incoming strong {
color: var(--color-text); color: var(--color-text);
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],