Link existing QDN resources from the composer + Hub use-embed interop (A3+A4) - #106
Merged
Conversation
…ub's use-embed links (A3+A4) - messageLinks: parse Qortal Hub's qortal://use-embed/... grammar (incoming Hub group-image embeds now preview in Chat) and add buildQdnResourceShareLink, which emits the form the conversation's network previews best: qdn://SERVICE/name/identifier on Qortium, Hub's use-embed on Qortal (falling back to qortal://SERVICE/name?identifier=... when a value would break Hub's no-decode query parsing). - coreApi: searchQdnResources over FETCH_NODE_API -> /arbitrary/resources/ search (works on every host; Hub/gateway via the same-origin fallback; SEARCH_QDN_RESOURCES has no router case in Hub). - LinkResourceDialog: search ANY publisher's resources (query + service filter, paging) and insert a link at the composer caret - nothing is republished. - Composer: new link button next to the paperclip; App wires the dialog, caret insertion, and per-conversation reset. - Open-group attachment publishes in Qortal conversations now emit the use-embed form - the old qdn:// form mis-parsed there (identifier only rides ?identifier= on Qortal, so the third segment was read as app path). - Ten new i18n keys mirrored into all 22 locales; docs + README + styles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E9yvpqkVaKzM9MUh5zoCmG
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.
Why
Phase A3+A4 of the attachments plan (
~/AGENTS/projects/qortium-chat-v2/attachments-matrix/TRACKER.md). If a file already exists on QDN — published by anyone — the chat should link to it instead of republishing the bytes, and the link should render as an inline preview in both this app and real Qortal Hub clients. Hub and Chat previously had disjoint link grammars: Hub only embedsqortal://use-embed/…and merely linkifies everything else, while Chat rejecteduse-embedoutright.What
messageLinks.tsx):qortal://use-embed/{IMAGE|VIDEO|ATTACHMENT}?name=…&service=…&identifier=…now parses into the normal QDN-resource pipeline, so incoming Hub group-image embeds preview in Chat. Values are read without URL-decoding, exactly like Hub's ownembed-utils.ts; POLL and malformed embeds are rejected.buildQdnResourceShareLink): per-network form —qdn://SERVICE/name/identifierin Qortium conversations, Hub'suse-embedin Qortal conversations. Since Hub neither encodes nor decodes query values, the use-embed form is only used when every value is[A-Za-z0-9._-]; otherwise the plainqortal://SERVICE/name?identifier=…link (previewed by Chat, linkified by Hub).qdn://SERVICE/name/identifier, which the Qortal-side parser reads as name + app path (identifier only rides?identifier=there) — the linked attachment didn't resolve. They now emit the use-embed form.coreApi.searchQdnResources): Core/arbitrary/resources/searchoverFETCH_NODE_API(all publishers, query + service filter, clamped paging). Chosen overSEARCH_QDN_RESOURCESbecause Hub's request router has no case for that action even on current master, whileFETCH_NODE_APIworks everywhere (Home directly; Hub and gateway through Chat's same-origin fallback).LinkResourceDialog— search, service filter (Any/IMAGE/VIDEO/AUDIO/ATTACHMENT/DOCUMENT/WEBSITE/APP), load-more paging, and per-row "Insert link", which drops the ready-made link at the composer caret. Nothing is published; available whenever the host serves the node API (FETCH_NODE_API), including read-only-ish hosts.Verification
tscclean;vitest: 57 files / 768 tests pass (11 new: use-embed parse/reject cases, emit round-trips — every emitted form parses back to the same coordinate — and the search wrapper's wire shape/paging/filtering).npm run buildOK.🤖 Generated with Claude Code
https://claude.ai/code/session_01E9yvpqkVaKzM9MUh5zoCmG