heic2any를 동적으로 import하도록 변경

This commit is contained in:
static
2025-01-15 08:34:50 +09:00
parent 9f9c52ff94
commit 366f657113
3 changed files with 3 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import FileSaver from "file-saver"; import FileSaver from "file-saver";
import heic2any from "heic2any";
import { untrack } from "svelte"; import { untrack } from "svelte";
import type { Writable } from "svelte/store"; import type { Writable } from "svelte/store";
import { TopBar } from "$lib/components"; import { TopBar } from "$lib/components";
@@ -41,6 +40,7 @@
requestFileDownload(data.id, $info.contentIv, $info.dataKey).then(async (res) => { requestFileDownload(data.id, $info.contentIv, $info.dataKey).then(async (res) => {
content = new Blob([res], { type: $info.contentType }); content = new Blob([res], { type: $info.contentType });
if (content.type === "image/heic" || content.type === "image/heif") { if (content.type === "image/heic" || content.type === "image/heif") {
const { default: heic2any } = await import("heic2any");
contentUrl = URL.createObjectURL( contentUrl = URL.createObjectURL(
(await heic2any({ blob: content, toType: "image/jpeg" })) as Blob, (await heic2any({ blob: content, toType: "image/jpeg" })) as Blob,
); );

View File

@@ -2,8 +2,6 @@ import { error } from "@sveltejs/kit";
import { z } from "zod"; import { z } from "zod";
import type { PageLoad } from "./$types"; import type { PageLoad } from "./$types";
export const ssr = false; // Because of heic2any
export const load: PageLoad = async ({ params }) => { export const load: PageLoad = async ({ params }) => {
const zodRes = z const zodRes = z
.object({ .object({

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { saveAs } from "file-saver"; import FileSaver from "file-saver";
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
import { Button, TextButton } from "$lib/components/buttons"; import { Button, TextButton } from "$lib/components/buttons";
import { TitleDiv, BottomDiv } from "$lib/components/divs"; import { TitleDiv, BottomDiv } from "$lib/components/divs";
@@ -31,7 +31,7 @@
const clientKeysBlob = new Blob([JSON.stringify(clientKeysSerialized)], { const clientKeysBlob = new Blob([JSON.stringify(clientKeysSerialized)], {
type: "application/json", type: "application/json",
}); });
saveAs(clientKeysBlob, "arkvault-clientkey.json"); FileSaver.saveAs(clientKeysBlob, "arkvault-clientkey.json");
if (!isBeforeContinueBottomSheetOpen) { if (!isBeforeContinueBottomSheetOpen) {
setTimeout(() => { setTimeout(() => {