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:
@@ -8,6 +8,7 @@ import { getAuthor } from "@/modules/atproto/getAuthor"
|
||||
import type { PublicNoteRecord } from "@/modules/atproto/publicNote.types"
|
||||
import { withATProtoImages } from "@/modules/atproto/withATProtoImages"
|
||||
import { getUrl } from "@/modules/atproto/getUrl"
|
||||
import { fromShortDid } from "@/modules/atproto/shortDid"
|
||||
import { downloadFont } from "@/utils/downloadFont"
|
||||
import { slugify } from "@/utils/slugify"
|
||||
import { computedAsync } from "@vueuse/core"
|
||||
@@ -19,9 +20,9 @@ import ThemeSwap from "@/components/ThemeSwap.vue"
|
||||
import { useTitle } from "@vueuse/core"
|
||||
import { displayLanguage } from "@/utils/displayLanguage"
|
||||
|
||||
const props = defineProps<{ did: string; rkey: string; slug?: string }>()
|
||||
const props = defineProps<{ shortDid: string; rkey: string; slug?: string }>()
|
||||
const router = useRouter()
|
||||
const did = computed(() => props.did)
|
||||
const did = computed(() => fromShortDid(props.shortDid))
|
||||
const rkey = computed(() => props.rkey)
|
||||
|
||||
const author = computedAsync(async () => getAuthor(did.value))
|
||||
@@ -125,7 +126,7 @@ watch(
|
||||
<div class="note article">
|
||||
<div class="header">
|
||||
<back-button
|
||||
:fallback="{ name: 'PublicNoteListByDidView', params: { did } }"
|
||||
:fallback="{ name: 'PublicNoteListByDidView', params: { shortDid } }"
|
||||
:prefer-fallback="false"
|
||||
/>
|
||||
|
||||
@@ -134,7 +135,7 @@ watch(
|
||||
v-if="author && content"
|
||||
>
|
||||
<router-link
|
||||
:to="{ name: 'PublicNoteListByDidView', params: { did: did } }"
|
||||
:to="{ name: 'PublicNoteListByDidView', params: { shortDid } }"
|
||||
class="link link-hover"
|
||||
>
|
||||
{{ author.handle }}
|
||||
|
||||
Reference in New Issue
Block a user