Compare commits
No commits in common. "cef085c13da78b8052d283465a2447605b0e79fb" and "ae566f09a0fc88be3120b327e071f791c4a153e1" have entirely different histories.
cef085c13d
...
ae566f09a0
@ -52,7 +52,4 @@ module.exports = {
|
|||||||
currentStatus.smallImageKey = osuVersion ? "osu" : " ";
|
currentStatus.smallImageKey = osuVersion ? "osu" : " ";
|
||||||
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
||||||
},
|
},
|
||||||
update: () => {
|
|
||||||
richPresence.setActivity(currentStatus);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
43
main.js
43
main.js
@ -36,9 +36,7 @@ let mainWindow;
|
|||||||
let osuCheckInterval;
|
let osuCheckInterval;
|
||||||
let userOsuPath;
|
let userOsuPath;
|
||||||
let osuLoaded = false;
|
let osuLoaded = false;
|
||||||
let patch = false;
|
|
||||||
let lastOsuStatus = "";
|
let lastOsuStatus = "";
|
||||||
let lastStatusUpdate;
|
|
||||||
|
|
||||||
let currentUser = undefined;
|
let currentUser = undefined;
|
||||||
|
|
||||||
@ -58,15 +56,13 @@ function startOsuStatus() {
|
|||||||
if (!osuLoaded) {
|
if (!osuLoaded) {
|
||||||
osuLoaded = true;
|
osuLoaded = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (patch) {
|
const patcherExecuteable = path.join(
|
||||||
const patcherExecuteable = path.join(
|
userOsuPath,
|
||||||
userOsuPath,
|
"EZPPLauncher",
|
||||||
"EZPPLauncher",
|
"patcher.exe",
|
||||||
"patcher.exe",
|
);
|
||||||
);
|
if (existsSync(patcherExecuteable)) {
|
||||||
if (existsSync(patcherExecuteable)) {
|
runFileDetached(userOsuPath, patcherExecuteable);
|
||||||
runFileDetached(userOsuPath, patcherExecuteable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
@ -125,9 +121,7 @@ function startOsuStatus() {
|
|||||||
richPresence.updateStatus({
|
richPresence.updateStatus({
|
||||||
details,
|
details,
|
||||||
state: infoText
|
state: infoText
|
||||||
});
|
})
|
||||||
|
|
||||||
richPresence.update();
|
|
||||||
}
|
}
|
||||||
}, 2500);
|
}, 2500);
|
||||||
}
|
}
|
||||||
@ -296,7 +290,7 @@ function registerIPCPipes() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:launch", async (e, args) => {
|
ipcMain.handle("ezpplauncher:launch", async (e, args) => {
|
||||||
patch = args.patch;
|
const patch = args.patch;
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: "Checking osu! directory...",
|
status: "Checking osu! directory...",
|
||||||
});
|
});
|
||||||
@ -344,8 +338,9 @@ function registerIPCPipes() {
|
|||||||
progress: Math.ceil(data.progress),
|
progress: Math.ceil(data.progress),
|
||||||
});
|
});
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total)
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
})...`,
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await uiDownloader.startDownload();
|
await uiDownloader.startDownload();
|
||||||
@ -374,8 +369,9 @@ function registerIPCPipes() {
|
|||||||
progress: Math.ceil(data.progress),
|
progress: Math.ceil(data.progress),
|
||||||
});
|
});
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total)
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
})...`,
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await updateDownloader.startDownload();
|
await updateDownloader.startDownload();
|
||||||
@ -420,8 +416,9 @@ function registerIPCPipes() {
|
|||||||
progress: Math.ceil(data.progress),
|
progress: Math.ceil(data.progress),
|
||||||
});
|
});
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total)
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
})...`,
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await patcherDownloader.startDownload();
|
await patcherDownloader.startDownload();
|
||||||
@ -449,7 +446,6 @@ function registerIPCPipes() {
|
|||||||
|
|
||||||
const userConfig = getUserConfig(osuPath);
|
const userConfig = getUserConfig(osuPath);
|
||||||
richPresence.updateVersion(await userConfig.get("LastVersion"));
|
richPresence.updateVersion(await userConfig.get("LastVersion"));
|
||||||
richPresence.update();
|
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
await userConfig.set("Username", currentUser.username);
|
await userConfig.set("Username", currentUser.username);
|
||||||
await userConfig.set("Password", currentUser.password);
|
await userConfig.set("Password", currentUser.password);
|
||||||
@ -467,8 +463,7 @@ function registerIPCPipes() {
|
|||||||
richPresence.updateStatus({
|
richPresence.updateStatus({
|
||||||
state: "Idle in Launcher...",
|
state: "Idle in Launcher...",
|
||||||
details: undefined
|
details: undefined
|
||||||
});
|
})
|
||||||
richPresence.update();
|
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: "Waiting for cleanup...",
|
status: "Waiting for cleanup...",
|
||||||
});
|
});
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
DropdownItem,
|
DropdownItem,
|
||||||
DropdownHeader,
|
DropdownHeader,
|
||||||
DropdownDivider,
|
DropdownDivider,
|
||||||
Button
|
Button,
|
||||||
} from "flowbite-svelte";
|
} from "flowbite-svelte";
|
||||||
import {
|
import {
|
||||||
ArrowLeftSolid,
|
ArrowLeftSolid,
|
||||||
ArrowRightFromBracketSolid,
|
ArrowRightFromBracketSolid,
|
||||||
ArrowRightToBracketSolid,
|
ArrowRightToBracketSolid,
|
||||||
UserSettingsSolid
|
UserSettingsSolid,
|
||||||
} from "flowbite-svelte-icons";
|
} from "flowbite-svelte-icons";
|
||||||
import ezppLogo from "../public/favicon.png";
|
import ezppLogo from "../public/favicon.png";
|
||||||
import {
|
import {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
currentUser,
|
currentUser,
|
||||||
launching,
|
launching,
|
||||||
launchPercentage,
|
launchPercentage,
|
||||||
launchStatus
|
launchStatus,
|
||||||
} from "./storage/localStore";
|
} from "./storage/localStore";
|
||||||
import { Page } from "./consts/pages";
|
import { Page } from "./consts/pages";
|
||||||
import Login from "./pages/Login.svelte";
|
import Login from "./pages/Login.svelte";
|
||||||
@ -44,7 +44,7 @@
|
|||||||
position: "bottom-center",
|
position: "bottom-center",
|
||||||
className:
|
className:
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -75,7 +75,7 @@
|
|||||||
position: "bottom-center",
|
position: "bottom-center",
|
||||||
className:
|
className:
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@
|
|||||||
position: "bottom-center",
|
position: "bottom-center",
|
||||||
className:
|
className:
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
duration: 4000
|
duration: 4000,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@
|
|||||||
position: "bottom-center",
|
position: "bottom-center",
|
||||||
className:
|
className:
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
duration: 1500
|
duration: 1500,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,8 +107,8 @@
|
|||||||
<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}
|
||||||
<Button
|
<Button
|
||||||
class="dark:active:!bg-gray-900 !ring-0 w-10 h-10 mr-1 rounded-lg animate-sideIn opacity-0 active:scale-95 transition-transform duration-75"
|
class="dark:!bg-gray-800 dark:active:!bg-gray-950 !ring-0 outline-none !border-none dark:text-white w-10 h-10 mr-1 rounded-lg animate-sideIn opacity-0"
|
||||||
color="light"
|
color="none"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
currentPage.set(Page.Launch);
|
currentPage.set(Page.Launch);
|
||||||
}}
|
}}
|
||||||
|
56
src/discord/richPresence.js
Normal file
56
src/discord/richPresence.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
const DiscordRPC = require("discord-auto-rpc");
|
||||||
|
const { appName, appVersion } = require("../../appInfo");
|
||||||
|
|
||||||
|
const clientId = "1032772293220384808";
|
||||||
|
let richPresence;
|
||||||
|
|
||||||
|
let currentStatus = {
|
||||||
|
state: " ",
|
||||||
|
details: "Idle in Launcher...",
|
||||||
|
startTimestamp: new Date(),
|
||||||
|
largeImageKey: "ezppfarm",
|
||||||
|
largeImageText: `${appName} ${appVersion}`,
|
||||||
|
smallImageKey: " ",
|
||||||
|
smallImageText: " ",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
label: "Download the Launcher",
|
||||||
|
url: "https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Join EZPPFarm",
|
||||||
|
url: "https://ez-pp.farm/discord"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
instance: false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
connect: () => {
|
||||||
|
if (!richPresence) {
|
||||||
|
richPresence = new DiscordRPC.AutoClient({ transport: "ipc" });
|
||||||
|
richPresence.endlessLogin({ clientId });
|
||||||
|
richPresence.once("ready", () => {
|
||||||
|
setInterval(() => {
|
||||||
|
richPresence.setActivity(currentStatus);
|
||||||
|
}, 2500)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disconnect: async () => {
|
||||||
|
if (richPresence) {
|
||||||
|
await richPresence.clearActivity();
|
||||||
|
await richPresence.destroy();
|
||||||
|
richPresence = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateStatus: ({ state, details }) => {
|
||||||
|
currentStatus.state = state ?? " ";
|
||||||
|
currentStatus.details = details ?? " ";
|
||||||
|
},
|
||||||
|
updateVersion: (osuVersion) => {
|
||||||
|
currentStatus.smallImageKey = osuVersion ? "osu" : " ";
|
||||||
|
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
||||||
|
}
|
||||||
|
}
|
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
const launch = () => {
|
const launch = () => {
|
||||||
launching.set(true);
|
launching.set(true);
|
||||||
const patching = $patch;
|
window.dispatchEvent(new CustomEvent("launch", { detail: { patch: $patch } }));;
|
||||||
window.dispatchEvent(new CustomEvent("launch", { detail: { patch: patching } }));;
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -35,6 +34,11 @@
|
|||||||
disabled={$launching}
|
disabled={$launching}
|
||||||
on:click={launch}>Launch</Button
|
on:click={launch}>Launch</Button
|
||||||
>
|
>
|
||||||
|
<Checkbox
|
||||||
|
disabled={$launching}
|
||||||
|
bind:checked={$patch}
|
||||||
|
on:click={() => patch.set(!$patch)}>Patch</Checkbox
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="w-full flex flex-col justify-center items-center gap-2 mt-2 {$launching
|
class="w-full flex flex-col justify-center items-center gap-2 mt-2 {$launching
|
||||||
? 'animate-fadeIn '
|
? 'animate-fadeIn '
|
||||||
|
@ -5,13 +5,17 @@
|
|||||||
Input,
|
Input,
|
||||||
Label,
|
Label,
|
||||||
Toggle,
|
Toggle,
|
||||||
Tooltip
|
Tooltip,
|
||||||
} from "flowbite-svelte";
|
} from "flowbite-svelte";
|
||||||
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
||||||
import { patch, presence } from "./../storage/localStore";
|
import { currentPage } from "../storage/localStore";
|
||||||
|
import { Page } from "../consts/pages";
|
||||||
|
|
||||||
let folderPath: string = "";
|
let folderPath: string = "";
|
||||||
|
|
||||||
|
let patching: boolean = true;
|
||||||
|
let presence: boolean = true;
|
||||||
|
|
||||||
window.addEventListener("settings-result", (e) => {
|
window.addEventListener("settings-result", (e) => {
|
||||||
const settings: Record<string, string>[] = (e as CustomEvent).detail;
|
const settings: Record<string, string>[] = (e as CustomEvent).detail;
|
||||||
const osuPath = settings.find((setting) => setting.key == "osuPath");
|
const osuPath = settings.find((setting) => setting.key == "osuPath");
|
||||||
@ -28,13 +32,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const togglePatching = () => {
|
const togglePatching = () => {
|
||||||
patch.set(!$patch);
|
patching = !patching;
|
||||||
//TODO: save in config
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const togglePresence = () => {
|
const togglePresence = () => {
|
||||||
presence.set(!$presence);
|
presence = !presence;
|
||||||
//TODO: save in config
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -42,10 +44,10 @@
|
|||||||
class="h-[265px] flex flex-col justify-start p-3 animate-fadeIn opacity-0"
|
class="h-[265px] flex flex-col justify-start p-3 animate-fadeIn opacity-0"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col gap-2 p-3">
|
<div class="flex flex-col gap-2 p-3">
|
||||||
<Toggle class="w-fit" bind:checked={$presence} on:click={togglePresence}
|
<Toggle class="w-fit" bind:checked={presence} on:click={togglePresence}
|
||||||
>Discord Presence</Toggle
|
>Discord Presence</Toggle
|
||||||
>
|
>
|
||||||
<Toggle class="w-fit" bind:checked={$patch} on:click={togglePatching}
|
<Toggle class="w-fit" bind:checked={patching} on:click={togglePatching}
|
||||||
>Patching</Toggle
|
>Patching</Toggle
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,6 +8,5 @@ export const launchStatus = writable("Waiting...");
|
|||||||
export const launchPercentage = writable(-1);
|
export const launchPercentage = writable(-1);
|
||||||
export const osuPath: Writable<undefined | string> = writable(undefined);
|
export const osuPath: Writable<undefined | string> = writable(undefined);
|
||||||
export const patch = writable(true);
|
export const patch = writable(true);
|
||||||
export const presence = writable(true);
|
|
||||||
export const currentUser: Writable<undefined | User> = writable(undefined);
|
export const currentUser: Writable<undefined | User> = writable(undefined);
|
||||||
export const currentPage = writable(Page.Login);
|
export const currentPage = writable(Page.Login);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user