Compare commits

...

2 Commits

Author SHA1 Message Date
d397b32ab5 Bump version to 0.0.9
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 13:44:36 -07:00
4ce9471a8e Auto-generate self-signed TLS certs on startup
getUserMedia requires HTTPS, so generate certs if missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 13:44:36 -07:00
2 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "baudy", "name": "baudy",
"version": "0.0.8", "version": "0.0.9",
"module": "index.tsx", "module": "index.tsx",
"type": "module", "type": "module",
"bin": { "bin": {

View File

@ -22,16 +22,26 @@ app.get('/ggwave.js', () =>
startup(PORT) startup(PORT)
const hasCerts = await Bun.file('./certs/cert.pem').exists() async function ensureCerts() {
const certPath = './certs/cert.pem'
const keyPath = './certs/key.pem'
if (await Bun.file(certPath).exists()) return
const { mkdirSync } = await import('fs')
mkdirSync('./certs', { recursive: true })
Bun.spawnSync(['openssl', 'req', '-x509', '-newkey', 'rsa:2048',
'-keyout', keyPath, '-out', certPath,
'-days', '365', '-nodes', '-subj', '/CN=localhost'])
}
await ensureCerts()
export default { export default {
...app.defaults, ...app.defaults,
port: PORT, port: PORT,
idleTimeout: 255, idleTimeout: 255,
...(hasCerts && { tls: {
tls: { key: Bun.file('./certs/key.pem'),
key: Bun.file('./certs/key.pem'), cert: Bun.file('./certs/cert.pem'),
cert: Bun.file('./certs/cert.pem'), },
},
}),
} }