Files
HellCon/vite.config.ts
SchluffeandClaude Opus 5.5 ac4d496a48 Version the protocol for 1.0, fail downloads the page abandoned
PROTOCOL (hellcon/1) goes in front of the PBKDF2 salt and names the data
channel, so different versions never meet via a tracker and the manual
receiver tells a sender on another protocol apart. The footer shows it, the
receiver's hints ask to compare it. Forks are asked to name their own.

public/sw.js and the page exchange a VERSION, a mismatch fails the download
with outdated. The worker fails a download after 20 s without a chunk or
ping from its page, else Firefox saves the truncated file of a closed tab as
complete.

The build uses relative links and works under any path. On https only wss:
trackers and ws: to this device are accepted, one the browser refuses to
open counts as lost. Also: a file read short stops the transfer, an offer
waiting on a lost tracker isn't answered, a share ended while its key was
derived opens no tracker, and tracker and receiver errors lose hidden
characters. The README lists what isn't planned and the phone limitation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:10:09 +01:00

31 lines
1.3 KiB
TypeScript

/// <reference types="vitest/config" />
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
const DEV_STYLE_SRC = "style-src 'self'";
export default defineConfig({
plugins: [
vue(),
// index.html's Content-Security-Policy allows no inline styles, the dev server injects the CSS
// through JavaScript. A nonce lets only those style elements through, so the dev server enforces
// the same policy as the production build, which links the CSS as files.
{
name: 'dev-csp',
apply: 'serve',
config: () => ({ html: { cspNonce: 'dev' } }),
transformIndexHtml(html) {
if (!html.includes(DEV_STYLE_SRC)) throw new Error(`dev-csp: index.html has no "${DEV_STYLE_SRC}"`);
return html.replace(DEV_STYLE_SRC, `${DEV_STYLE_SRC} 'nonce-dev'`);
},
},
],
// The dev server would inline small images like gitea.svg as data: URLs, which index.html's
// Content-Security-Policy blocks. The production build links them as files either way.
build: { assetsInlineLimit: 0 },
// Relative links, so the build works under any path, not only at the root of a host.
base: './',
// Playwright runs e2e.spec.ts and backend/, which Vitest would pick up too.
test: { include: ['src/**/*.test.ts'] },
});