mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/remux: download files properly
This commit is contained in:
parent
853bc26587
commit
dd1c630c71
1 changed files with 7 additions and 13 deletions
|
@ -5,9 +5,9 @@
|
||||||
import { beforeNavigate } from "$app/navigation";
|
import { beforeNavigate } from "$app/navigation";
|
||||||
|
|
||||||
import { device } from "$lib/device";
|
import { device } from "$lib/device";
|
||||||
import { openURL } from "$lib/download";
|
|
||||||
import { t } from "$lib/i18n/translations";
|
import { t } from "$lib/i18n/translations";
|
||||||
import { createDialog } from "$lib/dialogs";
|
import { createDialog } from "$lib/dialogs";
|
||||||
|
import { downloadFile } from "$lib/download";
|
||||||
|
|
||||||
import Skeleton from "$components/misc/Skeleton.svelte";
|
import Skeleton from "$components/misc/Skeleton.svelte";
|
||||||
import DropReceiver from "$components/misc/DropReceiver.svelte";
|
import DropReceiver from "$components/misc/DropReceiver.svelte";
|
||||||
|
@ -133,19 +133,13 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (render) {
|
if (!render) {
|
||||||
if (device.is.iOS) {
|
return console.log("not a valid file");
|
||||||
return await navigator.share({
|
|
||||||
files: [
|
|
||||||
new File([ render ], file.name, { type: render.type })
|
|
||||||
]
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
openURL(URL.createObjectURL(render));
|
|
||||||
} else {
|
|
||||||
console.log("not a valid file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return await downloadFile({
|
||||||
|
file,
|
||||||
|
})
|
||||||
} finally {
|
} finally {
|
||||||
processing = false;
|
processing = false;
|
||||||
file = undefined;
|
file = undefined;
|
||||||
|
|
Loading…
Reference in a new issue