Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All changes organized by pull request, newest first. Format is documented under

---

## [PR #125] fix: packaged builds baked ZERO keys when .env has CRLF line endings

**Branch:** `fix/env-crlf-bake` → `master`
**Date:** 2026-07-14

### Context
Nish installed v0.18.0 and every keyed widget failed at once — YouTube `/auth-url` 503, Spotify "no client id", Discord native "not configured". The baked-credentials map (`BUILTINS_JSON`) in the packaged server bundle was **empty**: `build.mjs` split `.env` on `'\n'`, so with CRLF line endings every line kept a trailing `\r` — and since `\r` is a JS regex line terminator, `(.*)$` can't match past it, so the key=value regex failed on EVERY line and zero keys were baked. Dev never noticed (dotenv parses CRLF fine) — a packaged-build-only failure, the class CLAUDE.md warns about.

### Fixed
- `packages/server/build.mjs` splits `.env` on `/\r?\n/` — CRLF and LF both parse. Verified post-fix: all 11 BUILTIN_KEYS bake with non-empty values.

---

## [PR #124] feat: Discord native mode — RPC voice controls + live chat feed via the desktop client

**Branch:** `feat/discord-native-rpc` → `master`
Expand Down
8 changes: 6 additions & 2 deletions packages/server/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

// Parse root .env without pulling in dotenv as a build-time dep
// Parse root .env without pulling in dotenv as a build-time dep.
// Split on /\r?\n/, NOT '\n': with CRLF line endings every line keeps a
// trailing \r, and `(.*)$` can't cross it (\r is a JS regex line terminator) —
// so a CRLF .env silently baked ZERO keys and the packaged app lost every
// credential (dev never noticed; dotenv handles CRLF).
const envFile = path.join(__dirname, '../../.env');
const envVars = {};
if (fs.existsSync(envFile)) {
for (const line of fs.readFileSync(envFile, 'utf8').split('\n')) {
for (const line of fs.readFileSync(envFile, 'utf8').split(/\r?\n/)) {
const m = line.match(/^([^#=\s][^=]*)=(.*)$/);
if (m) envVars[m[1].trim()] = m[2].trim();
}
Expand Down
Loading