From deb16aa7ab42692a1d00e7344a3e8a172010dbd0 Mon Sep 17 00:00:00 2001 From: Evan Song <52982404+ferothefox@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:24:13 -0700 Subject: [PATCH] pyro: multipart mrpack uploads (#2917) * chore: impl in pyroservers Signed-off-by: Evan Song * chore: disable install btn if loading Signed-off-by: Evan Song --------- Signed-off-by: Evan Song --- apps/frontend/src/composables/pyroServers.ts | 14 ++++++++++---- .../pages/servers/manage/[id]/options/loader.vue | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/composables/pyroServers.ts b/apps/frontend/src/composables/pyroServers.ts index 7cbd66dd1..26f529116 100644 --- a/apps/frontend/src/composables/pyroServers.ts +++ b/apps/frontend/src/composables/pyroServers.ts @@ -47,9 +47,12 @@ async function PyroFetch(path: string, options: PyroFetchOptions = {}): Promi "Access-Control-Allow-Headers": "Authorization", "User-Agent": "Pyro/1.0 (https://pyro.host)", Vary: "Accept, Origin", - "Content-Type": contentType, }; + if (contentType !== "none") { + headers["Content-Type"] = contentType; + } + if (import.meta.client && typeof window !== "undefined") { headers.Origin = window.location.origin; } @@ -396,10 +399,13 @@ const reinstallFromMrpack = async (mrpack: File, hardReset: boolean = false) => `servers/${internalServerRefrence.value.serverId}/reinstallFromMrpack`, ); - return await PyroFetch(`/reinstallMrpack?hard=${hardResetParam}`, { + const formData = new FormData(); + formData.append("file", mrpack); + + return await PyroFetch(`/reinstallMrpackMultiparted?hard=${hardResetParam}`, { method: "POST", - contentType: "application/octet-stream", - body: mrpack, + contentType: "none", + body: formData, override: auth, }); } catch (error) { diff --git a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue index 9a93f4f3b..18781fc64 100644 --- a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue +++ b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue @@ -103,7 +103,7 @@ />
-