pyro: multipart mrpack uploads (#2917)
* chore: impl in pyroservers Signed-off-by: Evan Song <theevansong@gmail.com> * chore: disable install btn if loading Signed-off-by: Evan Song <theevansong@gmail.com> --------- Signed-off-by: Evan Song <theevansong@gmail.com>
This commit is contained in:
parent
d0efa44c9e
commit
deb16aa7ab
@ -47,9 +47,12 @@ async function PyroFetch<T>(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) {
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
/>
|
||||
<div class="mt-4 flex justify-start gap-4">
|
||||
<ButtonStyled :color="isDangerous ? 'red' : 'brand'">
|
||||
<button :disabled="!mrpackFile" @click="reinstallMrpack">
|
||||
<button :disabled="!mrpackFile || isLoading" @click="reinstallMrpack">
|
||||
<RightArrowIcon />
|
||||
{{
|
||||
isSecondPhase
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user