From 5873e8aa60fe30c47616efc16b8da13d56cf171d Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Tue, 29 Apr 2025 15:20:40 -0700 Subject: [PATCH] Fix modal stuff --- src/app/components/ChatEnable.svelte | 4 +++- src/app/components/ModalContainer.svelte | 5 ++--- src/app/editor/index.ts | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/components/ChatEnable.svelte b/src/app/components/ChatEnable.svelte index 84228865..2a730f1a 100644 --- a/src/app/components/ChatEnable.svelte +++ b/src/app/components/ChatEnable.svelte @@ -13,6 +13,8 @@ const {next} = $props() + const nextUrl = $state.snapshot(next) + let loading = $state(false) const enableChat = async () => { @@ -23,7 +25,7 @@ } clearModals() - goto(next) + goto(nextUrl) } const submit = async () => { diff --git a/src/app/components/ModalContainer.svelte b/src/app/components/ModalContainer.svelte index 0ed130e9..99d2f36b 100644 --- a/src/app/components/ModalContainer.svelte +++ b/src/app/components/ModalContainer.svelte @@ -11,19 +11,18 @@ } const hash = $derived($page.url.hash.slice(1)) - const hashIsValid = $derived(Boolean($modals[hash])) const modal = $derived($modals[hash]) -{#if hashIsValid && modal?.options?.drawer} +{#if modal?.options?.drawer} {#key modal.id} {/key} -{:else if hashIsValid && modal} +{:else if modal} {#key modal.id} diff --git a/src/app/editor/index.ts b/src/app/editor/index.ts index c11f8927..f2ee1fe0 100644 --- a/src/app/editor/index.ts +++ b/src/app/editor/index.ts @@ -3,7 +3,7 @@ import type {Writable} from "svelte/store" import {get} from "svelte/store" import type {StampedEvent} from "@welshman/util" import {makeEvent, getTagValues, getListTags, BLOSSOM_AUTH} from "@welshman/util" -import {simpleCache, removeNil, now} from "@welshman/lib" +import {simpleCache, normalizeUrl, removeNil, now} from "@welshman/lib" import {Router} from "@welshman/router" import {signer, profileSearch, userBlossomServers} from "@welshman/app" import {Editor, MentionSuggestion, WelshmanExtension} from "@welshman/editor" @@ -22,7 +22,7 @@ export const hasBlossomSupport = simpleCache(async ([url]: [string]) => { }), ) - const res = await fetch(url + "/upload", { + const res = await fetch(normalizeUrl(url) + "/upload", { method: "head", headers: { Authorization: `Nostr ${btoa(JSON.stringify(event))}`, @@ -45,7 +45,7 @@ export const getUploadUrl = async (spaceUrl?: string) => { const allUrls = removeNil([spaceUrl, ...userUrls]) for (let url of allUrls) { - url = url.replace(/wss?:\/\//, "https://") + url = url.replace(/^ws/, "http") if (await hasBlossomSupport(url)) { return url