add toggles for presence and patch
This commit is contained in:
parent
cef085c13d
commit
61d5182854
|
@ -1,9 +1,13 @@
|
||||||
const DiscordRPC = require("discord-auto-rpc");
|
const DiscordRPC = require("discord-auto-rpc");
|
||||||
const { appName, appVersion } = require("./appInfo.js");
|
const { appName, appVersion } = require("./appInfo.js");
|
||||||
|
const { get } = require("./config.js");
|
||||||
|
|
||||||
const clientId = "1032772293220384808";
|
const clientId = "1032772293220384808";
|
||||||
let richPresence;
|
let richPresence;
|
||||||
|
|
||||||
|
let showPresence = true;
|
||||||
|
let cleared = false;
|
||||||
|
|
||||||
let currentStatus = {
|
let currentStatus = {
|
||||||
details: " ",
|
details: " ",
|
||||||
state: "Idle in Launcher...",
|
state: "Idle in Launcher...",
|
||||||
|
@ -32,7 +36,19 @@ module.exports = {
|
||||||
richPresence.endlessLogin({ clientId });
|
richPresence.endlessLogin({ clientId });
|
||||||
richPresence.once("ready", () => {
|
richPresence.once("ready", () => {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
richPresence.setActivity(currentStatus);
|
const settingPresence = get("presence");
|
||||||
|
showPresence = settingPresence != undefined
|
||||||
|
? settingPresence.val == "true"
|
||||||
|
: true;
|
||||||
|
|
||||||
|
if (showPresence) {
|
||||||
|
richPresence.setActivity(currentStatus);
|
||||||
|
cleared = false;
|
||||||
|
} else {
|
||||||
|
if (cleared) return;
|
||||||
|
cleared = true;
|
||||||
|
richPresence.clearActivity();
|
||||||
|
}
|
||||||
}, 2500);
|
}, 2500);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -53,6 +69,8 @@ module.exports = {
|
||||||
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
||||||
},
|
},
|
||||||
update: () => {
|
update: () => {
|
||||||
richPresence.setActivity(currentStatus);
|
if (showPresence) {
|
||||||
}
|
richPresence.setActivity(currentStatus);
|
||||||
};
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
18
electron/updateCheck.js
Normal file
18
electron/updateCheck.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
const semver = require("semver");
|
||||||
|
const { appVersion } = require("./appInfo");
|
||||||
|
|
||||||
|
const repoUrl =
|
||||||
|
"https://git.ez-pp.farm/api/v1/repos/EZPPFarm/EZPPLauncher/releases?limit=1";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
updateAvailable: async () => {
|
||||||
|
try {
|
||||||
|
const latestRelease = await fetch(repoUrl);
|
||||||
|
const json = await latestRelease.json();
|
||||||
|
if (json.length <= 0) return false;
|
||||||
|
return semver.lt(appVersion, json[0].tag_name);
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
55
main.js
55
main.js
|
@ -29,6 +29,8 @@ const { runFileDetached } = require("./electron/executeUtil");
|
||||||
const richPresence = require("./electron/richPresence");
|
const richPresence = require("./electron/richPresence");
|
||||||
const cryptUtil = require("./electron/cryptoUtil");
|
const cryptUtil = require("./electron/cryptoUtil");
|
||||||
const { getHwId } = require("./electron/hwidUtil");
|
const { getHwId } = require("./electron/hwidUtil");
|
||||||
|
const { appName, appVersion } = require("./electron/appInfo");
|
||||||
|
const { updateAvailable } = require("./electron/updateCheck");
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
@ -73,18 +75,22 @@ function startOsuStatus() {
|
||||||
|
|
||||||
const windowTitle = firstInstance.processTitle;
|
const windowTitle = firstInstance.processTitle;
|
||||||
lastOsuStatus = windowTitle;
|
lastOsuStatus = windowTitle;
|
||||||
const currentStatusRequest = await fetch("https://api.ez-pp.farm/get_player_status?name=" + currentUser.username);
|
const currentStatusRequest = await fetch(
|
||||||
|
"https://api.ez-pp.farm/get_player_status?name=" + currentUser.username,
|
||||||
|
);
|
||||||
const currentStatus = await currentStatusRequest.json();
|
const currentStatus = await currentStatusRequest.json();
|
||||||
|
|
||||||
if (!("player_status" in currentStatus)) return;
|
if (!("player_status" in currentStatus)) return;
|
||||||
if (!("status" in currentStatus.player_status)) return;
|
if (!("status" in currentStatus.player_status)) return;
|
||||||
|
|
||||||
let details = "Idle...";
|
let details = "Idle...";
|
||||||
let infoText = currentStatus.player_status.status.info_text.length > 0 ? currentStatus.player_status.status.info_text : " ";
|
let infoText = currentStatus.player_status.status.info_text.length > 0
|
||||||
|
? currentStatus.player_status.status.info_text
|
||||||
|
: " ";
|
||||||
|
|
||||||
switch (currentStatus.player_status.status.action) {
|
switch (currentStatus.player_status.status.action) {
|
||||||
case 1:
|
case 1:
|
||||||
details = "AFK..."
|
details = "AFK...";
|
||||||
infoText = " ";
|
infoText = " ";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -94,7 +100,7 @@ function startOsuStatus() {
|
||||||
details = "Editing...";
|
details = "Editing...";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
details = "Modding..."
|
details = "Modding...";
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
details = "Multiplayer: Selecting a Beatmap...";
|
details = "Multiplayer: Selecting a Beatmap...";
|
||||||
|
@ -124,7 +130,7 @@ function startOsuStatus() {
|
||||||
|
|
||||||
richPresence.updateStatus({
|
richPresence.updateStatus({
|
||||||
details,
|
details,
|
||||||
state: infoText
|
state: infoText,
|
||||||
});
|
});
|
||||||
|
|
||||||
richPresence.update();
|
richPresence.update();
|
||||||
|
@ -260,6 +266,17 @@ function registerIPCPipes() {
|
||||||
return config.all();
|
return config.all();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:setting-update", async (e, args) => {
|
||||||
|
for (const key of Object.keys(args)) {
|
||||||
|
const value = args[key];
|
||||||
|
if (typeof value == "boolean") {
|
||||||
|
config.set(key, value ? "true" : "false");
|
||||||
|
} else {
|
||||||
|
config.set(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:detect-folder", async (e) => {
|
ipcMain.handle("ezpplauncher:detect-folder", async (e) => {
|
||||||
const detected = await findOsuInstallation();
|
const detected = await findOsuInstallation();
|
||||||
if (detected && await isValidOsuFolder(detected)) {
|
if (detected && await isValidOsuFolder(detected)) {
|
||||||
|
@ -295,8 +312,9 @@ function registerIPCPipes() {
|
||||||
return config.all();
|
return config.all();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:launch", async (e, args) => {
|
ipcMain.handle("ezpplauncher:launch", async (e) => {
|
||||||
patch = args.patch;
|
const configPatch = config.get("patch");
|
||||||
|
patch = configPatch != undefined ? configPatch.val == "true" : true;
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
status: "Checking osu! directory...",
|
status: "Checking osu! directory...",
|
||||||
});
|
});
|
||||||
|
@ -344,8 +362,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 +393,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 +440,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();
|
||||||
|
@ -466,7 +487,7 @@ function registerIPCPipes() {
|
||||||
richPresence.updateVersion();
|
richPresence.updateVersion();
|
||||||
richPresence.updateStatus({
|
richPresence.updateStatus({
|
||||||
state: "Idle in Launcher...",
|
state: "Idle in Launcher...",
|
||||||
details: undefined
|
details: undefined,
|
||||||
});
|
});
|
||||||
richPresence.update();
|
richPresence.update();
|
||||||
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
@ -483,7 +504,6 @@ function registerIPCPipes() {
|
||||||
mainWindow.hide();
|
mainWindow.hide();
|
||||||
startOsuStatus();
|
startOsuStatus();
|
||||||
|
|
||||||
|
|
||||||
/* mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
/* mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
progress: 0,
|
progress: 0,
|
||||||
});
|
});
|
||||||
|
@ -504,6 +524,7 @@ function createWindow() {
|
||||||
resizable: false,
|
resizable: false,
|
||||||
frame: false,
|
frame: false,
|
||||||
titleBarStyle: "hidden",
|
titleBarStyle: "hidden",
|
||||||
|
title: `${appName} ${appVersion}`,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
preload: path.join(__dirname, "preload.js"),
|
preload: path.join(__dirname, "preload.js"),
|
||||||
|
@ -550,7 +571,9 @@ 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", () => {
|
mainWindow.once("ready-to-show", async () => {
|
||||||
|
const hasUpdate = await updateAvailable();
|
||||||
|
console.log({ hasUpdate });
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
140
package-lock.json
generated
140
package-lock.json
generated
|
@ -20,6 +20,7 @@
|
||||||
"electron-serve": "^1.1.0",
|
"electron-serve": "^1.1.0",
|
||||||
"get-window-by-name": "^2.0.0",
|
"get-window-by-name": "^2.0.0",
|
||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
|
@ -168,6 +169,14 @@
|
||||||
"global-agent": "^3.0.0"
|
"global-agent": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@electron/get/node_modules/semver": {
|
||||||
|
"version": "6.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||||
|
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@electron/notarize": {
|
"node_modules/@electron/notarize": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.1.0.tgz",
|
||||||
|
@ -362,21 +371,6 @@
|
||||||
"graceful-fs": "^4.1.6"
|
"graceful-fs": "^4.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@electron/rebuild/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@electron/rebuild/node_modules/universalify": {
|
"node_modules/@electron/rebuild/node_modules/universalify": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
||||||
|
@ -1147,21 +1141,6 @@
|
||||||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@npmcli/fs/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@npmcli/move-file": {
|
"node_modules/@npmcli/move-file": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz",
|
||||||
|
@ -2044,21 +2023,6 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/app-builder-lib/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/app-builder-lib/node_modules/universalify": {
|
"node_modules/app-builder-lib/node_modules/universalify": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
||||||
|
@ -4488,21 +4452,6 @@
|
||||||
"node": ">=10.0"
|
"node": ">=10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/global-agent/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"optional": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/globalthis": {
|
"node_modules/globalthis": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
|
||||||
|
@ -5728,20 +5677,6 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-abi/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-addon-api": {
|
"node_modules/node-addon-api": {
|
||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
|
@ -5756,21 +5691,6 @@
|
||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-api-version/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
"version": "2.7.0",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
|
@ -5850,21 +5770,6 @@
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-gyp/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.14",
|
"version": "2.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
||||||
|
@ -7712,11 +7617,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "6.3.1",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||||
|
"dependencies": {
|
||||||
|
"lru-cache": "^6.0.0"
|
||||||
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/semver-compare": {
|
"node_modules/semver-compare": {
|
||||||
|
@ -7852,21 +7763,6 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/simple-update-notifier/node_modules/semver": {
|
|
||||||
"version": "7.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"lru-cache": "^6.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/sirv": {
|
"node_modules/sirv": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz",
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
"electron-serve": "^1.1.0",
|
"electron-serve": "^1.1.0",
|
||||||
"get-window-by-name": "^2.0.0",
|
"get-window-by-name": "^2.0.0",
|
||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { Titlebar, TitlebarColor } = require("custom-electron-titlebar");
|
const { Titlebar, TitlebarColor } = require("custom-electron-titlebar");
|
||||||
const { ipcRenderer } = require("electron");
|
const { ipcRenderer } = require("electron");
|
||||||
|
const { appName, appVersion } = require("./electron/appInfo");
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
const titlebar = new Titlebar({
|
const titlebar = new Titlebar({
|
||||||
|
@ -9,6 +10,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
enableMnemonics: false,
|
enableMnemonics: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
});
|
});
|
||||||
|
titlebar.updateTitle(`${appName} ${appVersion}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("login-attempt", async (e) => {
|
window.addEventListener("login-attempt", async (e) => {
|
||||||
|
@ -57,6 +59,11 @@ window.addEventListener("settings-get", async () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("setting-update", async (e) => {
|
||||||
|
const detail = e.detail;
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:setting-update", detail);
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener("folder-auto", async (e) => {
|
window.addEventListener("folder-auto", async (e) => {
|
||||||
const result = await ipcRenderer.invoke("ezpplauncher:detect-folder");
|
const result = await ipcRenderer.invoke("ezpplauncher:detect-folder");
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
|
|
|
@ -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,9 @@
|
||||||
currentUser,
|
currentUser,
|
||||||
launching,
|
launching,
|
||||||
launchPercentage,
|
launchPercentage,
|
||||||
launchStatus
|
launchStatus,
|
||||||
|
patch,
|
||||||
|
presence,
|
||||||
} 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";
|
||||||
|
@ -36,6 +38,9 @@
|
||||||
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);
|
||||||
|
@ -44,7 +49,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 +80,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 +89,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 +99,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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +128,7 @@
|
||||||
</div>
|
</div>
|
||||||
{#if $currentPage == Page.Launch}
|
{#if $currentPage == Page.Launch}
|
||||||
<div
|
<div
|
||||||
class="flex flex-row gap-2 w-fill cursor-pointer md:order-2 animate-fadeIn opacity-0"
|
class="flex flex-row gap-2 w-fill cursor-pointer md:order-2 animate-lsideIn opacity-0"
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
class="rounded-lg border dark:border-gray-700 hover:ring-4 hover:ring-gray-200 dark:hover:ring-gray-800"
|
class="rounded-lg border dark:border-gray-700 hover:ring-4 hover:ring-gray-200 dark:hover:ring-gray-800"
|
||||||
|
|
|
@ -196,7 +196,7 @@
|
||||||
<Checkbox bind:checked={saveCredentials} disabled={loading}
|
<Checkbox bind:checked={saveCredentials} disabled={loading}
|
||||||
>Save credentials</Checkbox
|
>Save credentials</Checkbox
|
||||||
>
|
>
|
||||||
<div class="flex flex-col justify-center items-center gap-5 mt-1">
|
<div class="flex flex-col justify-center items-center gap-2 mt-1">
|
||||||
<Button
|
<Button
|
||||||
class="dark:active:!bg-gray-900 active:scale-95 transition-transform duration-75"
|
class="dark:active:!bg-gray-900 active:scale-95 transition-transform duration-75"
|
||||||
color="light"
|
color="light"
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import { Button, ButtonGroup, Input, Toggle } from "flowbite-svelte";
|
||||||
Button,
|
|
||||||
ButtonGroup,
|
|
||||||
Input,
|
|
||||||
Label,
|
|
||||||
Toggle,
|
|
||||||
Tooltip
|
|
||||||
} from "flowbite-svelte";
|
|
||||||
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
||||||
import { patch, presence } from "./../storage/localStore";
|
import { patch, presence } from "./../storage/localStore";
|
||||||
|
|
||||||
|
@ -15,6 +8,12 @@
|
||||||
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");
|
||||||
|
const settingPatch = settings.find((setting) => setting.key == "patch");
|
||||||
|
const settingPresence = settings.find(
|
||||||
|
(setting) => setting.key == "presence"
|
||||||
|
);
|
||||||
|
patch.set(settingPatch ? settingPatch.val == "true" : true);
|
||||||
|
presence.set(settingPresence ? settingPresence.val == "true" : true);
|
||||||
folderPath = osuPath ? osuPath.val : "";
|
folderPath = osuPath ? osuPath.val : "";
|
||||||
});
|
});
|
||||||
window.dispatchEvent(new CustomEvent("settings-get"));
|
window.dispatchEvent(new CustomEvent("settings-get"));
|
||||||
|
@ -29,12 +28,16 @@
|
||||||
|
|
||||||
const togglePatching = () => {
|
const togglePatching = () => {
|
||||||
patch.set(!$patch);
|
patch.set(!$patch);
|
||||||
//TODO: save in config
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("setting-update", { detail: { patch: $patch } })
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const togglePresence = () => {
|
const togglePresence = () => {
|
||||||
presence.set(!$presence);
|
presence.set(!$presence);
|
||||||
//TODO: save in config
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("setting-update", { detail: { presence: $presence } })
|
||||||
|
);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { Page } from "../consts/pages";
|
||||||
import type { User } from "../types/user";
|
import type { User } from "../types/user";
|
||||||
|
|
||||||
export const startup = writable(false);
|
export const startup = writable(false);
|
||||||
|
export const updateAvailable = writable(false);
|
||||||
export const launching = writable(false);
|
export const launching = writable(false);
|
||||||
export const launchStatus = writable("Waiting...");
|
export const launchStatus = writable("Waiting...");
|
||||||
export const launchPercentage = writable(-1);
|
export const launchPercentage = writable(-1);
|
||||||
|
|
|
@ -12,6 +12,10 @@ const config = {
|
||||||
"0%": { opacity: "0", transform: "translateX(-5px)" },
|
"0%": { opacity: "0", transform: "translateX(-5px)" },
|
||||||
"100%": { opacity: "1" },
|
"100%": { opacity: "1" },
|
||||||
},
|
},
|
||||||
|
lslideIn: {
|
||||||
|
"0%": { opacity: "0", transform: "translateX(5px)" },
|
||||||
|
"100%": { opacity: "1" },
|
||||||
|
},
|
||||||
fadeIn: {
|
fadeIn: {
|
||||||
"0%": { opacity: "0", transform: "translateY(5px)" },
|
"0%": { opacity: "0", transform: "translateY(5px)" },
|
||||||
"100%": { opacity: "1" },
|
"100%": { opacity: "1" },
|
||||||
|
@ -23,6 +27,7 @@ const config = {
|
||||||
},
|
},
|
||||||
animation: {
|
animation: {
|
||||||
sideIn: "slideIn 1s ease forwards",
|
sideIn: "slideIn 1s ease forwards",
|
||||||
|
lsideIn: "lslideIn 1s ease forwards",
|
||||||
fadeIn: "fadeIn 1s ease forwards",
|
fadeIn: "fadeIn 1s ease forwards",
|
||||||
fadeOut: "fadeOut 1s ease forwards",
|
fadeOut: "fadeOut 1s ease forwards",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user