diff --git a/src/lib/components/ShareMenu.svelte b/src/lib/components/ShareMenu.svelte index d6c64e1..12d3c95 100644 --- a/src/lib/components/ShareMenu.svelte +++ b/src/lib/components/ShareMenu.svelte @@ -13,12 +13,10 @@ const mastodonUrlModal: ModalSettings = { type: 'prompt', - // Data title: 'Mastodon instance URL', - valueAttr: { type: 'text', placeholder: 'https://mastodon.social' }, - // Returns the updated response value - response: (r: string) => { - // Strip everything but the host and tld + valueAttr: { type: 'text', required: true, placeholder: 'https://mastodon.social' }, + response: (r: string | false) => { + if (!r) return; const url = new URL(r); const host = url.host; window.open(`https://${host}/share?text=${encodeURIComponent(shareMessage)}`, '_blank');