Parses at-uri redirects files & allows easy conversion of at-uris (including spaces alpha uris) to URLs

7.1 kB · 169 lines · Created 1w ago
TypeScript

Here’s a sample of what Bluesky/mu/Witchsky might offer at /.we’ll-known/at-uris:

# Records with a page of their own
/profile/:authority/post/:rkey collection=app.bsky.feed.post
/profile/:authority/feed/:rkey collection=app.bsky.feed.generator
/profile/:authority/lists/:rkey collection=app.bsky.graph.list
/starter-pack/:authority/:rkey collection=app.bsky.graph.starterpack

# Threadgates and postgates share their rkey with the post they apply to
/profile/:authority/post/:rkey collection=app.bsky.feed.threadgate
/profile/:authority/post/:rkey collection=app.bsky.feed.postgate

# Records shown on the profile page
/profile/:authority collection=app.bsky.actor.profile
/profile/:authority collection=app.bsky.actor.status
/profile/:authority collection=app.bsky.actor.link
/profile/:authority collection=app.bsky.labeler.service

# The bare account: at://authority
/profile/:authority collection=

# Deliberately unmapped (no page of their own; the subject is inside the record):
# app.bsky.feed.like, .repost; app.bsky.graph.follow, .block, .listitem,
# .listblock, .verification, .referencelistoptout; and settings-like
# declarations: app.bsky.actor.contentVisibilityDeclaration,
# app.bsky.notification.declaration, chat.bsky.actor.declaration

And a (pre-spaces) ABNF:

file        = *( line eol ) [ line ]
eol         = [ CR ] LF
line        = *WSP [ ( rule / comment ) *WSP ]
comment     = "#" *( VCHAR / WSP )
rule        = template *( 1*WSP condition )
template    = ( %x21-22 / %x24-7E ) *VCHAR   ; any non-space run not starting with "#"
condition   = key "=" value *( "," value )
key         = %s"at-uri" / %s"handle" / %s"did" / %s"authority" / %s"collection" / %s"rkey"
value       = *( %x21-2B / %x2D-7E )        ; no commas; empty = component absent
Sign up or Sign in to add to the discussion.