Skip to content

Conversation

gmaclennan
Copy link
Member

This is an initial fix for #96. This almost entirely removes RPC requests for icon and attachment URLs, by making a single request for the server port, and then returning all other URLs synchronously.

This includes a "hack" because we do not expose a method for getting the server port, and instead we use the existing getBlobUrl method with fake data to parse the port. Because the server lifecycle is maintained by application code, not comapeo-core, it probably doesn't make sense for core to implement an API for the server port, but instead create an API in application code and pass a getPort function to core-react, however that can be a follow-up that requires deeper changes.

This moves logic for URL structure into this library, temporarily, which needs to be kept in sync with the URL structure defined in the fastify plugins in Core. In a follow-up we can export functions from Core, or an extracted "core blob server", which will move the URL structure logic into one place, but this temporary fix is the quickest for now that minimizes changes to different modules.

This is slightly "hacky" under the surface, but the advantage is that there are zero API changes, and no changes needed to Core or application code, and it should just work with a significant reduction in requests for URLs.

Follow-up work can clean this up, see #96.

Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some non-blocking comments + questions but otherwise lgtm

@gmaclennan gmaclennan merged commit baa3454 into main Aug 28, 2025
5 checks passed
@gmaclennan gmaclennan deleted the feat/efficient-get-url branch August 28, 2025 14:09
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.

2 participants