aboutsummaryrefslogtreecommitdiff
path: root/src/client/Network.ts
diff options
context:
space:
mode:
authorbrynnchernosky <56202540+brynnchernosky@users.noreply.github.com>2022-10-28 10:10:04 -0400
committerbrynnchernosky <56202540+brynnchernosky@users.noreply.github.com>2022-10-28 10:10:04 -0400
commitceb338752aacc383c97a0e3a9b608365a1cf39b6 (patch)
treed2f355b726a9b21950f332c0f65931d7d6eef515 /src/client/Network.ts
parent5d6a0458b9d4f35e0c568a4d76d4fcab4e22f698 (diff)
parent2fc88a931cb2fc3408297b000208990633445585 (diff)
merge
Diffstat (limited to 'src/client/Network.ts')
-rw-r--r--src/client/Network.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/client/Network.ts b/src/client/Network.ts
index a222b320f..19eff3b3b 100644
--- a/src/client/Network.ts
+++ b/src/client/Network.ts
@@ -30,6 +30,17 @@ export namespace Networking {
if (!files.length) {
return [];
}
+ const maxFileSize = 50000000;
+ if (files.some(f => f.size > maxFileSize)) {
+ return new Promise<any>(res =>
+ res([
+ {
+ source: { name: '', type: '', size: 0, toJson: () => ({ name: '', type: '' }) },
+ result: { name: '', message: `max file size (${maxFileSize / 1000000}MB) exceeded` },
+ },
+ ])
+ );
+ }
files.forEach(file => formData.append(Utils.GenerateGuid(), file));
} else {
formData.append(Utils.GenerateGuid(), files);
@@ -51,4 +62,13 @@ export namespace Networking {
const response = await fetch('/uploadYoutubeVideo', parameters);
return response.json();
}
+ export async function QueryYoutubeProgress(videoId: string): Promise<{ progress: string }> {
+ const parameters = {
+ method: 'POST',
+ body: JSON.stringify({ videoId }),
+ json: true,
+ };
+ const response = await fetch('/queryYoutubeProgress', parameters);
+ return response.json();
+ }
}