11<script setup lang="ts">
22import { updateProfile as updateProfileUtil } from ' ~/utils/atproto/profile'
33import type { CommandPaletteContextCommandInput } from ' ~/types/command-palette'
4+ import { getSafeHttpUrl } from ' #shared/utils/url'
45
56const route = useRoute (' profile-identity' )
67const identity = computed (() => route .params .identity )
@@ -94,6 +95,7 @@ const inviteUrl = computed(() => {
9495 const text = $t (' profile.invite.compose_text' , { handle: profile .value .handle })
9596 return ` https://bsky.app/intent/compose?text=${encodeURIComponent (text )} `
9697})
98+ const safeProfileWebsiteUrl = computed (() => getSafeHttpUrl (profile .value .website ))
9799
98100useCommandPaletteContextCommands (
99101 computed ((): CommandPaletteContextCommandInput [] => {
@@ -112,14 +114,14 @@ useCommandPaletteContextCommands(
112114 })
113115 }
114116
115- if (profile .value . website ) {
117+ if (safeProfileWebsiteUrl .value ) {
116118 commands .push ({
117119 id: ' profile-website' ,
118120 group: ' links' ,
119121 label: $t (' profile.website' ),
120- keywords: [profile .value .website , profile .value .handle ?? identity .value ],
122+ keywords: [profile .value .website ?? ' ' , profile .value .handle ?? identity .value ],
121123 iconClass: ' i-lucide:link' ,
122- href: profile .value . website ,
124+ href: safeProfileWebsiteUrl .value ,
123125 })
124126 }
125127
@@ -207,7 +209,11 @@ defineOgImageComponent('Default', {
207209 <p v-if =" profile.description" >{{ profile.description }}</p >
208210 <div class =" flex gap-4 items-center font-mono text-sm" >
209211 <h2 >@{{ profile.handle ?? identity }}</h2 >
210- <LinkBase v-if =" profile.website" :to =" profile.website" classicon =" i-lucide:link" >
212+ <LinkBase
213+ v-if =" safeProfileWebsiteUrl"
214+ :to =" safeProfileWebsiteUrl"
215+ classicon =" i-lucide:link"
216+ >
211217 {{ profile.website }}
212218 </LinkBase >
213219 <ButtonBase
0 commit comments