Files
threadnet-call/vite-embedded.config.ts
T
Thore CimbalandClaude Opus 4.8 d270e0c706 fix(embedded): ship the model assets in the widget package
Element Call reaches production only as the embedded npm package, which webpack
copies into ThreadNet-Web under /widgets/element-call/. The embedded build sets
publicDir: false — upstream reasons that public/ holds nothing but the favicon,
which stopped being true when the model assets landed there.

Verified rather than assumed: with the upstream value everything builds, the
standalone bundle works, and the filter is dead only inside the widget, 404ing on
the model. That is the failure this would have shipped.

The package grows from about 41 to 66 MB, measured — most of what was already
there is source maps and the crypto and vision wasm.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-16 12:00:00 +00:00

71 lines
2.8 KiB
TypeScript

/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { defineConfig, mergeConfig } from "vite";
import generateFile from "vite-plugin-generate-file";
import fullConfig from "./vite.config";
const base = "./";
// Config for embedded deployments (possibly hosted under a non-root path)
export default defineConfig((env) =>
mergeConfig(
fullConfig({ ...env, packageType: "embedded" }),
defineConfig({
base, // Use relative URLs to allow the app to be hosted under any path
// ThreadNet-Fork (ADR-0018): Upstream steht hier `publicDir: false` mit der
// Begruendung, public/ enthalte nur das Favicon. Bei uns liegen dort auch die
// DeepFilterNet3-Assets, und das Widget ist der einzige Weg, auf dem Element
// Call ausgeliefert wird - ohne sie waere der Filter im Widget tot (404 auf das
// Modell), waehrend er im Standalone-Build funktioniert. Das Widget bleibt damit
// in sich geschlossen: alles, was es braucht, liegt unter /widgets/element-call/.
publicDir: "public",
plugins: [
generateFile([
{
type: "json",
output: "./config.json",
data: {
matrix_rtc_session: {
wait_for_key_rotation_ms: 5000,
delayed_leave_event_restart_ms: 4000,
delayed_leave_event_delay_ms: 18000,
},
media_quality: {
// h264 uses classic simulcast (like vp8), not SVC, so it's compatible
// with buildPublishOptions()'s simulcast-shaped layers without a code
// fix - unlike vp9/av1 (see 2026-07-28 incident: forcing vp9 broke calls
// entirely, likely due to that SVC/simulcast mismatch). h264 also tends
// to be hardware-accelerated on more devices (notably iOS/Safari).
video_codec: "h264",
video: {
max_resolution: 1440,
max_bitrate: 8_000_000,
max_framerate: 60,
// Without this, the code default is only [180p, 360p] - a huge quality
// cliff straight to blocky 360p on any minor network hiccup instead of
// gracefully stepping down. Added a 720p middle rung.
simulcast_layers: [
{ height: 180, bitrate: 150_000 },
{ height: 720, bitrate: 2_500_000 },
],
},
screen_share: {
max_resolution: 1440,
max_bitrate: 6_000_000,
max_framerate: 30,
},
},
},
},
]),
],
}),
),
);