From c8b1bd07d20db77dd49fba458017c57080b1662c Mon Sep 17 00:00:00 2001 From: Chris W Date: Sat, 21 Oct 2023 20:47:54 -0600 Subject: [PATCH] fix issue with mastodon modal --- src/lib/components/ShareMenu.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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');