Skip to content

desktop: normalize local backend URL and add /api dev proxy#5941

Closed
roerohan wants to merge 3 commits into
anomalyco:devfrom
roerohan:fix-desktop-port
Closed

desktop: normalize local backend URL and add /api dev proxy#5941
roerohan wants to merge 3 commits into
anomalyco:devfrom
roerohan:fix-desktop-port

Conversation

@roerohan

Copy link
Copy Markdown
Contributor

Fixes #5928

Summary

I've fixed the issue where the desktop app couldn't properly connect to the API server when running with a custom port. Here's what I changed:

Changes Made:

  1. packages/desktop/src/app.tsx - Fixed the URL detection logic to use 127.0.0.1:${port} for localhost instead of trying to use the Vite dev server port
  2. packages/desktop/vite.config.ts - Added optional proxy configuration for better development experience

How I tested:

Default Port (4096):

  • Terminal 1
cd packages/opencode && bun src/index.ts
  • Terminal 2
cd packages/desktop && bun run dev

Custom Port (e.g., 8080):

  • Terminal 1
cd packages/opencode && bun src/index.ts --port=8080
  • Terminal 2
cd packages/desktop && VITE_OPENCODE_SERVER_PORT=8080 bun run dev

The desktop app will now correctly connect to the API server on whatever port you specify via the VITE_OPENCODE_SERVER_PORT environment variable, which defaults to 4096.

@Brendonovich

Copy link
Copy Markdown
Member

#5928 is fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode --port=8080 fails because port statically bound to 4096

2 participants