No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Erwan Leboucher bd28213315
feat: send the tunnel ticket as a WebSocket subprotocol
Signed-off-by: Erwan Leboucher <erwanleboucher@gmail.com>
2026-11-13 12:10:05 +01:00
cli feat: preview Klipy links through the Klipy API 2026-11-09 17:23:24 +01:00
docs feat: keep a poster for post videos 2026-11-12 08:43:40 +01:00
src feat: send the tunnel ticket as a WebSocket subprotocol 2026-11-13 12:10:05 +01:00
tests feat: fetch through a tunnel relay 2026-11-13 09:45:37 +01:00
.gitignore feat: shared Matrix link preview crate 2026-11-08 11:26:28 +01:00
Cargo.lock feat: fetch through a tunnel relay 2026-11-13 09:45:37 +01:00
Cargo.toml feat: fetch through a tunnel relay 2026-11-13 09:45:37 +01:00
LICENSE chore: license under AGPL-3.0-or-later 2026-11-08 12:12:07 +01:00
README.md feat: fetch through a tunnel relay 2026-11-13 09:45:37 +01:00

sable-link-preview

Link previews for Matrix, shared by Soliditas and the Sable client.

  • PreviewData reads a preview from a /preview_url answer or from bundled m.url_previews, treating every field from a stranger as optional.
  • BundleEntry writes one entry of m.url_previews (and com.beeper.linkpreviews).
  • scrape (feature scrape) builds a preview from the page: Open Graph tags, filled from Twitter card tags, <title>, <meta name="description"> and oEmbed. Twitter/X links come from the FxTwitter API, Bluesky posts from their author's PDS (resolved through Slingshot, counts from Constellation), Reddit and TikTok titles from their oEmbed endpoints, Klipy GIFs, stickers and clips from the Klipy API when ScrapeOptions has a key, Tumblr posts without an image get the fxtumblr render, and fediverse posts (Mastodon, Misskey and others) are read from their ActivityPub object.
  • ReqwestFetch (feature reqwest) runs a scrape over reqwest, connecting only to public addresses and refusing redirects to local hosts.
  • TunnelFetch (feature tunnel) runs a scrape through a tunnel relay, natively and in the browser. Each TCP connection is one WebSocket to the relay, which resolves the host name and refuses non-public addresses, and a request fails instead of connecting directly when the relay is unreachable.

scrape takes any Fetch implementation, so it runs on a Cloudflare Worker through fetch as well as natively.

Posts

Every post preview, from X, Bluesky, the fediverse, Tumblr, Reddit, TikTok or a page that declares og:type note itself, follows Sable's Open Graph note extension: og:type note with note: keys, and a quoted post under related:1:. They sit with the other keys, in a /preview_url answer and in bundled m.url_previews entries (MSC4095). Clients that do not read them still get og:title (Name (@handle)), og:description (the text) and og:image (the first image).

{
  "og:type": "note",
  "note:author": "Alice",
  "note:author:handle": "alice.example",
  "note:author:url": "https://bsky.app/profile/alice.example",
  "note:author:image": "mxc://example.org/avatar",
  "note:content": "hello",
  "note:published_time": "2026-10-12T00:00:00.000Z",
  "note:relation": ["like", "boost", "reply", "quoted_note"],
  "note:relation:like": "7",
  "note:relation:boost": "2",
  "note:relation:reply": "3",
  "note:relation:quoted_note": "1",
  "note:sensitivity": "spoiler",
  "note:sensitivity:reason": "Star Wars",
  "og:image": "mxc://example.org/cat",
  "og:image:type": "image/png",
  "og:image:alt": "a cat",
  "og:image:1": "mxc://example.org/dog",
  "og:video": "mxc://example.org/clip",
  "og:video:type": "video/mp4",
  "og:video:com.sable.gif": true,
  "related:1:og:type": "note",
  "related:1:og:url": "https://bsky.app/profile/bob.example/post/3def",
  "related:1:note:content": "the quoted post"
}

An og:video that comes with a GIF image, as on Tenor and GIPHY, gets og:video:com.sable.gif.

docs/note-extension.md describes how notes are written in JSON: numbered images and videos, uploaded and encrypted media, how a sensitive note keeps its media from clients that do not read notes, and the keys Sable adds.

License

AGPL-3.0-or-later, see LICENSE.

The scraper is ported from Soliditas, Copyright 2026 Rye, licensed under the Apache License 2.0.