Translate everything to typescript

This commit is contained in:
Schluffe committed 2026-10-09 14:17:36 +02:00
1 parent c3ca3e1752
commit e9818aaeda
27 files changed
+901 -552

No files matched your search

+9 -2
View File
@@ -1,12 +1,19 @@
import type { IncomingMessage } from 'node:http';
import { createHmac, randomUUID } from 'node:crypto';
interface IceResponse {
setHeader(name: string, value: string): unknown;
writeHead(status: number, headers?: Record<string, string>): unknown;
end(body?: string): unknown;
}
// Shared by Vite and the browser integration checks. Never imported by the client.
export function iceMiddleware(env) {
export function iceMiddleware(env: NodeJS.ProcessEnv) {
const secret = env.TURN_SECRET;
if (!secret) throw new Error('TURN_SECRET is required. Run bun run dev:setup first.');
const host = env.TURN_HOST || '127.0.0.1';
const port = env.TURN_PORT || '3478';
return (req, res, next) => {
return (req: Pick<IncomingMessage, 'url' | 'method' | 'headers'>, res: IceResponse, next: () => void) => {
if (req.url?.split('?')[0] !== '/api/ice-servers') return next();
res.setHeader('Cache-Control', 'no-store');
if (req.method !== 'GET') {