Release 0.0.4

This commit is contained in:
Schluffe committed 2026-10-16 14:57:17 +02:00
1 parent 7856725c72
commit 3ae47dde8e
10 files changed
+56 -26

No files matched your search

+19 -7
View File
@@ -1,14 +1,26 @@
# Changelog
## Unreleased
## [0.0.4] - 2026-10-16
### Added
- Added streaming downloads for the hosted app using a same-origin service
worker, with a 64 GiB cap and bounded buffering. Verified real 120 MiB downloads
in Chromium and Brave without the native file picker.
- Kept `file://` copies independent of hosted helpers; they continue to use the
native save picker or the 64 MiB in-memory option.
- Distinguished handing a file to the browser's download manager from confirming
that it was saved to disk. Added worker tests and a real-download browser check.
worker with bounded buffering. Verified real 120 MiB downloads in Chromium
and Brave without the native file picker.
- Worker tests for byte counts, backpressure, cancellation, and single-use URLs,
plus a browser check that verifies actual downloaded file contents.
- Guidance to use desktop Chrome for large files in the downloaded local version.
### Changed
- Removed the app-defined 64 GiB file-size cap for streamed and native disk
transfers. Browser, filesystem, available storage, and exact byte-count limits
still apply. The 64 MiB in-memory safety cap remains in place.
- Download receive buttons now show the incoming file size instead of a size cap.
- Streaming completion reports that bytes were handed to the browser; users
should check Downloads for the final save result.
- Local `file://` copies remain independent of hosted helpers and use the native
save picker or the in-memory option. Service-worker downloads are hosted-only.
## [0.0.3] - 2026-10-09
+5 -4
View File
@@ -1,6 +1,6 @@
# HellCon
Current version: **0.0.3**. See the [changelog](CHANGELOG.md) for release notes
Current version: **0.0.4**. See the [changelog](CHANGELOG.md) for release notes
and compatibility changes.
Browser-to-browser file sharing with Vue 3 and WebRTC. No accounts, signaling
@@ -23,8 +23,7 @@ explicit opt-in by both people; no relay is configured automatically.
Compare every byte. Cancel on any mismatch. Both people must explicitly
confirm before the app sends the filename, size, MIME metadata, or contents.
4. The receiver sees the filename and size and explicitly accepts the file.
On the hosted app (HTTPS or localhost), **Receive as download** streams up to
64 GiB into the browser's download manager using a same-origin service worker.
On the hosted app (HTTPS or localhost), **Receive as download** shows the incoming file size and streams into the browser's download manager using a same-origin service worker.
It requires transferable streams and service-worker support; Chromium and
Brave have been tested with 120 MiB files. Allow the download and keep the
receiving tab open. File contents are not uploaded to the web host.
@@ -37,7 +36,9 @@ explicit opt-in by both people; no relay is configured automatically.
after constructing the complete download. A streaming receipt does not prove
the download manager successfully saved the file: check its final status in
Downloads. This also does not prove a human saved a memory download, nor that
a malicious receiver told the truth. The 64 GiB cap is not a tested size guarantee.
a malicious receiver told the truth. Streamed transfers have no app-defined size cap; browser, filesystem, and
available storage limits apply. Byte counts must remain safe JavaScript integers
(at most 2^53 − 1 bytes). Files above 120 MiB have not been tested end to end.
Cancel, reset, changing the selected file, or switching Send/Receive closes the
connection and aborts unfinished disk writes. Keep the tab open until receipt is
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "hellcon",
"private": true,
"version": "0.0.3",
"version": "0.0.4",
"license": "MIT",
"type": "module",
"scripts": {
+1 -1
View File
@@ -7,7 +7,7 @@ self.addEventListener('message', event => {
const port = event.ports[0];
if (type !== 'download' || !port || !/^[a-f0-9]{32}$/.test(id) ||
typeof name !== 'string' || name.length > 255 || /[\r\n/\\]/.test(name) ||
!Number.isSafeInteger(size) || size < 0 || size > 64 * 1024 ** 3 ||
!Number.isSafeInteger(size) || size < 0 ||
!(stream instanceof ReadableStream) || downloads.has(id)) return;
const reader = stream.getReader();
let controller, finished = false, received = 0;
+1 -1
View File
@@ -173,7 +173,7 @@ try {
await click(receiver, 'Receive');
await connect(sender, receiver, size);
assert.equal(await evaluate(receiver, () => typeof window.showSaveFilePicker), 'undefined');
await click(receiver, 'Receive as download (up to 64 GiB)');
await click(receiver, `Receive as download (${size === 0 ? '0 B' : (size / 1024 ** 2).toFixed(1) + ' MiB'})`);
await wait(sender, () => window.__hellcon.element('[role=status]').textContent?.includes('confirmed the complete file'));
assert.match(await evaluate(receiver, () => window.__hellcon.element('[role=status]').textContent), /Check Downloads/);
const destination = join(downloads, 'browser-test.bin');
+4 -1
View File
@@ -4,7 +4,8 @@ import SendPanel from './components/SendPanel.vue';
import ReceivePanel from './components/ReceivePanel.vue';
const mode = ref<'send' | 'receive'>('send');
const canDownloadApp = import.meta.env.PROD && location.protocol !== 'file:';
const isLocal = location.protocol === 'file:';
const canDownloadApp = import.meta.env.PROD && !isLocal;
</script>
<template>
@@ -17,6 +18,8 @@ const canDownloadApp = import.meta.env.PROD && location.protocol !== 'file:';
</p>
<a v-if="canDownloadApp" class="app-download" href="./hellcon-local.html" download="HellCon.html">Download app for local use</a>
<p v-if="canDownloadApp || isLocal" class="status">For large files in the downloaded local version, use desktop Chrome on the receiving machine and choose “Choose destination &amp; receive to disk”.</p>
<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>
+6 -6
View File
@@ -5,7 +5,7 @@ import type { FileMetadata, TransferState, FileDestination } from '../lib/transf
import { computed, onBeforeUnmount, ref } from 'vue';
import NetworkSettings from './NetworkSettings.vue';
import { acceptAnswerCode, createAnswerCode, createOfferCode, createPeerConnection, fetchTurnOptions, iceConfiguration, getFingerprints, MAX_SIGNAL_LENGTH, STUN_PROVIDERS } from '../lib/webrtc.ts';
import { FILE_LIMIT, MEMORY_LIMIT, Transfer, validateMetadata } from '../lib/transfer.ts';
import { MEMORY_LIMIT, Transfer, validateMetadata } from '../lib/transfer.ts';
import { ConnectionDiagnostics } from '../lib/connection-diagnostics.ts';
import { createDownloadDestination, supportsStreamingDownload } from '../lib/download.ts';
@@ -103,7 +103,7 @@ function pickFiles(event: Event) {
: event instanceof DragEvent ? event.dataTransfer?.files[0] : undefined;
if (!selected) return;
reset();
if (selected.size > FILE_LIMIT) { file.value = null; error.value = 'The maximum file size is 64 GiB.'; return; }
if (!Number.isSafeInteger(selected.size) || selected.size < 0) { file.value = null; error.value = 'This file’s size cannot be represented accurately.'; return; }
file.value = selected;
}
function attach(session: Session, channel: RTCDataChannel) {
@@ -254,8 +254,8 @@ async function copy() {
}
function formatBytes(bytes: number) {
if (bytes < 1024) return `${bytes} B`;
const index = Math.min(3, Math.floor(Math.log(bytes) / Math.log(1024)));
return `${(bytes / 1024 ** index).toFixed(1)} ${['B', 'KiB', 'MiB', 'GiB'][index]}`;
const index = Math.min(5, Math.floor(Math.log(bytes) / Math.log(1024)));
return `${(bytes / 1024 ** index).toFixed(1)} ${['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'][index]}`;
}
function selectCode(event: FocusEvent) {
if (event.target instanceof HTMLTextAreaElement) event.target.select();
@@ -266,7 +266,7 @@ onBeforeUnmount(() => { dispose(); revokeDownload(); clearTimeout(copyTimer); })
<template>
<div class="panel">
<template v-if="sending">
<label class="step" for="file-input">Choose one file (up to 64 GiB)</label>
<label class="step" for="file-input">Choose one file</label>
<div class="dropzone" :class="{ dragover }" @dragover.prevent="dragover = true" @dragleave="dragover = false" @drop.prevent="dragover = false; pickFiles($event)">
<p>Drop a file here or choose one below. Choosing a new file cancels the current connection.</p>
<input id="file-input" type="file" @change="pickFiles" />
@@ -300,7 +300,7 @@ onBeforeUnmount(() => { dispose(); revokeDownload(); clearTimeout(copyTimer); })
<div v-if="incoming && step === 'choose-storage'" class="incoming">
<p>{{ incoming.name }} — {{ formatBytes(incoming.size) }}</p>
<p class="status">Only accept files you expect. Encryption does not make their contents safe to open.</p>
<button v-if="canStreamDownload" class="primary" :disabled="choosing" @click="acceptFile('download')">Receive as download (up to 64 GiB)</button>
<button v-if="canStreamDownload" class="primary" :disabled="choosing" @click="acceptFile('download')">Receive as download ({{ formatBytes(incoming.size) }})</button>
<p v-if="canStreamDownload" class="status">Allow the browser download and keep this page open until the transfer finishes. Check Downloads for the final save result.</p>
<button v-if="canSaveToDisk" class="primary" :disabled="choosing" @click="acceptFile('disk')">Choose destination & receive to disk</button>
<button :disabled="choosing || incoming.size > MEMORY_LIMIT" @click="acceptFile('memory')">Receive in memory (up to 64 MiB)</button>
+2 -3
View File
@@ -32,16 +32,15 @@ export interface TransferOptions {
type ControlType = 'ready' | 'meta' | 'accept' | 'ack' | 'end' | 'complete';
export const MEMORY_LIMIT = 64 * 1024 * 1024;
export const FILE_LIMIT = 64 * 1024 * 1024 * 1024;
const CONTROL_LIMIT = 2048;
const WINDOW = MAX_BUFFERED;
export function validateMetadata(meta: unknown): FileMetadata {
if (!isRecord(meta) || typeof meta.name !== 'string' || !meta.name.length || meta.name.length > 255 ||
/[\x00-\x1f\x7f/\\\u202a-\u202e\u2066-\u2069]/.test(meta.name) ||
typeof meta.size !== 'number' || !Number.isSafeInteger(meta.size) || meta.size < 0 || meta.size > FILE_LIMIT ||
typeof meta.size !== 'number' || !Number.isSafeInteger(meta.size) || meta.size < 0 ||
typeof meta.mime !== 'string' || meta.mime.length > 128 || /[^\x20-\x7e]/.test(meta.mime)) {
throw new Error('Invalid file metadata or file exceeds the 64 GiB limit.');
throw new Error('Invalid file metadata. File size must be a nonnegative safe integer.');
}
return { name: meta.name, size: meta.size, mime: meta.mime };
}
+9
View File
@@ -84,3 +84,12 @@ test('app cancellation errors the browser response and cancels pending source re
assert.equal(canceled, true);
assert.equal(w.messages.at(-1)?.type, 'error');
});
test('download worker accepts sizes above 64 GiB without allocating the file', async () => {
const w = worker();
const size = 64 * 1024 ** 3 + 1;
w.start(new ReadableStream(), size);
const response = await w.fetch();
assert.equal(response.headers.get('Content-Length'), String(size));
await response.body!.cancel();
});
+8 -2
View File
@@ -1,7 +1,7 @@
import test, { type TestContext } from 'node:test';
import type { TransferChannel, TransferOptions, TransferResult } from '../src/lib/transfer.ts';
import assert from 'node:assert/strict';
import { Transfer, MEMORY_LIMIT, FILE_LIMIT, validateMetadata } from '../src/lib/transfer.ts';
import { Transfer, MEMORY_LIMIT, validateMetadata } from '../src/lib/transfer.ts';
import { CHUNK_SIZE, MAX_BUFFERED } from '../src/lib/webrtc.ts';
class Channel extends EventTarget implements TransferChannel {
@@ -167,7 +167,7 @@ test('memory limit requires an explicit disk destination for larger files', asyn
});
test('metadata rejects invalid sizes, misleading names and invalid types', () => {
for (const size of [-1, 0.5, '10', NaN, Infinity, FILE_LIMIT + 1]) assert.throws(() => validateMetadata({ ...meta(), size }));
for (const size of [-1, 0.5, '10', NaN, Infinity, Number.MAX_SAFE_INTEGER + 1]) assert.throws(() => validateMetadata({ ...meta(), size }));
for (const name of ['', '../secret', 'a\\b', 'bad\u202efile.exe', 'a'.repeat(256)]) assert.throws(() => validateMetadata({ ...meta(), name }));
assert.throws(() => validateMetadata({ ...meta(), mime: {} }));
});
@@ -225,3 +225,9 @@ test('forged completion or invalid byte acknowledgments cannot report success',
message(second.sender, 'ack', { bytes: 1 }); await second.sender.queue;
assert.equal(second.sender.state, 'closed');
});
test('metadata accepts files above 64 GiB while preserving exact byte counts', () => {
for (const size of [64 * 1024 ** 3 + 1, 1024 ** 4, Number.MAX_SAFE_INTEGER]) {
assert.equal(validateMetadata({ ...meta(), size }).size, size);
}
});