feat: shorten DID in public note URLs by stripping did:plc: prefix

URLs are now /pub/<base32id>/rkey instead of /pub/did:plc:<base32id>/rkey.
Non-plc DIDs keep their method prefix (e.g. web:example.com).
This commit is contained in:
Julien Calixte
2026-03-17 01:33:51 +01:00
parent 5d145dd7ff
commit 163e3ee756
7 changed files with 26 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { PublicNoteListItem } from "@/modules/note/models/Note"
import { toShortDid } from "@/modules/atproto/shortDid"
import { slugify } from "@/utils/slugify"
import { vInfiniteScroll } from "@vueuse/components"
@@ -25,7 +26,7 @@ defineSlots<{
:to="{
name: 'PublicNoteView',
params: {
did: note.did,
shortDid: toShortDid(note.did),
rkey: note.rkey,
slug: slugify(note.title),
},

View File

@@ -9,6 +9,7 @@ import { computedAsync } from "@vueuse/core"
import { getUrl } from "@/modules/atproto/getUrl"
import { withATProtoImages } from "@/modules/atproto/withATProtoImages"
import { getAuthor } from "@/modules/atproto/getAuthor"
import { fromShortDid } from "@/modules/atproto/shortDid"
import { PublicNoteRecord } from "@/modules/atproto/publicNote.types"
const props = defineProps<{
@@ -17,7 +18,7 @@ const props = defineProps<{
}>()
const didrkey = computed(() => props.didrkey)
const did = computed(() => props.didrkey.split("-")[0])
const did = computed(() => fromShortDid(props.didrkey.split("-")[0]))
const rkey = computed(() => props.didrkey.split("-")[1])
const classNameId = computed(() => didrkey.value.replaceAll(":", "-"))