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 latestRelease = await fetch(repoUrl);
|
||||||
const json = await latestRelease.json();
|
const json = await latestRelease.json();
|
||||||
if (json.length <= 0) return false;
|
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) {
|
} 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
|
// Emitted when the window is ready to be shown
|
||||||
// This helps in showing the window gracefully.
|
// This helps in showing the window gracefully.
|
||||||
mainWindow.once("ready-to-show", async () => {
|
mainWindow.once("ready-to-show", async () => {
|
||||||
const hasUpdate = await updateAvailable();
|
const updateInfo = await updateAvailable();
|
||||||
console.log({ hasUpdate });
|
if (!updateInfo.update) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
||||||
|
}
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -22,6 +22,7 @@
|
||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
|
"sweetalert2": "^11.10.3",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -8484,6 +8485,15 @@
|
||||||
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==",
|
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==",
|
||||||
"dev": true
|
"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": {
|
"node_modules/systeminformation": {
|
||||||
"version": "5.21.22",
|
"version": "5.21.22",
|
||||||
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.22.tgz",
|
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.22.tgz",
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
|
"sweetalert2": "^11.10.3",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -105,3 +105,9 @@ ipcRenderer.addListener("ezpplauncher:launchprogress", (e, args) => {
|
||||||
new CustomEvent("launchProgressUpdate", { detail: args }),
|
new CustomEvent("launchProgressUpdate", { detail: args }),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:update", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("update", { detail: args }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
|
@ -6,11 +6,14 @@
|
||||||
DropdownHeader,
|
DropdownHeader,
|
||||||
DropdownDivider,
|
DropdownDivider,
|
||||||
Button,
|
Button,
|
||||||
|
Modal,
|
||||||
|
Indicator,
|
||||||
} from "flowbite-svelte";
|
} from "flowbite-svelte";
|
||||||
import {
|
import {
|
||||||
ArrowLeftSolid,
|
ArrowLeftSolid,
|
||||||
ArrowRightFromBracketSolid,
|
ArrowRightFromBracketSolid,
|
||||||
ArrowRightToBracketSolid,
|
ArrowRightToBracketSolid,
|
||||||
|
HeartSolid,
|
||||||
UserSettingsSolid,
|
UserSettingsSolid,
|
||||||
} from "flowbite-svelte-icons";
|
} from "flowbite-svelte-icons";
|
||||||
import ezppLogo from "../public/favicon.png";
|
import ezppLogo from "../public/favicon.png";
|
||||||
|
@ -33,14 +36,14 @@
|
||||||
let user: User | undefined = undefined;
|
let user: User | undefined = undefined;
|
||||||
let loggedIn = false;
|
let loggedIn = false;
|
||||||
|
|
||||||
|
let showUpdateDialog = false;
|
||||||
|
let updateInfo: Record<string, unknown>;
|
||||||
|
|
||||||
currentUser.subscribe((newUser) => {
|
currentUser.subscribe((newUser) => {
|
||||||
loggedIn = newUser != undefined;
|
loggedIn = newUser != undefined;
|
||||||
user = newUser;
|
user = newUser;
|
||||||
});
|
});
|
||||||
|
|
||||||
presence.subscribe((val) => {
|
|
||||||
});
|
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
window.dispatchEvent(new CustomEvent("logout"));
|
window.dispatchEvent(new CustomEvent("logout"));
|
||||||
currentUser.set(undefined);
|
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) => {
|
window.addEventListener("launchStatusUpdate", (e) => {
|
||||||
console.log((e as CustomEvent).detail);
|
|
||||||
const status = (e as CustomEvent).detail.status;
|
const status = (e as CustomEvent).detail.status;
|
||||||
launchStatus.set(status);
|
launchStatus.set(status);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("launchProgressUpdate", (e) => {
|
window.addEventListener("launchProgressUpdate", (e) => {
|
||||||
console.log((e as CustomEvent).detail);
|
|
||||||
const progress = (e as CustomEvent).detail.progress;
|
const progress = (e as CustomEvent).detail.progress;
|
||||||
launchPercentage.set(progress);
|
launchPercentage.set(progress);
|
||||||
});
|
});
|
||||||
|
@ -108,6 +119,8 @@
|
||||||
|
|
||||||
<Toaster></Toaster>
|
<Toaster></Toaster>
|
||||||
|
|
||||||
|
<!-- TODO: Update dialog-->
|
||||||
|
|
||||||
<div class="p-2 flex flex-row justify-between items-center">
|
<div class="p-2 flex flex-row justify-between items-center">
|
||||||
<div class="flex flex-row items-center animate-fadeIn opacity-0">
|
<div class="flex flex-row items-center animate-fadeIn opacity-0">
|
||||||
{#if $currentPage == Page.Settings}
|
{#if $currentPage == Page.Settings}
|
||||||
|
@ -137,6 +150,14 @@
|
||||||
: "https://a.ez-pp.farm/0"}
|
: "https://a.ez-pp.farm/0"}
|
||||||
id="avatar-menu"
|
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>
|
</div>
|
||||||
<Dropdown placement="bottom-start" triggeredBy="#avatar-menu">
|
<Dropdown placement="bottom-start" triggeredBy="#avatar-menu">
|
||||||
<DropdownHeader>
|
<DropdownHeader>
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: "Prompt";
|
font-family: "Prompt";
|
||||||
|
-webkit-user-select: none !important;
|
||||||
|
user-select: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html .cet-titlebar {
|
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);
|
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 {
|
@keyframes progress-loading {
|
||||||
50% {
|
50% {
|
||||||
background-position-x: -115%;
|
background-position-x: -115%;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user