fix: auto-register Linux .desktop file with %u to unblock OAuth callback#1625
Open
Rene0422 wants to merge 1 commit into
Open
fix: auto-register Linux .desktop file with %u to unblock OAuth callback#1625Rene0422 wants to merge 1 commit into
Rene0422 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.setAsDefaultProtocolClientonly invokesxdg-mime defaultagainst a.desktopfile 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/%Ufield code. Without%u,xdg-opendrops theeigent://URL before launching the app. The running instance'ssecond-instanceevent 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
handleProtocolUrlis never called and the token never reaches the renderer.Fix.
electron/main/utils/linuxProtocol.ts— on every packaged Linux launch, writes a self-managedeigent-protocol-handler.desktopinto~/.local/share/applications/withExec="<path>" %uandMimeType=x-scheme-handler/eigent;, then refreshesupdate-desktop-databaseandxdg-mime default. Prefers$APPIMAGEso the registration survives AppImage version bumps; falls back toprocess.execPath. Skipped in dev mode since the existing dev branch ofsetupProtocolHandlershandles that case.electron/main/index.ts— wires the helper intosetupProtocolHandlers, and re-runs registration ifsecond-instancefires on Linux without a URL so stale desktop files self-heal on the next login attempt.electron-builder.json— addsMimeType=x-scheme-handler/eigent;to the AppImage's bundled.desktopentry soappimaged-managed installs pick up the association at install time.Testing Evidence (REQUIRED)
Verification performed:
npm run type-checkpasses (exit 0).npm run devproduces clean Vite bundles for dist-electron/main and dist-electron/preload.~/.local/share/applications/eigent-protocol-handler.desktopwithExec="<exec>" %u. Triggeringxdg-open 'eigent://auth/callback?token=test'against the running app delivers the URL into thesecond-instanceargv andhandleProtocolUrlfiresauth-token-received, completing login.What is the purpose of this pull request?
Contribution Guidelines Acknowledgement