Implement Custom URL Protocol Handling#15378
Conversation
Review Summary by QodoImplement custom URL protocol handler for browser extension integration
WalkthroughsDescription• Implement custom jabref:// URL protocol handler registration across platforms • Filter protocol handler URLs from CLI arguments to prevent parsing errors • Add Focus UI command when protocol handler is invoked • Register platform-specific protocol handlers (macOS via Desktop API, Windows/Linux via installers) • Add comprehensive unit tests for protocol handler argument filtering Diagramflowchart LR
A["OS triggers jabref:// URL"] --> B["ArgumentProcessor filters protocol args"]
B --> C["protocolHandlerInvoked flag set"]
C --> D["Focus UI command added"]
A --> E["macOS Desktop API handler"]
E --> D
F["Windows Registry setup"] --> G["Protocol handler registered"]
H["Linux desktop file setup"] --> G
G --> A
File Changes1. jabgui/src/main/java/org/jabref/cli/ArgumentProcessor.java
|
Code Review by Qodo
1.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
On Linux the .desktop file is: There is With these two changes it seems to work as intended |
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
✅ All tests passed ✅🏷️ Commit: a8d6298 Learn more about TestLens at testlens.app. |
|
@FynnianB Can you add the changes suggested by @LyzardKing |
InAnYan
left a comment
There was a problem hiding this comment.
Code-wise okay, but I haven't run it.
I think the Carl's comment on logger is valid
There was a problem hiding this comment.
But should this ADR be in this PR and not in #15295 or some other directly related to the browser extension?
| } | ||
| desktop.setOpenURIHandler(event -> { | ||
| URI uri = event.getURI(); | ||
| if ("jabref".equals(uri.getScheme())) { |
There was a problem hiding this comment.
Shouldn't we have somewhere a constant for jabref URL schema? Though I think this might be too much..
tobiasdiez
left a comment
There was a problem hiding this comment.
I would like to see a more detailed discussion of Native Messaging vs URL Handler. Based on my experience with the former, I would propose the super hybrid: Native Messaging + HTTP by default, URL handler as last fallback (perhaps with a toggle in the browser extension to permanently switch from messaging to handler - for those poor Linux users that have trouble with native messaging)
|
|
||
| * Good, because no network listener exposed — best security properties | ||
| * Good, because the browser manages the host process lifecycle | ||
| * Bad, because six manifest variants and two host script languages required |
There was a problem hiding this comment.
That's not intrinsic to the architecture but just a design decision. In principle you could not use Python for this. Also I don't see what's the problem with using different manifest variants.
| * Good, because no network listener exposed — best security properties | ||
| * Good, because the browser manages the host process lifecycle | ||
| * Bad, because six manifest variants and two host script languages required | ||
| * Bad, because high packaging overhead across multiple OS and package formats |
There was a problem hiding this comment.
These files are not changed for years and their installation is a simple file copying. What's the "high overhead" here?
| * Good, because the browser manages the host process lifecycle | ||
| * Bad, because six manifest variants and two host script languages required | ||
| * Bad, because high packaging overhead across multiple OS and package formats | ||
| * Bad, because JabRef already aims to remove this infrastructure due to maintenance burden (see PR #14884) |
| ### Native Messaging | ||
|
|
||
| * Good, because no network listener exposed — best security properties | ||
| * Good, because the browser manages the host process lifecycle |
There was a problem hiding this comment.
- Good: built-in whitelist of extensions that are allowed to communicate with JabRef
- Good: recommended way of communication between browser extension and desktop app
- Good: battle tested for years
- Bad: difficult installation procedure in certain Linux configs (eg browsers installed via snap)
|
@FynnianB do you intend to continue on this? |

Related issues and pull requests
Closes no direct related Issue in JabRef repository
Related JabRef/JabRef-Browser-Extension-fresh#17
Related to JabRef/JabRef-Browser-Extension-fresh#18
Related to #14884
Accidently closed old pr: #15294
PR Description
Implements Custom URL Protocol Handling so that the browser extension can open/focus the JabRef Desktop-App if its not running. More specifically, we register the custom URL protocol in the installation processes of the various operating systems and ensure that the application can handle the call by the OS.
This PR is part my bachelorthesis regarding the communication between the browser extension and the JabRef Desktop-App. The corresponding PR in the JabRef-Browser-Extension-fresh repository will follow shortly.
_Hint: This PR will follow another one which adds the MADR for it.
Steps to test
jabref://orjabref://openin browserChecklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)