fix issue with mastodon modal

This commit is contained in:
Chris W 2023-10-21 20:47:54 -06:00
parent 06e0f1fc3e
commit c8b1bd07d2
1 changed files with 3 additions and 5 deletions

View File

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