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 = {
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');