preperations for update dialog
This commit is contained in:
parent
61d5182854
commit
8d61a8b2b7
|
@ -10,9 +10,12 @@ module.exports = {
|
|||
const latestRelease = await fetch(repoUrl);
|
||||
const json = await latestRelease.json();
|
||||
if (json.length <= 0) return false;
|
||||
return semver.lt(appVersion, json[0].tag_name);
|
||||
return {
|
||||
update: semver.lt(appVersion, json[0].tag_name),
|
||||
release: json[0],
|
||||
};
|
||||
} catch (err) {
|
||||
return false;
|
||||
return { update: false };
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
7
main.js
7
main.js
|
@ -572,9 +572,12 @@ function createWindow() {
|
|||
// Emitted when the window is ready to be shown
|
||||
// This helps in showing the window gracefully.
|
||||
mainWindow.once("ready-to-show", async () => {
|
||||
const hasUpdate = await updateAvailable();
|
||||
console.log({ hasUpdate });
|
||||
const updateInfo = await updateAvailable();
|
||||
if (!updateInfo.update) {
|
||||
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
||||
}
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -22,6 +22,7 @@
|
|||
"regedit-rs": "^1.0.2",
|
||||
"semver": "^7.5.4",
|
||||
"svelte-french-toast": "^1.2.0",
|
||||
"sweetalert2": "^11.10.3",
|
||||
"systeminformation": "^5.21.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -8484,6 +8485,15 @@
|
|||
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sweetalert2": {
|
||||
"version": "11.10.3",
|
||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.3.tgz",
|
||||
"integrity": "sha512-mZYtQR7v+khyEruq0SsVUa6XIdI9Aue8s2XAIpAwdlLN1T0w7mxKEjyubiBZ3/bLbHC/wGS4wNABvXWubCizvA==",
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/limonte"
|
||||
}
|
||||
},
|
||||
"node_modules/systeminformation": {
|
||||
"version": "5.21.22",
|
||||
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.22.tgz",
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
"regedit-rs": "^1.0.2",
|
||||
"semver": "^7.5.4",
|
||||
"svelte-french-toast": "^1.2.0",
|
||||
"sweetalert2": "^11.10.3",
|
||||
"systeminformation": "^5.21.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -105,3 +105,9 @@ ipcRenderer.addListener("ezpplauncher:launchprogress", (e, args) => {
|
|||
new CustomEvent("launchProgressUpdate", { detail: args }),
|
||||
);
|
||||
});
|
||||
|
||||
ipcRenderer.addListener("ezpplauncher:update", (e, args) => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("update", { detail: args }),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -6,11 +6,14 @@
|
|||
DropdownHeader,
|
||||
DropdownDivider,
|
||||
Button,
|
||||
Modal,
|
||||
Indicator,
|
||||
} from "flowbite-svelte";
|
||||
import {
|
||||
ArrowLeftSolid,
|
||||
ArrowRightFromBracketSolid,
|
||||
ArrowRightToBracketSolid,
|
||||
HeartSolid,
|
||||
UserSettingsSolid,
|
||||
} from "flowbite-svelte-icons";
|
||||
import ezppLogo from "../public/favicon.png";
|
||||
|
@ -33,14 +36,14 @@
|
|||
let user: User | undefined = undefined;
|
||||
let loggedIn = false;
|
||||
|
||||
let showUpdateDialog = false;
|
||||
let updateInfo: Record<string, unknown>;
|
||||
|
||||
currentUser.subscribe((newUser) => {
|
||||
loggedIn = newUser != undefined;
|
||||
user = newUser;
|
||||
});
|
||||
|
||||
presence.subscribe((val) => {
|
||||
});
|
||||
|
||||
const logout = () => {
|
||||
window.dispatchEvent(new CustomEvent("logout"));
|
||||
currentUser.set(undefined);
|
||||
|
@ -53,14 +56,22 @@
|
|||
});
|
||||
};
|
||||
|
||||
window.addEventListener("update", (e) => {
|
||||
const update = (e as CustomEvent).detail;
|
||||
setTimeout(() => {
|
||||
showUpdateDialog = true;
|
||||
updateInfo = update;
|
||||
|
||||
document.getElementById("updateDialog")?.blur();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
window.addEventListener("launchStatusUpdate", (e) => {
|
||||
console.log((e as CustomEvent).detail);
|
||||
const status = (e as CustomEvent).detail.status;
|
||||
launchStatus.set(status);
|
||||
});
|
||||
|
||||
window.addEventListener("launchProgressUpdate", (e) => {
|
||||
console.log((e as CustomEvent).detail);
|
||||
const progress = (e as CustomEvent).detail.progress;
|
||||
launchPercentage.set(progress);
|
||||
});
|
||||
|
@ -108,6 +119,8 @@
|
|||
|
||||
<Toaster></Toaster>
|
||||
|
||||
<!-- TODO: Update dialog-->
|
||||
|
||||
<div class="p-2 flex flex-row justify-between items-center">
|
||||
<div class="flex flex-row items-center animate-fadeIn opacity-0">
|
||||
{#if $currentPage == Page.Settings}
|
||||
|
@ -137,6 +150,14 @@
|
|||
: "https://a.ez-pp.farm/0"}
|
||||
id="avatar-menu"
|
||||
/>
|
||||
<!-- TODO: if user has donator, display heart indicator-->
|
||||
{#if $currentUser && $currentUser.id == 1001}
|
||||
<Indicator color="red" border size="xl" placement="top-right">
|
||||
<span class="text-red-300 text-xs font-bold">
|
||||
<HeartSolid size="xs" />
|
||||
</span>
|
||||
</Indicator>
|
||||
{/if}
|
||||
</div>
|
||||
<Dropdown placement="bottom-start" triggeredBy="#avatar-menu">
|
||||
<DropdownHeader>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
* {
|
||||
font-family: "Prompt";
|
||||
-webkit-user-select: none !important;
|
||||
user-select: none !important;
|
||||
}
|
||||
|
||||
html .cet-titlebar {
|
||||
|
@ -62,6 +64,11 @@ html .cet-titlebar .cet-control-icon svg {
|
|||
transition: width 0.35s cubic-bezier(0.65, -0.02, 0.31, 1.01);
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-webkit-user-select: none !important;
|
||||
user-select: none !important;
|
||||
}
|
||||
|
||||
@keyframes progress-loading {
|
||||
50% {
|
||||
background-position-x: -115%;
|
||||
|
|
Loading…
Reference in New Issue
Block a user