Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/pages/home/file/File.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HStack, VStack } from "@hope-ui/solid"
import { createMemo, Show, Suspense } from "solid-js"
import { createMemo, ErrorBoundary, Show, Suspense } from "solid-js"
import { Dynamic } from "solid-js/web"
import { FullLoading, SelectWrapper } from "~/components"
import { Error, FullLoading, SelectWrapper } from "~/components"
import { objStore } from "~/store"
import { useRouter } from "~/hooks"
import { Download } from "../previews/download"
Expand Down Expand Up @@ -38,9 +38,11 @@ const File = () => {
/>
<OpenWith />
</HStack>
<Suspense fallback={<FullLoading />}>
<Dynamic component={cur()?.component} />
</Suspense>
<ErrorBoundary fallback={(err) => <Error msg={String(err)} />}>
<Suspense fallback={<FullLoading />}>
<Dynamic component={cur()?.component} />
</Suspense>
</ErrorBoundary>
</VStack>
</Show>
)
Expand Down
20 changes: 10 additions & 10 deletions src/pages/home/previews/url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import { createMemo } from "solid-js"
export default function () {
const [content] = useFetchText()
const { copy } = useUtil()
const t = useT()
const url = createMemo(() => {
try {
const ini = content()?.content || ""
const { text } = useParseText(ini)
const config = recordKeysToLowerCase(parse(text() || ""))
return config.internetshortcut?.url || "#"
} catch (error) {
console.error("Error parsing INI content:", error)
return "#"
}
if (content.loading) return ""
const ini = content()?.content
if (!ini) throw new Error("No content")
if (typeof ini === "string") throw new Error(ini)
const { text } = useParseText(ini)
const config = recordKeysToLowerCase(parse(text() || ""))
const shortcutUrl = config.internetshortcut?.url
if (!shortcutUrl) throw new Error("Invalid .url file: no URL found")
return shortcutUrl
})
const t = useT()
return (
<MaybeLoading loading={content.loading}>
<FileInfo>
Expand Down