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:
1 parent
2167b528b2
commit
b6b6e7c29b
9 files changed
+371
-122
No files matched your search
+20
@@ -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" }
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
-20
@@ -4,15 +4,15 @@ import { createReadStream } from 'node:fs';
|
||||
import { open as openFile, readFile, writeFile } from 'node:fs/promises';
|
||||
import { networkInterfaces } from 'node:os';
|
||||
import {
|
||||
chromium,
|
||||
expect,
|
||||
firefox,
|
||||
test,
|
||||
type Browser,
|
||||
type BrowserContext,
|
||||
type BrowserType,
|
||||
chromium,
|
||||
expect,
|
||||
firefox,
|
||||
type Page,
|
||||
type WebSocket as PageSocket,
|
||||
test,
|
||||
type WebSocketRoute,
|
||||
} from '@playwright/test';
|
||||
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.
|
||||
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] });
|
||||
contexts.push(context);
|
||||
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.
|
||||
async function expectClosed(page: Page) {
|
||||
const peers = () =>
|
||||
page.evaluate(() =>
|
||||
(window as unknown as { peers: RTCPeerConnection[] }).peers.filter((pc) => pc.signalingState !== 'closed').length,
|
||||
page.evaluate(
|
||||
() =>
|
||||
(window as unknown as { peers: RTCPeerConnection[] }).peers.filter((pc) => pc.signalingState !== 'closed')
|
||||
.length,
|
||||
);
|
||||
await expect.poll(peers).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 {
|
||||
await fn();
|
||||
} 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)) ?? '' });
|
||||
}
|
||||
}
|
||||
@@ -353,6 +359,11 @@ async function transfer(
|
||||
expect(await hash(await download.path())).toBe(await hash(source));
|
||||
await expect(receiver.locator('#log')).toContainText('download complete');
|
||||
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(receiver.locator('#receive-progress')).toHaveJSProperty('value', 100);
|
||||
// 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
|
||||
// pairing each way is enough.
|
||||
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 () => {
|
||||
const [sender, receiver] = await Promise.all([open(from), open(to)]);
|
||||
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 () => {
|
||||
const page = await open(name);
|
||||
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');
|
||||
// Both would make the constructors throw.
|
||||
await page.fill('#stun-servers', 'stun:stun.example:99999');
|
||||
@@ -465,7 +482,9 @@ for (const name of Object.keys(BROWSERS)) {
|
||||
await updateWorker(receiver);
|
||||
// The update has to wait instead of replacing the worker that feeds the download.
|
||||
await expect
|
||||
.poll(() => receiver.evaluate(async () => !!(await navigator.serviceWorker.getRegistration('download/'))?.waiting))
|
||||
.poll(() =>
|
||||
receiver.evaluate(async () => !!(await navigator.serviceWorker.getRegistration('download/'))?.waiting),
|
||||
)
|
||||
.toBe(true);
|
||||
expect(await updated(receiver)).toBe(false);
|
||||
await release(receiver);
|
||||
@@ -633,7 +652,9 @@ for (const name of Object.keys(BROWSERS)) {
|
||||
await inject(sender, 10_000);
|
||||
const { download } = await started;
|
||||
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);
|
||||
// Firefox leaves the download stalled instead of failing it, see TODO.md.
|
||||
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.click('#receive');
|
||||
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 () => {
|
||||
const sender = await open(name, { init: countAbortListeners });
|
||||
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;
|
||||
|
||||
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 () => {
|
||||
const pages = await Promise.all([open(name), open(name)]);
|
||||
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>[]);
|
||||
// 0 would announce in a loop, the app waits 30 s at least.
|
||||
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]);
|
||||
// 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);
|
||||
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 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('#copy-send-code')).toBeDisabled();
|
||||
await expect(receiver.locator('#receive-error')).toHaveText(
|
||||
@@ -823,7 +857,9 @@ for (const name of Object.keys(BROWSERS)) {
|
||||
),
|
||||
);
|
||||
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 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.
|
||||
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}$`), {
|
||||
timeout: 45_000,
|
||||
});
|
||||
await expect(receiver.locator('#check-local')).toHaveText(
|
||||
new RegExp(`^(?!${first}$)([0-9A-F]{2} ){7}[0-9A-F]{2}$`),
|
||||
{
|
||||
timeout: 45_000,
|
||||
},
|
||||
);
|
||||
await expect(sender.locator('#check-remote')).toHaveText((await receiver.locator('#check-local').textContent())!);
|
||||
const started = downloadStarts(receiver);
|
||||
await sender.click('#confirm');
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
"build": "vue-tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "vue-tsc",
|
||||
"lint": "biome check",
|
||||
"format": "biome check --write",
|
||||
"test": "playwright test",
|
||||
"test:install": "playwright install chromium firefox",
|
||||
"test:large": "LARGE=1 playwright test -g large"
|
||||
@@ -17,6 +19,7 @@
|
||||
"vue": "^3.5.44"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.5.15",
|
||||
"@playwright/test": "^1.64.1",
|
||||
"@types/node": "^26.6.5",
|
||||
"@vitejs/plugin-vue": "^6.0.10",
|
||||
|
||||
Generated
+95
@@ -170,6 +170,9 @@ importers:
|
||||
specifier: ^3.5.44
|
||||
version: 3.5.44(typescript@6.0.3)
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: 2.5.15
|
||||
version: 2.5.15
|
||||
'@playwright/test':
|
||||
specifier: ^1.64.1
|
||||
version: 1.64.1
|
||||
@@ -208,6 +211,63 @@ packages:
|
||||
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
||||
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':
|
||||
resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==}
|
||||
|
||||
@@ -608,6 +668,41 @@ snapshots:
|
||||
'@babel/helper-string-parser': 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': {}
|
||||
|
||||
'@oxc-project/types@0.154.0': {}
|
||||
|
||||
+12
-3
@@ -23,7 +23,10 @@ function open(id, { name, size }, port) {
|
||||
if (chunk) {
|
||||
download.read += chunk.byteLength;
|
||||
// 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);
|
||||
}
|
||||
controller.close();
|
||||
@@ -41,7 +44,10 @@ function open(id, { name, size }, port) {
|
||||
downloads.set(id, download);
|
||||
|
||||
// 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 = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Length': String(size),
|
||||
@@ -72,7 +78,10 @@ self.addEventListener('message', ({ data, ports: [port] }) => {
|
||||
self.addEventListener('fetch', (event) => {
|
||||
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.
|
||||
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);
|
||||
responses.delete(id);
|
||||
event.respondWith(response ?? new Response('download expired', { status: 404 }));
|
||||
|
||||
+57
-25
@@ -2,17 +2,17 @@
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import {
|
||||
answerOffer,
|
||||
type Check,
|
||||
settings as coreSettings,
|
||||
createOffer,
|
||||
DEFAULT_STUN_SERVERS,
|
||||
DEFAULT_TRACKERS,
|
||||
receiveViaTracker,
|
||||
sendViaTracker,
|
||||
settings as coreSettings,
|
||||
TRACKER_WAIT,
|
||||
type Check,
|
||||
type Events,
|
||||
type Incoming,
|
||||
type ReceiveEvents,
|
||||
receiveViaTracker,
|
||||
sendViaTracker,
|
||||
TRACKER_WAIT,
|
||||
} from './core';
|
||||
|
||||
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.
|
||||
function serverList(key: 'stunServers' | 'trackers', valid: (url: string) => boolean) {
|
||||
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)));
|
||||
// Immediate, a saved list may hold lines this browser rejects.
|
||||
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);
|
||||
}
|
||||
|
||||
// Also once the share failed, every error on the tracker ends it.
|
||||
const codeGone = computed(() => sendExpired.value || !!error.value);
|
||||
// Also once the transfer started, which closes the trackers, and once the share failed: every error on
|
||||
// the tracker ends it.
|
||||
const codeGone = computed(() => sendExpired.value || !!sent.value || !!error.value);
|
||||
|
||||
function onReceive() {
|
||||
const signal = begin('receive');
|
||||
@@ -250,6 +256,7 @@ function onReceive() {
|
||||
<img src="/HellNet_alt.png" alt="" width="40" height="40" />
|
||||
<h1>HellCon</h1>
|
||||
<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" />
|
||||
Use STUN
|
||||
</label>
|
||||
@@ -258,8 +265,8 @@ function onReceive() {
|
||||
<main>
|
||||
<aside v-if="check" role="alert">
|
||||
<p>
|
||||
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is
|
||||
transferred before.
|
||||
Security check: the other side must show the same two codes, swapped. Both sides confirm, nothing is transferred
|
||||
before.
|
||||
</p>
|
||||
<dl>
|
||||
<dt>You</dt>
|
||||
@@ -268,8 +275,8 @@ function onReceive() {
|
||||
<dd><output id="check-remote">{{ check.remote }}</output></dd>
|
||||
</dl>
|
||||
<div v-if="!confirmed">
|
||||
<button id="confirm" @click="onConfirm">Codes match</button>
|
||||
<button id="reject" @click="check.reject()">Codes don't match</button>
|
||||
<button id="confirm" type="button" @click="onConfirm">Codes match</button>
|
||||
<button id="reject" type="button" @click="check.reject()">Codes don't match</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -296,13 +303,15 @@ function onReceive() {
|
||||
|
||||
<section>
|
||||
<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">
|
||||
<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>
|
||||
<div role="group">
|
||||
<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' }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -312,14 +321,18 @@ function onReceive() {
|
||||
<details id="send-manual">
|
||||
<summary>Manual</summary>
|
||||
<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">
|
||||
<label for="offer">Offer, send this to the receiver:</label>
|
||||
<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>
|
||||
<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>
|
||||
</section>
|
||||
</details>
|
||||
@@ -331,7 +344,7 @@ function onReceive() {
|
||||
<template v-if="incoming">
|
||||
<strong>{{ incoming.name }}</strong>
|
||||
{{ 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 v-else>The sender's file shows up here after the security check</template>
|
||||
</div>
|
||||
@@ -353,7 +366,14 @@ function onReceive() {
|
||||
autocorrect="off"
|
||||
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>
|
||||
</section>
|
||||
|
||||
@@ -362,11 +382,15 @@ function onReceive() {
|
||||
<section>
|
||||
<label for="offer-input">Offer from the sender:</label>
|
||||
<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">
|
||||
<label for="answer">Answer, send this back to the sender:</label>
|
||||
<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>
|
||||
</section>
|
||||
</details>
|
||||
@@ -378,16 +402,24 @@ function onReceive() {
|
||||
<section>
|
||||
<h3>STUN</h3>
|
||||
<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>
|
||||
<p v-if="stunServers.invalid.length">Skipped, not a STUN URL this browser accepts: {{ stunServers.invalid.join(', ') }}</p>
|
||||
<textarea
|
||||
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>
|
||||
<h3>Trackers</h3>
|
||||
<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>
|
||||
<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>
|
||||
<button id="reset-servers" @click="onResetServers">Reset to defaults</button>
|
||||
<button id="reset-servers" type="button" @click="onResetServers">Reset to defaults</button>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
|
||||
+71
-55
@@ -106,6 +106,7 @@ function createPeerConnection(signal: AbortSignal) {
|
||||
|
||||
// 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.
|
||||
// biome-ignore lint/suspicious/noExplicitAny: checked field by field, see above
|
||||
type Message = Record<string, any>;
|
||||
|
||||
function parse(data: unknown): Message | undefined {
|
||||
@@ -185,7 +186,12 @@ async function gatherIce(pc: RTCPeerConnection) {
|
||||
// versa, otherwise someone interposed on the signaling.
|
||||
function securityCheck(pc: RTCPeerConnection) {
|
||||
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) };
|
||||
}
|
||||
|
||||
@@ -308,7 +314,10 @@ async function sendFile(
|
||||
await new Promise<void>((resolve) => (wake = resolve));
|
||||
}
|
||||
// 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 (!open()) return;
|
||||
channel.send(chunk);
|
||||
@@ -381,9 +390,9 @@ function receiveFile(
|
||||
let complete = false;
|
||||
let ended = false;
|
||||
// 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[] = []) =>
|
||||
worker.then((worker) => worker?.postMessage({ id, ...message }, transfer));
|
||||
void worker.then((worker) => worker?.postMessage({ id, ...message }, transfer));
|
||||
// To the sender, see sendFile.
|
||||
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.
|
||||
@@ -409,51 +418,54 @@ function receiveFile(
|
||||
}
|
||||
|
||||
function startDownload() {
|
||||
worker = holdWorker().then(({ frame, worker }) => {
|
||||
frames.push(frame);
|
||||
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.
|
||||
worker.addEventListener('statechange', () => {
|
||||
if (worker.state !== 'redundant') return;
|
||||
fail('service worker stopped');
|
||||
release();
|
||||
});
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
port1.onmessage = ({ data }) => {
|
||||
if (typeof data === 'number') {
|
||||
read = data;
|
||||
events.progress(read, meta!.size);
|
||||
return reply({ read });
|
||||
}
|
||||
if (data === 'ready' && !ended) {
|
||||
// A navigation, not fetch(): only navigations hand the response to the download manager.
|
||||
const download = document.createElement('iframe');
|
||||
download.hidden = true;
|
||||
download.src = `download/${id}`;
|
||||
document.body.append(download);
|
||||
frames.push(download);
|
||||
return;
|
||||
}
|
||||
if (data === 'failed') fail('the service worker refused it');
|
||||
if (data === 'finished') {
|
||||
events.log('download complete');
|
||||
events.progress(meta!.size, meta!.size);
|
||||
reply({ done: true });
|
||||
}
|
||||
if (data === 'cancelled' && !ended) {
|
||||
events.log('download cancelled');
|
||||
reply({ error: 'download cancelled' });
|
||||
}
|
||||
ended = true;
|
||||
channel.close();
|
||||
release();
|
||||
};
|
||||
worker.postMessage({ id, ...meta }, [port2]);
|
||||
return worker;
|
||||
}, (error) => fail(String(error)));
|
||||
worker = holdWorker().then(
|
||||
({ frame, worker }) => {
|
||||
frames.push(frame);
|
||||
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.
|
||||
worker.addEventListener('statechange', () => {
|
||||
if (worker.state !== 'redundant') return;
|
||||
fail('service worker stopped');
|
||||
release();
|
||||
});
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
port1.onmessage = ({ data }) => {
|
||||
if (typeof data === 'number') {
|
||||
read = data;
|
||||
events.progress(read, meta!.size);
|
||||
return reply({ read });
|
||||
}
|
||||
if (data === 'ready' && !ended) {
|
||||
// A navigation, not fetch(): only navigations hand the response to the download manager.
|
||||
const download = document.createElement('iframe');
|
||||
download.hidden = true;
|
||||
download.src = `download/${id}`;
|
||||
document.body.append(download);
|
||||
frames.push(download);
|
||||
return;
|
||||
}
|
||||
if (data === 'failed') fail('the service worker refused it');
|
||||
if (data === 'finished') {
|
||||
events.log('download complete');
|
||||
events.progress(meta!.size, meta!.size);
|
||||
reply({ done: true });
|
||||
}
|
||||
if (data === 'cancelled' && !ended) {
|
||||
events.log('download cancelled');
|
||||
reply({ error: 'download cancelled' });
|
||||
}
|
||||
ended = true;
|
||||
channel.close();
|
||||
release();
|
||||
};
|
||||
worker.postMessage({ id, ...meta }, [port2]);
|
||||
return worker;
|
||||
},
|
||||
(error) => void fail(String(error)),
|
||||
);
|
||||
}
|
||||
|
||||
handshake.checked.then(() => {
|
||||
void handshake.checked.then(() => {
|
||||
confirmed = true;
|
||||
reply({ ok: true });
|
||||
events.log('waiting for the sender');
|
||||
@@ -528,8 +540,7 @@ export async function createOffer(file: File, events: Events, signal: AbortSigna
|
||||
events = live(events, signal);
|
||||
const pc = createPeerConnection(signal);
|
||||
const channel = pc.createDataChannel('file');
|
||||
channel.onopen = () =>
|
||||
sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
|
||||
channel.onopen = () => sendFile(pc, channel, file, events, connected(pc, channel, 'manual exchange', events), signal);
|
||||
failUnconnected(pc, () => channel.readyState !== 'connecting', events);
|
||||
await pc.setLocalDescription();
|
||||
await gatherIce(pc);
|
||||
@@ -655,7 +666,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
let shared = false;
|
||||
let expired = false;
|
||||
// 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.
|
||||
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');
|
||||
const offer = waiting;
|
||||
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;
|
||||
events.log(`offer via ${url}`);
|
||||
const pc = createPeerConnection(signal);
|
||||
@@ -708,7 +723,7 @@ export async function sendViaTracker(file: File, events: Events, signal: AbortSi
|
||||
expiry.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', () => {
|
||||
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;
|
||||
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);
|
||||
else answer(tracker.ws, url, offer);
|
||||
else void answer(tracker.ws, url, offer);
|
||||
},
|
||||
() => stranded() && end(noTracker(trackers)),
|
||||
() => 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);
|
||||
};
|
||||
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()
|
||||
|
||||
+53
-18
@@ -1,4 +1,6 @@
|
||||
*, *::before, *::after {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -17,16 +19,29 @@ body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
img, picture, video, canvas, svg {
|
||||
img,
|
||||
picture,
|
||||
video,
|
||||
canvas,
|
||||
svg {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
input, button, textarea, select {
|
||||
input,
|
||||
button,
|
||||
textarea,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
p, h1, h2, h3, h4, h5, h6 {
|
||||
p,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
@@ -34,7 +49,12 @@ p {
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
@@ -85,7 +105,9 @@ body {
|
||||
|
||||
/* Layout */
|
||||
|
||||
header, main, footer {
|
||||
header,
|
||||
main,
|
||||
footer {
|
||||
max-width: 64rem;
|
||||
margin-inline: auto;
|
||||
padding-inline: var(--space-4);
|
||||
@@ -114,13 +136,15 @@ main {
|
||||
padding-bottom: var(--space-8);
|
||||
}
|
||||
|
||||
main > aside, main > details {
|
||||
main > aside,
|
||||
main > details {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
|
||||
article, details {
|
||||
article,
|
||||
details {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
@@ -147,7 +171,8 @@ section {
|
||||
border-top: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
h3, article summary {
|
||||
h3,
|
||||
article summary {
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
@@ -155,7 +180,8 @@ h3, article summary {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
label, section p {
|
||||
label,
|
||||
section p {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
@@ -166,7 +192,8 @@ header label {
|
||||
|
||||
/* Forms */
|
||||
|
||||
input, textarea {
|
||||
input,
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
background: var(--color-input);
|
||||
@@ -176,12 +203,14 @@ input, textarea {
|
||||
transition: border-color var(--transition);
|
||||
}
|
||||
|
||||
input:focus, textarea:focus {
|
||||
input:focus,
|
||||
textarea:focus {
|
||||
border-color: var(--color-secondary);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
#send-code, #receive-code {
|
||||
#send-code,
|
||||
#receive-code {
|
||||
color: var(--color-secondary-text);
|
||||
font-family: ui-monospace, monospace;
|
||||
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. */
|
||||
|
||||
label:has(> [type='file']), #incoming {
|
||||
label:has(> [type='file']),
|
||||
#incoming {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -297,10 +328,13 @@ label:has(> [type='file']), #incoming {
|
||||
border: 2px dashed var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -330,7 +364,8 @@ label:has(> [type='file']:focus-visible) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label strong, #incoming strong {
|
||||
label strong,
|
||||
#incoming strong {
|
||||
color: var(--color-text);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
|
||||
Reference in new issue
Block a user