Skip to content

Commit

Permalink
Update installer
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Mar 20, 2023
1 parent d44d0ef commit 6eb2071
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
Binary file added app/public/_dev/spacewarp-release-1.0.1.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const App = () => {
<AsyncRoute
path="/install"
getComponent={() =>
import("./routes/InstallProgress").then(
import("./routes/Install").then(
(m) => m.InstallProgress
)
}
Expand Down
39 changes: 29 additions & 10 deletions app/src/mocks/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,50 @@ export const toDataURI = (blob: Blob) => {
});
};

export const save = (url: string, name: string) => {
const a = document.createElement("a");

a.href = url;
a.download = name;

document.body.appendChild(a);

a.click();
a.remove();
};

export const downloadBepInEx = async () => {
const url = "/_dev/BepInEx_x64_5.4.21.0.zip";
const url2 = "/_dev/spacewarp-release-1.0.1.zip";

const resp = await axios.get<Blob>(url, {
onDownloadProgress: (ev) => {
emit("download_progress", {
received: ev.loaded,
total: ev.total,
total: ev.total! * 2,
});
},

responseType: "blob",
});

const fileName = url.split("/").pop()!;

const dataUri = await toDataURI(resp.data);
const resp2 = await axios.get<Blob>(url2, {
onDownloadProgress: (ev) => {
emit("download_progress", {
received: ev.total! + ev.loaded,
total: ev.total! * 2,
});
},

const a = document.createElement("a");
responseType: "blob",
});

a.href = dataUri;
a.download = fileName;
const fileName = url.split("/").pop()!;
const fileName2 = url2.split("/").pop()!;

document.body.appendChild(a);
const dataUri = await toDataURI(resp.data);
const dataUri2 = await toDataURI(resp2.data);

a.click();
a.remove();
save(dataUri, fileName);
save(dataUri2, fileName2);
};
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "./InstallProgress.scss";
import "./Install.scss";
import banner from "../assets/background_banner.png";
import { useEffect, useState } from "preact/hooks";
import { invoke_proxy } from "../invoke";
Expand Down

0 comments on commit 6eb2071

Please sign in to comment.