mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 11:27:03 +00:00
Fix modal stuff
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
const {next} = $props()
|
const {next} = $props()
|
||||||
|
|
||||||
|
const nextUrl = $state.snapshot(next)
|
||||||
|
|
||||||
let loading = $state(false)
|
let loading = $state(false)
|
||||||
|
|
||||||
const enableChat = async () => {
|
const enableChat = async () => {
|
||||||
@@ -23,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearModals()
|
clearModals()
|
||||||
goto(next)
|
goto(nextUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
|
|||||||
@@ -11,19 +11,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hash = $derived($page.url.hash.slice(1))
|
const hash = $derived($page.url.hash.slice(1))
|
||||||
const hashIsValid = $derived(Boolean($modals[hash]))
|
|
||||||
const modal = $derived($modals[hash])
|
const modal = $derived($modals[hash])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window onkeydown={onKeyDown} />
|
<svelte:window onkeydown={onKeyDown} />
|
||||||
|
|
||||||
{#if hashIsValid && modal?.options?.drawer}
|
{#if modal?.options?.drawer}
|
||||||
<Drawer onClose={clearModals} {...modal.options}>
|
<Drawer onClose={clearModals} {...modal.options}>
|
||||||
{#key modal.id}
|
{#key modal.id}
|
||||||
<modal.component {...modal.props} />
|
<modal.component {...modal.props} />
|
||||||
{/key}
|
{/key}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
{:else if hashIsValid && modal}
|
{:else if modal}
|
||||||
<Dialog onClose={clearModals} {...modal.options}>
|
<Dialog onClose={clearModals} {...modal.options}>
|
||||||
{#key modal.id}
|
{#key modal.id}
|
||||||
<modal.component {...modal.props} />
|
<modal.component {...modal.props} />
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type {Writable} from "svelte/store"
|
|||||||
import {get} from "svelte/store"
|
import {get} from "svelte/store"
|
||||||
import type {StampedEvent} from "@welshman/util"
|
import type {StampedEvent} from "@welshman/util"
|
||||||
import {makeEvent, getTagValues, getListTags, BLOSSOM_AUTH} 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 {Router} from "@welshman/router"
|
||||||
import {signer, profileSearch, userBlossomServers} from "@welshman/app"
|
import {signer, profileSearch, userBlossomServers} from "@welshman/app"
|
||||||
import {Editor, MentionSuggestion, WelshmanExtension} from "@welshman/editor"
|
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",
|
method: "head",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Nostr ${btoa(JSON.stringify(event))}`,
|
Authorization: `Nostr ${btoa(JSON.stringify(event))}`,
|
||||||
@@ -45,7 +45,7 @@ export const getUploadUrl = async (spaceUrl?: string) => {
|
|||||||
const allUrls = removeNil([spaceUrl, ...userUrls])
|
const allUrls = removeNil([spaceUrl, ...userUrls])
|
||||||
|
|
||||||
for (let url of allUrls) {
|
for (let url of allUrls) {
|
||||||
url = url.replace(/wss?:\/\//, "https://")
|
url = url.replace(/^ws/, "http")
|
||||||
|
|
||||||
if (await hasBlossomSupport(url)) {
|
if (await hasBlossomSupport(url)) {
|
||||||
return url
|
return url
|
||||||
|
|||||||
Reference in New Issue
Block a user