Compare commits
No commits in common. "1ff5f205b2c4829a571021139fa7e3abf48518cb" and "48f29a1338ae811d2c9599b7e49cee8fd6c0e922" have entirely different histories.
1ff5f205b2
...
48f29a1338
|
@ -8,7 +8,7 @@ import DropTarget, {type DropTargetOptions} from "./uppy-dropzone"
|
||||||
import {useSdk} from "~/components/lib/sdk-context.js";
|
import {useSdk} from "~/components/lib/sdk-context.js";
|
||||||
import UppyFileUpload from "~/components/lib/uppy-file-upload.js";
|
import UppyFileUpload from "~/components/lib/uppy-file-upload.js";
|
||||||
import {PROTOCOL_S5, Sdk} from "@lumeweb/portal-sdk";
|
import {PROTOCOL_S5, Sdk} from "@lumeweb/portal-sdk";
|
||||||
import {S5Client, HashProgressEvent} from "@lumeweb/s5-js";
|
import {S5Client} from "@lumeweb/s5-js";
|
||||||
|
|
||||||
const LISTENING_EVENTS = [
|
const LISTENING_EVENTS = [
|
||||||
"upload",
|
"upload",
|
||||||
|
@ -98,18 +98,7 @@ export function useUppy({
|
||||||
const file = uppyInstance.current?.getFile(fileID) as UppyFile
|
const file = uppyInstance.current?.getFile(fileID) as UppyFile
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (file.uploader === "tus") {
|
if (file.uploader === "tus") {
|
||||||
const hashProgressCb = (event: HashProgressEvent) => {
|
const options = await sdk.protocols!().get<S5Client>(PROTOCOL_S5).getSdk().getTusOptions(file.data as File)
|
||||||
uppyInstance.current?.emit("preprocess-progress", file, {
|
|
||||||
uploadStarted: false,
|
|
||||||
bytesUploaded: 0,
|
|
||||||
preprocess: {
|
|
||||||
mode: "determinate",
|
|
||||||
message: "Hashing file...",
|
|
||||||
value: Math.round((event.total / event.total) * 100)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const options = await sdk.protocols!().get<S5Client>(PROTOCOL_S5).getSdk().getTusOptions(file.data as File, {}, {onHashProgress: hashProgressCb})
|
|
||||||
uppyInstance.current?.setFileState(fileID, {
|
uppyInstance.current?.setFileState(fileID, {
|
||||||
tus: options,
|
tus: options,
|
||||||
meta: {
|
meta: {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"@conform-to/react": "^1.0.2",
|
"@conform-to/react": "^1.0.2",
|
||||||
"@conform-to/zod": "^1.0.2",
|
"@conform-to/zod": "^1.0.2",
|
||||||
"@fontsource-variable/manrope": "^5.0.19",
|
"@fontsource-variable/manrope": "^5.0.19",
|
||||||
"@lumeweb/portal-sdk": "0.0.0-20240318224232",
|
"@lumeweb/portal-sdk": "0.0.0-20240318220522",
|
||||||
"@radix-ui/react-avatar": "^1.0.4",
|
"@radix-ui/react-avatar": "^1.0.4",
|
||||||
"@radix-ui/react-checkbox": "^1.0.4",
|
"@radix-ui/react-checkbox": "^1.0.4",
|
||||||
"@radix-ui/react-dialog": "^1.0.5",
|
"@radix-ui/react-dialog": "^1.0.5",
|
||||||
|
|
Loading…
Reference in New Issue