Skip to content

fix: auto-register Linux .desktop file with %u to unblock OAuth callback#1625

Open
Rene0422 wants to merge 1 commit into
eigent-ai:mainfrom
Rene0422:fix/linux-protocal-handler-auth-hang
Open

fix: auto-register Linux .desktop file with %u to unblock OAuth callback#1625
Rene0422 wants to merge 1 commit into
eigent-ai:mainfrom
Rene0422:fix/linux-protocal-handler-auth-hang

Conversation

@Rene0422
Copy link
Copy Markdown

Related Issue

Closes #1525

Description

Fixes the Linux auth hang where login stalls at "Logging in......." after the OAuth provider redirects back via eigent://auth/callback?token=....

Root cause. On Linux, app.setAsDefaultProtocolClient only invokes xdg-mime default against a .desktop file that must already exist — it does not create one. AppImage builds ship no such file, and users who author their own (as the reporter did) frequently omit the %u/%U field code. Without %u, xdg-open drops the eigent:// URL before launching the app. The running instance's second-instance event then fires with a URL-less argv:

[info] second-instance [
'/opt/eigent-0.0.89/bin/squashfs-root/eigent',
'--allow-file-access-from-files',
... // no eigent:// URL here
]

So handleProtocolUrl is never called and the token never reaches the renderer.

Fix.

  • New electron/main/utils/linuxProtocol.ts — on every packaged Linux launch, writes a self-managed eigent-protocol-handler.desktop into ~/.local/share/applications/ with Exec="<path>" %u and MimeType=x-scheme-handler/eigent;, then refreshes update-desktop-database and xdg-mime default. Prefers $APPIMAGE so the registration survives AppImage version bumps; falls back to process.execPath. Skipped in dev mode since the existing dev branch of setupProtocolHandlers handles that case.
  • electron/main/index.ts — wires the helper into setupProtocolHandlers, and re-runs registration if second-instance fires on Linux without a URL so stale desktop files self-heal on the next login attempt.
  • electron-builder.json — adds MimeType=x-scheme-handler/eigent; to the AppImage's bundled .desktop entry so appimaged-managed installs pick up the association at install time.

Testing Evidence (REQUIRED)

  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.

Verification performed:

  • npm run type-check passes (exit 0).
  • npm run dev produces clean Vite bundles for dist-electron/main and dist-electron/preload.
  • Manual: on Fedora 43 / XFCE4 reproducing the reporter's setup, the app now writes ~/.local/share/applications/eigent-protocol-handler.desktop with Exec="<exec>" %u. Triggering xdg-open 'eigent://auth/callback?token=test' against the running app delivers the URL into the second-instance argv and handleProtocolUrl fires auth-token-received, completing login.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

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.

[BUG] Auth process hangs with "Logging in......." message

1 participant