Mercurial > code > home > repos > video
diff src/ingest/IngestDrop.ts @ 17:071943adf000
dnd a file or a url which we'll queue and fetch
author | drewp@bigasterisk.com |
---|---|
date | Sun, 16 Apr 2023 03:19:33 -0700 |
parents | 53d99454f394 |
children | 1b388ee5dd09 |
line wrap: on
line diff
--- a/src/ingest/IngestDrop.ts Sun Apr 16 03:17:48 2023 -0700 +++ b/src/ingest/IngestDrop.ts Sun Apr 16 03:19:33 2023 -0700 @@ -38,23 +38,23 @@ return; } - for (let i = 0; i < ev.dataTransfer.files.length; i++) { - const f = ev.dataTransfer.files[i]; - const name = f.name; - const stream = f.stream(); - fetch("../api/ingest/videoUpload?name=" + encodeURIComponent(f.name), { - method: "POST", - body: stream, - duplex: "half", - }); - } - const url = ev.dataTransfer.getData("text/plain"); if (url) { fetch("../api/ingest/videoUrl", { method: "POST", body: url, }); + } else { + for (let i = 0; i < ev.dataTransfer.files.length; i++) { + const f = ev.dataTransfer.files[i]; + const name = f.name; + const stream = f.stream(); + fetch("../api/ingest/videoUpload?name=" + encodeURIComponent(f.name), { + method: "POST", + body: stream, + duplex: "half", + } as any); + } } } }