MSC4352 (unstable): discover org.matrix.msc4352.permalink_base_url; share via :permalink; linkify resolver HTTPS to matrix: on send#512
Conversation
- Add discovery of custom permalink base from .well-known/matrix/client - Implement :permalink command for generating room/event permalinks - Add send-time conversion of HTTPS permalinks to matrix: URIs - Support both stable (m.permalink_base_url) and unstable keys - Feature-gated behind IAMB_MSC4352=1 environment variable - Include comprehensive tests and documentation Signed-off-by: Igor Somov <donprusne@gmail.com>
|
Is there a reason this PR needs to reimplement existing types like I think it makes more sense to implement most of this in matrix-rust-sdk and maybe just do a string replace in the output of Also I couldn't get this to build (unresolved import |
Signed-off-by: Igor Somov <donprusne@gmail.com>
Thanks, I fix this:
|
|
Do you have some local changes you have not pushed or are you using AI to write this code? When I check out your changes locally and run |
Signed-off-by: Igor Somov <donprusne@gmail.com>
|
Apologies for the confusion. The issue is that main doesn’t build for me on macOS 26. To get a local build, I’ve been temporarily tweaking build.rs and a few other files, and adding some helper/stub files to work around platform-specific errors. I didn’t commit those local changes, which is why a clean checkout hits the “non-existing functions/attributes” errors you’re seeing. I’ll sort out my macOS setup closer to the weekend, push the minimal required changes (or guard the macOS-specific bits), and re-test with a clean cargo c run. |
Signed-off-by: Igor Somov <donprusne@gmail.com>
|
For me |
Signed-off-by: Igor Somov <donprusne@gmail.com>
9d94a6d to
88de844
Compare
|
Now I fix all problems, and add some more tests for this feature :) |
This PR adds an experimental client-side implementation for MSC4352 to help it move through the spec process. It demonstrates:
Discovery: Reads
org.matrix.msc4352.permalink_base_url(or stablem.permalink_base_url) from/.well-known/matrix/clientfor the user's homeserver domain (HTTPS-only). Also supportsIAMB_MSC4352_PERMALINK_BASEfor local testing.Generation: New command
:permalinkgenerates HTTPS permalinks for outside-of-Matrix contexts using the matrix.to navigation grammar but with the discovered custom base URL (fallbackhttps://matrix.to). Supports both room permalinks and event permalinks (:permalink event $eventId).In-app safety: No in-app links/mentions are rewritten to HTTPS; iamb's in-app navigation remains intact.
Send-time conversion: When a user pastes a resolver-style HTTPS permalink in a message, iamb keeps the visible text but emits
formatted_bodywith an equivalentmatrix:URI (matrix:r/...,matrix:roomid/.../e/..., preservingvia=), ensuring cross-client interoperability.Feature flag
Set
IAMB_MSC4352=1to enable the feature. You can optionally setIAMB_MSC4352_PERMALINK_BASEfor testing without editing well-known.Testing
https://links.example.org/#/%23room%3Aexample.org/%24event?via=example.organd send - the message should have an anchor withhref="matrix:r/room:example.org/e/$event?via=example.org"informatted_body, whilebodypreserves the original text.:permalinkin a room to get an HTTPS permalink based on discovered or env-provided base.:permalinkfalls back tohttps://matrix.to.Implementation notes
MSC4352.mdThis is intentionally a small, low-risk change to qualify MSC4352 with a client implementation.