Conversation
Default production web builds to the page origin so Docker and LAN users do not fetch from browser-local localhost. Preserve the local/Tauri fallback and repair stale persisted loopback URLs.
📝 WalkthroughWalkthroughThe pull request introduces dynamic server URL initialization by replacing hardcoded defaults with computed values via a new Changes
Sequence Diagram(s)sequenceDiagram
participant App as App.tsx
participant Store as ServerStore
participant Helper as getDefaultServerUrl()
participant Validator as isLoopbackVoiceboxServerUrl()
App->>Store: Fetch persisted serverUrl
activate Store
Store-->>App: Return stored serverUrl
deactivate Store
App->>Helper: Compute default server URL
activate Helper
Helper-->>App: Return computed default
deactivate Helper
App->>Validator: Check if current URL is loopback Voicebox
activate Validator
Validator-->>App: Return validation result
deactivate Validator
alt Current differs from default
App->>Store: Overwrite serverUrl with computed default
activate Store
Store-->>App: Confirm update
deactivate Store
end
App-->>App: Server initialization complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/stores/serverStore.ts (1)
61-74: Remove the unreachable'[::1]'branch instead.Per the WHATWG URL spec,
URL.hostnamereturns IPv6 addresses without brackets — for example, parsinghttp://[::1]:17493/results inhostname === '::1', not'[::1]'. The bare'::1'case correctly handles IPv6 loopback; the'[::1]'check is dead code and should be removed for clarity.♻️ Optional cleanup
return ( parsed.port === '17493' && (parsed.hostname === '127.0.0.1' || parsed.hostname === 'localhost' || - parsed.hostname === '[::1]' || parsed.hostname === '::1') );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/stores/serverStore.ts` around lines 61 - 74, The isLoopbackVoiceboxServerUrl function contains an unreachable branch checking for the hostname '[::1]'; remove that check so the hostname comparisons only include '127.0.0.1', 'localhost', and '::1'. Update the return condition in isLoopbackVoiceboxServerUrl to drop the '[::1]' case and keep the try/catch and URL parsing logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/src/stores/serverStore.ts`:
- Around line 61-74: The isLoopbackVoiceboxServerUrl function contains an
unreachable branch checking for the hostname '[::1]'; remove that check so the
hostname comparisons only include '127.0.0.1', 'localhost', and '::1'. Update
the return condition in isLoopbackVoiceboxServerUrl to drop the '[::1]' case and
keep the try/catch and URL parsing logic unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 05b7c3fd-f410-48ff-95e1-500e79f6b113
📒 Files selected for processing (3)
app/src/App.tsxapp/src/stores/serverStore.tsweb/src/platform/lifecycle.ts
Default production web builds to the page origin so remote Docker and LAN users do not fetch from browser-local localhost. Preserve the local/Tauri fallback and repair stale persisted loopback URLs.
Summary by CodeRabbit
New Features
Bug Fixes