Compare commits
26 Commits
1adb1b7dec
...
2.0.0
Author | SHA1 | Date | |
---|---|---|---|
dc88e9f2cc | |||
bf8a458b5f | |||
3570582c6b | |||
b9bd87c099 | |||
705e47a1b8 | |||
397c2255c1 | |||
00d71704ab | |||
f631c78805 | |||
8d61a8b2b7 | |||
61d5182854 | |||
cef085c13d | |||
a02737ef1b | |||
ae566f09a0 | |||
01905d695a | |||
94fa7e7bd8 | |||
d5b2b8012c | |||
05866946a3 | |||
0fc9cb828b | |||
e119166c65 | |||
6aa0a6c969 | |||
6369c0e8af | |||
f11e84efd7 | |||
d9fec1193e | |||
2c6b51cbb2 | |||
756ae1be58 | |||
4569d35a65 |
4
electron/appInfo.js
Normal file
4
electron/appInfo.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
const appName = "EZPPLauncher";
|
||||||
|
const appVersion = "2.0.0";
|
||||||
|
|
||||||
|
module.exports = { appName, appVersion };
|
@@ -38,7 +38,15 @@ const get = (
|
|||||||
return result ? result.val ?? undefined : undefined;
|
return result ? result.val ?? undefined : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const all = () => {
|
||||||
|
const result = db.prepare(
|
||||||
|
`SELECT configKey key, configValue val FROM config WHERE 1`,
|
||||||
|
).all();
|
||||||
|
return result ?? undefined;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
all,
|
||||||
get,
|
get,
|
||||||
set,
|
set,
|
||||||
remove,
|
remove,
|
11
electron/cryptoUtil.js
Normal file
11
electron/cryptoUtil.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const cryptojs = require("crypto-js");
|
||||||
|
|
||||||
|
const encrypt = (string, salt) => {
|
||||||
|
return cryptojs.AES.encrypt(string, salt).toString();
|
||||||
|
};
|
||||||
|
|
||||||
|
const decrypt = (string, salt) => {
|
||||||
|
return cryptojs.AES.decrypt(string, salt).toString(cryptojs.enc.Utf8);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { encrypt, decrypt };
|
20
electron/executeUtil.js
Normal file
20
electron/executeUtil.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const childProcess = require("child_process");
|
||||||
|
|
||||||
|
const runFile = (folder, file, args, onExit) => {
|
||||||
|
childProcess.execFile(file, args, {
|
||||||
|
cwd: folder
|
||||||
|
}, (_err, _stdout, _stdin) => {
|
||||||
|
if (onExit) onExit();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const runFileDetached = (folder, file, args) => {
|
||||||
|
const subProcess = childProcess.spawn(file + (args ? " " + args : ''), {
|
||||||
|
cwd: folder,
|
||||||
|
detached: true,
|
||||||
|
stdio: 'ignore'
|
||||||
|
});
|
||||||
|
subProcess.unref();
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { runFile, runFileDetached };
|
13
electron/formattingUtil.js
Normal file
13
electron/formattingUtil.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
function formatBytes(bytes, decimals = 2) {
|
||||||
|
if (!+bytes) return '0 Bytes'
|
||||||
|
|
||||||
|
const k = 1024
|
||||||
|
const dm = decimals < 0 ? 0 : decimals
|
||||||
|
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||||
|
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||||
|
|
||||||
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))}${sizes[i]}`
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { formatBytes };
|
32
electron/hwidUtil.js
Normal file
32
electron/hwidUtil.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const child_process = require("child_process");
|
||||||
|
const options = { encoding: "ascii", windowsHide: true, timeout: 200 };
|
||||||
|
const platforms = {
|
||||||
|
win32: [
|
||||||
|
"REG QUERY HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",
|
||||||
|
/MachineGuid\s+REG_SZ\s+(.*?)\s/,
|
||||||
|
],
|
||||||
|
darwin: [
|
||||||
|
"ioreg -rd1 -c IOPlatformExpertDevice",
|
||||||
|
/"IOPlatformUUID" = "(.*?)"/,
|
||||||
|
],
|
||||||
|
linux: [
|
||||||
|
"cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || true",
|
||||||
|
/^([\da-f]+)/,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const crypto = require("crypto");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns machine hardware id.
|
||||||
|
* Returns `undefined` if cannot determine.
|
||||||
|
* @return {string?}
|
||||||
|
*/
|
||||||
|
function getHwId() {
|
||||||
|
const getter = platforms[process.platform];
|
||||||
|
if (!getter) return;
|
||||||
|
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||||
|
if (!result) return;
|
||||||
|
return crypto.createHash("md5").update(result[1]).digest("hex") ||
|
||||||
|
undefined;
|
||||||
|
}
|
||||||
|
exports.getHwId = getHwId;
|
478
electron/osuUtil.js
Normal file
478
electron/osuUtil.js
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const crypto = require("crypto");
|
||||||
|
const EventEmitter = require("events");
|
||||||
|
const { default: axios } = require("axios");
|
||||||
|
const { runFile } = require("./executeUtil.js");
|
||||||
|
|
||||||
|
const checkUpdateURL =
|
||||||
|
"https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
|
||||||
|
const ignoredOsuEntities = [
|
||||||
|
"osu!auth.dll",
|
||||||
|
];
|
||||||
|
const osuEntities = [
|
||||||
|
"avcodec-51.dll",
|
||||||
|
"avformat-52.dll",
|
||||||
|
"avutil-49.dll",
|
||||||
|
"bass.dll",
|
||||||
|
"bass_fx.dll",
|
||||||
|
"collection.db",
|
||||||
|
"d3dcompiler_47.dll",
|
||||||
|
"libEGL.dll",
|
||||||
|
"libGLESv2.dll",
|
||||||
|
"Microsoft.Ink.dll",
|
||||||
|
"OpenTK.dll",
|
||||||
|
"osu!.cfg",
|
||||||
|
"osu!.db",
|
||||||
|
"osu!.exe",
|
||||||
|
"osu!auth.dll",
|
||||||
|
"osu!gameplay.dll",
|
||||||
|
"osu!seasonal.dll",
|
||||||
|
"osu!ui.dll",
|
||||||
|
"presence.db",
|
||||||
|
"pthreadGC2.dll",
|
||||||
|
"scores.db",
|
||||||
|
];
|
||||||
|
|
||||||
|
const patcherFiles = [
|
||||||
|
{
|
||||||
|
name: "patcher.exe",
|
||||||
|
url_download: "https://ez-pp.farm/assets/patcher.exe",
|
||||||
|
url_hash: "https://ez-pp.farm/assets/patcher.md5",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "patch.hook.dll",
|
||||||
|
url_download: "https://ez-pp.farm/assets/patch.hook.dll",
|
||||||
|
url_hash: "https://ez-pp.farm/assets/patch.hook.md5",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const uiFiles = [
|
||||||
|
{
|
||||||
|
name: "ezpp!ui.dll",
|
||||||
|
url_download: "https://ez-pp.farm/assets/ezpp!ui.dll",
|
||||||
|
url_hash: "https://ez-pp.farm/assets/ezpp!ui.md5",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async function isValidOsuFolder(path) {
|
||||||
|
const allFiles = await fs.promises.readdir(path);
|
||||||
|
let matches = 0;
|
||||||
|
for (const file of allFiles) {
|
||||||
|
if (osuEntities.includes(file)) matches = matches + 1;
|
||||||
|
}
|
||||||
|
return (Math.round((matches / osuEntities.length) * 100) >= 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGlobalConfig(osuPath) {
|
||||||
|
const configFileInfo = {
|
||||||
|
name: "",
|
||||||
|
path: "",
|
||||||
|
get: async (key) => {
|
||||||
|
if (!configFileInfo.path) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const fileStream = await fs.promises.readFile(
|
||||||
|
configFileInfo.path,
|
||||||
|
"utf-8",
|
||||||
|
);
|
||||||
|
const lines = fileStream.split(/\r?\n/);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes(" = ")) {
|
||||||
|
const argsPair = line.split(" = ", 2);
|
||||||
|
const keyname = argsPair[0];
|
||||||
|
const value = argsPair[1];
|
||||||
|
if (keyname == key) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const globalOsuConfig = path.join(osuPath, "osu!.cfg");
|
||||||
|
if (fs.existsSync(globalOsuConfig)) {
|
||||||
|
configFileInfo.name = "osu!.cfg";
|
||||||
|
configFileInfo.path = globalOsuConfig;
|
||||||
|
}
|
||||||
|
return configFileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUserConfig(osuPath) {
|
||||||
|
const configFileInfo = {
|
||||||
|
name: "",
|
||||||
|
path: "",
|
||||||
|
set: async (key, newValue) => {
|
||||||
|
if (!configFileInfo.path) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const fileContents = [];
|
||||||
|
const fileStream = await fs.promises.readFile(
|
||||||
|
configFileInfo.path,
|
||||||
|
"utf-8",
|
||||||
|
);
|
||||||
|
const lines = fileStream.split(/\r?\n/);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes(" = ")) {
|
||||||
|
const argsPair = line.split(" = ", 2);
|
||||||
|
const keyname = argsPair[0];
|
||||||
|
if (keyname == key) {
|
||||||
|
fileContents.push(`${key} = ${newValue}`);
|
||||||
|
} else {
|
||||||
|
fileContents.push(line);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fileContents.push(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await fs.promises.writeFile(configFileInfo.path, fileContents.join("\n"));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
get: async (key) => {
|
||||||
|
if (!configFileInfo.path) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const fileStream = await fs.promises.readFile(
|
||||||
|
configFileInfo.path,
|
||||||
|
"utf-8",
|
||||||
|
);
|
||||||
|
const lines = fileStream.split(/\r?\n/);
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes(" = ")) {
|
||||||
|
const argsPair = line.split(" = ", 2);
|
||||||
|
const keyname = argsPair[0];
|
||||||
|
const value = argsPair[1];
|
||||||
|
if (keyname == key) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const userOsuConfig = path.join(
|
||||||
|
osuPath,
|
||||||
|
`osu!.${process.env["USERNAME"]}.cfg`,
|
||||||
|
);
|
||||||
|
if (fs.existsSync(userOsuConfig)) {
|
||||||
|
configFileInfo.name = `osu!.${process.env["USERNAME"]}.cfg`;
|
||||||
|
configFileInfo.path = userOsuConfig;
|
||||||
|
}
|
||||||
|
return configFileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getUpdateFiles(releaseStream) {
|
||||||
|
const releaseData = await fetch(checkUpdateURL + releaseStream);
|
||||||
|
return releaseData.ok ? await releaseData.json() : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getFilesThatNeedUpdate(osuPath, releaseStreamFiles) {
|
||||||
|
const updateFiles = [];
|
||||||
|
for (const updatePatch of releaseStreamFiles) {
|
||||||
|
const fileName = updatePatch.filename;
|
||||||
|
const fileHash = updatePatch.file_hash;
|
||||||
|
|
||||||
|
const fileOnDisk = path.join(osuPath, fileName);
|
||||||
|
if (fs.existsSync(fileOnDisk)) {
|
||||||
|
if (ignoredOsuEntities.includes(fileName)) continue;
|
||||||
|
const fileHashOnDisk = crypto.createHash("md5").update(
|
||||||
|
fs.readFileSync(fileOnDisk),
|
||||||
|
).digest("hex");
|
||||||
|
if (
|
||||||
|
fileHashOnDisk.trim().toLowerCase() != fileHash.trim().toLowerCase()
|
||||||
|
) {
|
||||||
|
updateFiles.push(updatePatch);
|
||||||
|
}
|
||||||
|
} else updateFiles.push(updatePatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadUpdateFiles(osuPath, updateFiles) {
|
||||||
|
const eventEmitter = new EventEmitter();
|
||||||
|
|
||||||
|
const startDownload = async () => {
|
||||||
|
for (const updatePatch of updateFiles) {
|
||||||
|
const fileName = updatePatch.filename;
|
||||||
|
const fileSize = updatePatch.filesize;
|
||||||
|
const fileURL = updatePatch.url_full;
|
||||||
|
|
||||||
|
const axiosDownloadWithProgress = await axios.get(fileURL, {
|
||||||
|
responseType: "stream",
|
||||||
|
onDownloadProgress: (progressEvent) => {
|
||||||
|
const { loaded, total } = progressEvent;
|
||||||
|
eventEmitter.emit("data", {
|
||||||
|
fileName,
|
||||||
|
loaded,
|
||||||
|
total,
|
||||||
|
progress: Math.floor((loaded / total) * 100),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
axiosDownloadWithProgress.data.on("end", () => {
|
||||||
|
eventEmitter.emit("data", {
|
||||||
|
fileName,
|
||||||
|
loaded: fileSize,
|
||||||
|
total: fileSize,
|
||||||
|
progress: 100,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(path.join(osuPath, fileName))) {
|
||||||
|
await fs.promises.rm(path.join(osuPath, fileName), {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
path.join(osuPath, fileName),
|
||||||
|
axiosDownloadWithProgress.data,
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
eventEmitter.emit("error", {
|
||||||
|
fileName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait until all files are downloaded
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
eventEmitter,
|
||||||
|
startDownload,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function runOsuWithDevServer(osuPath, serverDomain, onExit) {
|
||||||
|
const osuExecuteable = path.join(osuPath, "osu!.exe");
|
||||||
|
runFile(osuPath, osuExecuteable, ["-devserver", serverDomain], onExit);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPatcherUpdates(osuPath) {
|
||||||
|
const filesToDownload = [];
|
||||||
|
|
||||||
|
const patcherDir = path.join(osuPath, "EZPPLauncher");
|
||||||
|
if (!fs.existsSync(patcherDir)) fs.mkdirSync(patcherDir);
|
||||||
|
|
||||||
|
for (const patcherFile of patcherFiles) {
|
||||||
|
if (fs.existsSync(path.join(patcherDir, patcherFile.name))) {
|
||||||
|
const latestPatchFileHash = await (await fetch(patcherFile.url_hash))
|
||||||
|
.text();
|
||||||
|
const localPatchFileHash = crypto.createHash("md5").update(
|
||||||
|
fs.readFileSync(path.join(patcherDir, patcherFile.name)),
|
||||||
|
).digest("hex");
|
||||||
|
if (
|
||||||
|
latestPatchFileHash.trim().toLowerCase() !=
|
||||||
|
localPatchFileHash.trim().toLowerCase()
|
||||||
|
) filesToDownload.push(patcherFile);
|
||||||
|
} else filesToDownload.push(patcherFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filesToDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadPatcherUpdates(osuPath, patcherUpdates) {
|
||||||
|
const eventEmitter = new EventEmitter();
|
||||||
|
|
||||||
|
const startDownload = async () => {
|
||||||
|
const patcherDir = path.join(osuPath, "EZPPLauncher");
|
||||||
|
if (!fs.existsSync(patcherDir)) fs.mkdirSync(patcherDir);
|
||||||
|
|
||||||
|
for (const patcherFile of patcherUpdates) {
|
||||||
|
const fileName = patcherFile.name;
|
||||||
|
const fileURL = patcherFile.url_download;
|
||||||
|
const axiosDownloadWithProgress = await axios.get(fileURL, {
|
||||||
|
responseType: "stream",
|
||||||
|
onDownloadProgress: (progressEvent) => {
|
||||||
|
const { loaded, total } = progressEvent;
|
||||||
|
eventEmitter.emit("data", {
|
||||||
|
fileName,
|
||||||
|
loaded,
|
||||||
|
total,
|
||||||
|
progress: Math.floor((loaded / total) * 100),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) {
|
||||||
|
await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
path.join(osuPath, "EZPPLauncher", fileName),
|
||||||
|
axiosDownloadWithProgress.data,
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
eventEmitter.emit("error", {
|
||||||
|
fileName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
eventEmitter,
|
||||||
|
startDownload,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getUIFiles(osuPath) {
|
||||||
|
const filesToDownload = [];
|
||||||
|
|
||||||
|
const ezppLauncherDir = path.join(osuPath, "EZPPLauncher");
|
||||||
|
if (!fs.existsSync(ezppLauncherDir)) fs.mkdirSync(ezppLauncherDir);
|
||||||
|
|
||||||
|
for (const uiFile of uiFiles) {
|
||||||
|
if (fs.existsSync(path.join(ezppLauncherDir, uiFile.name))) {
|
||||||
|
const latestPatchFileHash = await (await fetch(uiFile.url_hash)).text();
|
||||||
|
const localPatchFileHash = crypto.createHash("md5").update(
|
||||||
|
fs.readFileSync(path.join(ezppLauncherDir, uiFile.name)),
|
||||||
|
).digest("hex");
|
||||||
|
if (
|
||||||
|
latestPatchFileHash.trim().toLowerCase() !=
|
||||||
|
localPatchFileHash.trim().toLowerCase()
|
||||||
|
) filesToDownload.push(uiFile);
|
||||||
|
} else filesToDownload.push(uiFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filesToDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadUIFiles(osuPath, uiFiles) {
|
||||||
|
const eventEmitter = new EventEmitter();
|
||||||
|
|
||||||
|
const startDownload = async () => {
|
||||||
|
const ezpplauncherDir = path.join(osuPath, "EZPPLauncher");
|
||||||
|
if (!fs.existsSync(ezpplauncherDir)) fs.mkdirSync(ezpplauncherDir);
|
||||||
|
|
||||||
|
for (const uiFile of uiFiles) {
|
||||||
|
const fileName = uiFile.name;
|
||||||
|
const fileURL = uiFile.url_download;
|
||||||
|
const axiosDownloadWithProgress = await axios.get(fileURL, {
|
||||||
|
responseType: "stream",
|
||||||
|
onDownloadProgress: (progressEvent) => {
|
||||||
|
const { loaded, total } = progressEvent;
|
||||||
|
eventEmitter.emit("data", {
|
||||||
|
fileName,
|
||||||
|
loaded,
|
||||||
|
total,
|
||||||
|
progress: Math.floor((loaded / total) * 100),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) {
|
||||||
|
await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
path.join(osuPath, "EZPPLauncher", fileName),
|
||||||
|
axiosDownloadWithProgress.data,
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
eventEmitter.emit("error", {
|
||||||
|
fileName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
eventEmitter,
|
||||||
|
startDownload,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function replaceUIFile(osuPath, revert) {
|
||||||
|
if (!revert) {
|
||||||
|
const ezppUIFile = path.join(osuPath, "EZPPLauncher", "ezpp!ui.dll");
|
||||||
|
const oldOsuUIFile = path.join(osuPath, "osu!ui.dll");
|
||||||
|
await fs.promises.rename(
|
||||||
|
oldOsuUIFile,
|
||||||
|
path.join(osuPath, "osu!ui.dll.bak"),
|
||||||
|
);
|
||||||
|
await fs.promises.rename(ezppUIFile, oldOsuUIFile);
|
||||||
|
} else {
|
||||||
|
const oldOsuUIFile = path.join(osuPath, "osu!ui.dll");
|
||||||
|
const ezppUIFile = path.join(osuPath, "EZPPLauncher", "ezpp!ui.dll");
|
||||||
|
await fs.promises.rename(oldOsuUIFile, ezppUIFile);
|
||||||
|
await fs.promises.rename(
|
||||||
|
path.join(osuPath, "osu!ui.dll.bak"),
|
||||||
|
oldOsuUIFile,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findOsuInstallation() {
|
||||||
|
const regedit = require("regedit-rs");
|
||||||
|
|
||||||
|
const osuLocationFromDefaultIcon =
|
||||||
|
"HKLM\\SOFTWARE\\Classes\\osu\\DefaultIcon";
|
||||||
|
const osuKey = regedit.listSync(osuLocationFromDefaultIcon);
|
||||||
|
if (osuKey[osuLocationFromDefaultIcon].exists) {
|
||||||
|
const key = osuKey[osuLocationFromDefaultIcon].values[""];
|
||||||
|
let value = key.value;
|
||||||
|
value = value.substring(1, value.length - 3);
|
||||||
|
return path.dirname(value.trim());
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateOsuConfigHashes(osuPath) {
|
||||||
|
const osuCfg = path.join(osuPath, "osu!.cfg");
|
||||||
|
const fileStream = await fs.promises.readFile(osuCfg, "utf-8");
|
||||||
|
const lines = fileStream.split(/\r?\n/);
|
||||||
|
const newLines = [];
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes(" = ")) {
|
||||||
|
const argsPair = line.split(" = ", 2);
|
||||||
|
const key = argsPair[0];
|
||||||
|
const value = argsPair[1];
|
||||||
|
|
||||||
|
if (key.startsWith("h_")) {
|
||||||
|
const fileName = key.substring(2, key.length);
|
||||||
|
const filePath = path.join(osuPath, fileName);
|
||||||
|
if (!fs.existsSync(filePath)) continue;
|
||||||
|
const binaryFileContents = await fs.promises.readFile(filePath);
|
||||||
|
const existingFileMD5 = crypto.createHash("md5").update(
|
||||||
|
binaryFileContents,
|
||||||
|
).digest("hex");
|
||||||
|
if (value == existingFileMD5) newLines.push(line);
|
||||||
|
else newLines.push(`${key} = ${existingFileMD5}`);
|
||||||
|
} else if (line.startsWith("u_UpdaterAutoStart")) {
|
||||||
|
newLines.push(`${key} = 0`);
|
||||||
|
} else {
|
||||||
|
newLines.push(line);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newLines.push(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.promises.writeFile(osuCfg, newLines.join("\n"), "utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isValidOsuFolder,
|
||||||
|
getUserConfig,
|
||||||
|
getGlobalConfig,
|
||||||
|
getUpdateFiles,
|
||||||
|
getFilesThatNeedUpdate,
|
||||||
|
downloadUpdateFiles,
|
||||||
|
runOsuWithDevServer,
|
||||||
|
getPatcherUpdates,
|
||||||
|
downloadPatcherUpdates,
|
||||||
|
downloadUIFiles,
|
||||||
|
getUIFiles,
|
||||||
|
replaceUIFile,
|
||||||
|
findOsuInstallation,
|
||||||
|
updateOsuConfigHashes,
|
||||||
|
};
|
63
electron/richPresence.js
Normal file
63
electron/richPresence.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
const DiscordRPC = require("discord-auto-rpc");
|
||||||
|
const { appName, appVersion } = require("./appInfo.js");
|
||||||
|
|
||||||
|
const clientId = "1032772293220384808";
|
||||||
|
let richPresence;
|
||||||
|
let intervalId;
|
||||||
|
|
||||||
|
let currentStatus = {
|
||||||
|
details: " ",
|
||||||
|
state: "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", () => {
|
||||||
|
richPresence.setActivity(currentStatus);
|
||||||
|
intervalId = setInterval(() => {
|
||||||
|
richPresence.setActivity(currentStatus);
|
||||||
|
}, 2500);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disconnect: async () => {
|
||||||
|
if (richPresence) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
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}` : " ";
|
||||||
|
},
|
||||||
|
update: () => {
|
||||||
|
if (richPresence) {
|
||||||
|
richPresence.setActivity(currentStatus);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
25
electron/updateCheck.js
Normal file
25
electron/updateCheck.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const semver = require("semver");
|
||||||
|
const { appVersion } = require("./appInfo");
|
||||||
|
|
||||||
|
const repoApiUrl =
|
||||||
|
"https://git.ez-pp.farm/api/v1/repos/EZPPFarm/EZPPLauncher/releases?limit=1";
|
||||||
|
|
||||||
|
const releasesUrl =
|
||||||
|
"https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
updateAvailable: async () => {
|
||||||
|
try {
|
||||||
|
const latestRelease = await fetch(repoApiUrl);
|
||||||
|
const json = await latestRelease.json();
|
||||||
|
if (json.length <= 0) return false;
|
||||||
|
return {
|
||||||
|
update: semver.lt(appVersion, json[0].tag_name),
|
||||||
|
release: json[0],
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
return { update: false };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
releasesUrl,
|
||||||
|
};
|
551
main.js
551
main.js
@@ -1,90 +1,534 @@
|
|||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const { app, BrowserWindow, Menu, ipcMain } = require("electron");
|
const { app, BrowserWindow, Menu, ipcMain, dialog, shell } = require(
|
||||||
|
"electron",
|
||||||
|
);
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const serve = require("electron-serve");
|
const serve = require("electron-serve");
|
||||||
const loadURL = serve({ directory: "public" });
|
const loadURL = serve({ directory: "public" });
|
||||||
const config = require("./src/config/config");
|
const config = require("./electron/config");
|
||||||
const { setupTitlebar, attachTitlebarToWindow } = require(
|
const { setupTitlebar, attachTitlebarToWindow } = require(
|
||||||
"custom-electron-titlebar/main",
|
"custom-electron-titlebar/main",
|
||||||
);
|
);
|
||||||
|
const {
|
||||||
|
isValidOsuFolder,
|
||||||
|
getUpdateFiles,
|
||||||
|
getGlobalConfig,
|
||||||
|
getFilesThatNeedUpdate,
|
||||||
|
downloadUpdateFiles,
|
||||||
|
getUserConfig,
|
||||||
|
runOsuWithDevServer,
|
||||||
|
getPatcherUpdates,
|
||||||
|
downloadPatcherUpdates,
|
||||||
|
getUIFiles,
|
||||||
|
downloadUIFiles,
|
||||||
|
replaceUIFile,
|
||||||
|
findOsuInstallation,
|
||||||
|
updateOsuConfigHashes,
|
||||||
|
} = require("./electron/osuUtil");
|
||||||
|
const { formatBytes } = require("./electron/formattingUtil");
|
||||||
|
const windowName = require("get-window-by-name");
|
||||||
|
const { existsSync } = require("fs");
|
||||||
|
const { runFileDetached } = require("./electron/executeUtil");
|
||||||
|
const richPresence = require("./electron/richPresence");
|
||||||
|
const cryptUtil = require("./electron/cryptoUtil");
|
||||||
|
const { getHwId } = require("./electron/hwidUtil");
|
||||||
|
const { appName, appVersion } = require("./electron/appInfo");
|
||||||
|
const { updateAvailable, releasesUrl } = 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.
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
|
let osuCheckInterval;
|
||||||
|
let userOsuPath;
|
||||||
|
let osuLoaded = false;
|
||||||
|
let patch = false;
|
||||||
|
let lastOsuStatus = "";
|
||||||
|
let lastStatusUpdate;
|
||||||
|
|
||||||
|
let currentUser = undefined;
|
||||||
|
|
||||||
function isDev() {
|
function isDev() {
|
||||||
return !app.isPackaged;
|
return !app.isPackaged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startOsuStatus() {
|
||||||
|
osuCheckInterval = setInterval(async () => {
|
||||||
|
const osuWindowTitle = windowName.getWindowText("osu!.exe");
|
||||||
|
if (osuWindowTitle.length < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const firstInstance = osuWindowTitle[0];
|
||||||
|
if (firstInstance) {
|
||||||
|
if (!osuLoaded) {
|
||||||
|
osuLoaded = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
if (patch) {
|
||||||
|
const patcherExecuteable = path.join(
|
||||||
|
userOsuPath,
|
||||||
|
"EZPPLauncher",
|
||||||
|
"patcher.exe",
|
||||||
|
);
|
||||||
|
if (existsSync(patcherExecuteable)) {
|
||||||
|
runFileDetached(userOsuPath, patcherExecuteable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
const windowTitle = firstInstance.processTitle;
|
||||||
|
lastOsuStatus = windowTitle;
|
||||||
|
const currentStatusRequest = await fetch(
|
||||||
|
"https://api.ez-pp.farm/get_player_status?name=" + currentUser.username,
|
||||||
|
);
|
||||||
|
const currentStatus = await currentStatusRequest.json();
|
||||||
|
|
||||||
|
if (!("player_status" in currentStatus)) return;
|
||||||
|
if (!("status" in currentStatus.player_status)) return;
|
||||||
|
|
||||||
|
let details = "Idle...";
|
||||||
|
let infoText = currentStatus.player_status.status.info_text.length > 0
|
||||||
|
? currentStatus.player_status.status.info_text
|
||||||
|
: " ";
|
||||||
|
|
||||||
|
switch (currentStatus.player_status.status.action) {
|
||||||
|
case 1:
|
||||||
|
details = "AFK...";
|
||||||
|
infoText = " ";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
details = "Playing...";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
details = "Editing...";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
details = "Modding...";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
details = "Multiplayer: Selecting a Beatmap...";
|
||||||
|
infoText = " ";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
details = "Watching...";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
details = "Testing...";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
details = "Submitting...";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
details = "Multiplayer: Idle...";
|
||||||
|
infoText = " ";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
details = "Multiplayer: Playing...";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
details = "Browsing osu!direct...";
|
||||||
|
infoText = " ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
richPresence.updateStatus({
|
||||||
|
details,
|
||||||
|
state: infoText,
|
||||||
|
});
|
||||||
|
|
||||||
|
richPresence.update();
|
||||||
|
}
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopOsuStatus() {
|
||||||
|
clearInterval(osuCheckInterval);
|
||||||
|
}
|
||||||
|
|
||||||
function registerIPCPipes() {
|
function registerIPCPipes() {
|
||||||
ipcMain.handle("ezpplauncher:login", async (e, args) => {
|
ipcMain.handle("ezpplauncher:login", async (e, args) => {
|
||||||
const fetchResult = await fetch("https://ez-pp.farm/login/check", {
|
const hwid = getHwId();
|
||||||
method: "POST",
|
const timeout = new AbortController();
|
||||||
body: JSON.stringify({
|
const timeoutId = setTimeout(() => timeout.abort(), 8000);
|
||||||
username: args.username,
|
try {
|
||||||
password: args.password,
|
const fetchResult = await fetch("https://ez-pp.farm/login/check", {
|
||||||
}),
|
signal: timeout.signal,
|
||||||
headers: {
|
method: "POST",
|
||||||
"Content-Type": "application/json",
|
body: JSON.stringify({
|
||||||
},
|
username: args.username,
|
||||||
});
|
password: args.password,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
if (fetchResult.ok) {
|
clearTimeout(timeoutId);
|
||||||
const result = await fetchResult.json();
|
|
||||||
if ("user" in result) {
|
if (fetchResult.ok) {
|
||||||
if (args.saveCredentials) {
|
const result = await fetchResult.json();
|
||||||
config.set("username", args.username);
|
if ("user" in result) {
|
||||||
config.set("password", args.password);
|
if (args.saveCredentials) {
|
||||||
|
config.set("username", args.username);
|
||||||
|
config.set("password", cryptUtil.encrypt(args.password, hwid));
|
||||||
|
}
|
||||||
|
currentUser = args;
|
||||||
|
config.remove("guest");
|
||||||
}
|
}
|
||||||
config.remove("guest");
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return {
|
||||||
|
code: 500,
|
||||||
|
message: "Something went wrong while logging you in.",
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
return {
|
||||||
|
code: 500,
|
||||||
|
message: "Something went wrong while logging you in.",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
code: 500,
|
|
||||||
message: "Something went wrong while logging you in.",
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:autologin", async (e) => {
|
ipcMain.handle("ezpplauncher:autologin-active", async (e) => {
|
||||||
const username = config.get("username");
|
const username = config.get("username");
|
||||||
const password = config.get("password");
|
const password = config.get("password");
|
||||||
const guest = config.get("guest");
|
const guest = config.get("guest");
|
||||||
|
if (guest != undefined) return true;
|
||||||
|
return username != undefined && password != undefined;
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:autologin", async (e) => {
|
||||||
|
const hwid = getHwId();
|
||||||
|
const username = config.get("username");
|
||||||
|
const guest = config.get("guest");
|
||||||
if (guest) return { code: 200, message: "Login as guest", guest: true };
|
if (guest) return { code: 200, message: "Login as guest", guest: true };
|
||||||
|
if (username == undefined) {
|
||||||
|
return { code: 200, message: "No autologin" };
|
||||||
|
}
|
||||||
|
const password = cryptUtil.decrypt(config.get("password"), hwid);
|
||||||
if (username == undefined || password == undefined) {
|
if (username == undefined || password == undefined) {
|
||||||
return { code: 200, message: "No autologin" };
|
return { code: 200, message: "No autologin" };
|
||||||
}
|
}
|
||||||
const fetchResult = await fetch("https://ez-pp.farm/login/check", {
|
const timeout = new AbortController();
|
||||||
method: "POST",
|
const timeoutId = setTimeout(() => timeout.abort(), 8000);
|
||||||
body: JSON.stringify({
|
try {
|
||||||
username: username,
|
const fetchResult = await fetch("https://ez-pp.farm/login/check", {
|
||||||
password: password,
|
signal: timeout.signal,
|
||||||
}),
|
method: "POST",
|
||||||
headers: {
|
body: JSON.stringify({
|
||||||
"Content-Type": "application/json",
|
username: username,
|
||||||
},
|
password: password,
|
||||||
});
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
if (fetchResult.ok) {
|
clearTimeout(timeoutId);
|
||||||
const result = await fetchResult.json();
|
|
||||||
return result;
|
if (fetchResult.ok) {
|
||||||
|
const result = await fetchResult.json();
|
||||||
|
if ("user" in result) {
|
||||||
|
currentUser = {
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
config.remove("password");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
code: 500,
|
||||||
|
message: "Something went wrong while logging you in.",
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
return {
|
||||||
|
code: 500,
|
||||||
|
message: "Something went wrong while logging you in.",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
code: 500,
|
|
||||||
message: "Something went wrong while logging you in.",
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:guestlogin", (e) => {
|
ipcMain.handle("ezpplauncher:guestlogin", (e) => {
|
||||||
config.remove("username");
|
config.remove("username");
|
||||||
config.remove("password");
|
config.remove("password");
|
||||||
config.set("guest", "1");
|
config.set("guest", "1");
|
||||||
|
currentUser = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:logout", (e) => {
|
ipcMain.handle("ezpplauncher:logout", (e) => {
|
||||||
config.remove("username");
|
config.remove("username");
|
||||||
config.remove("password");
|
config.remove("password");
|
||||||
config.remove("guest");
|
config.remove("guest");
|
||||||
|
currentUser = undefined;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:settings", async (e) => {
|
||||||
|
return config.all();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:setting-update", async (e, args) => {
|
||||||
|
for (const key of Object.keys(args)) {
|
||||||
|
const value = args[key];
|
||||||
|
|
||||||
|
if (key == "presence") {
|
||||||
|
if (!value) richPresence.disconnect();
|
||||||
|
else richPresence.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value == "boolean") {
|
||||||
|
config.set(key, value ? "true" : "false");
|
||||||
|
} else {
|
||||||
|
config.set(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:detect-folder", async (e) => {
|
||||||
|
const detected = await findOsuInstallation();
|
||||||
|
if (detected && await isValidOsuFolder(detected)) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "success",
|
||||||
|
message: "osu! path successfully saved!",
|
||||||
|
});
|
||||||
|
config.set("osuPath", detected);
|
||||||
|
}
|
||||||
|
return config.all();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:set-folder", async (e) => {
|
||||||
|
const folderResult = await dialog.showOpenDialog({
|
||||||
|
title: "Select osu! installation directory",
|
||||||
|
properties: ["openDirectory"],
|
||||||
|
});
|
||||||
|
if (!folderResult.canceled) {
|
||||||
|
const folder = folderResult.filePaths[0];
|
||||||
|
if (await isValidOsuFolder(folder)) {
|
||||||
|
config.set("osuPath", folder);
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "success",
|
||||||
|
message: "osu! path successfully saved!",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message: "invalid osu! path!",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config.all();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:exitAndUpdate", async (e) => {
|
||||||
|
await shell.openExternal(releasesUrl);
|
||||||
|
app.exit();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:launch", async (e) => {
|
||||||
|
const configPatch = config.get("patch");
|
||||||
|
patch = configPatch != undefined ? configPatch == "true" : true;
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Checking osu! directory...",
|
||||||
|
});
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
const osuPath = config.get("osuPath");
|
||||||
|
userOsuPath = osuPath;
|
||||||
|
if (osuPath == undefined) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message: "osu! path not set!",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(await isValidOsuFolder(osuPath))) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message: "invalid osu! path!",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Checking for osu! updates...",
|
||||||
|
});
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
const releaseStream = await getGlobalConfig(osuPath).get("_ReleaseStream");
|
||||||
|
const latestFiles = await getUpdateFiles(releaseStream);
|
||||||
|
const uiFiles = await getUIFiles(osuPath);
|
||||||
|
const updateFiles = await getFilesThatNeedUpdate(osuPath, latestFiles);
|
||||||
|
if (uiFiles.length > 0) {
|
||||||
|
const uiDownloader = downloadUIFiles(osuPath, uiFiles);
|
||||||
|
let errored = false;
|
||||||
|
uiDownloader.eventEmitter.on("error", (data) => {
|
||||||
|
const filename = data.fileName;
|
||||||
|
errored = true;
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message:
|
||||||
|
`Failed to download/replace ${filename}!\nMaybe try to restart EZPPLauncher.`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
uiDownloader.eventEmitter.on("data", (data) => {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: Math.ceil(data.progress),
|
||||||
|
});
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await uiDownloader.startDownload();
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: -1,
|
||||||
|
});
|
||||||
|
if (errored) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateFiles.length > 0) {
|
||||||
|
const updateDownloader = downloadUpdateFiles(osuPath, updateFiles);
|
||||||
|
let errored = false;
|
||||||
|
updateDownloader.eventEmitter.on("error", (data) => {
|
||||||
|
const filename = data.fileName;
|
||||||
|
errored = true;
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message:
|
||||||
|
`Failed to download/replace ${filename}!\nMaybe try to restart EZPPLauncher.`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
updateDownloader.eventEmitter.on("data", (data) => {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: Math.ceil(data.progress),
|
||||||
|
});
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await updateDownloader.startDownload();
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: -1,
|
||||||
|
});
|
||||||
|
if (errored) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "osu! is now up to date!",
|
||||||
|
});
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
} else {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "osu! is up to date!",
|
||||||
|
});
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patch) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Looking for patcher updates...",
|
||||||
|
});
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
const patchFiles = await getPatcherUpdates(osuPath);
|
||||||
|
if (patchFiles.length > 0) {
|
||||||
|
const patcherDownloader = downloadPatcherUpdates(osuPath, patchFiles);
|
||||||
|
let errored = false;
|
||||||
|
patcherDownloader.eventEmitter.on("error", (data) => {
|
||||||
|
const filename = data.fileName;
|
||||||
|
errored = true;
|
||||||
|
mainWindow.webContents.send("ezpplauncher:alert", {
|
||||||
|
type: "error",
|
||||||
|
message:
|
||||||
|
`Failed to download/replace ${filename}!\nMaybe try to restart EZPPLauncher.`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
patcherDownloader.eventEmitter.on("data", (data) => {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: Math.ceil(data.progress),
|
||||||
|
});
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
|
||||||
|
formatBytes(data.total)
|
||||||
|
})...`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await patcherDownloader.startDownload();
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: -1,
|
||||||
|
});
|
||||||
|
if (errored) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Patcher is now up to date!",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Patcher is up to date!",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Preparing launch...",
|
||||||
|
});
|
||||||
|
await updateOsuConfigHashes(osuPath);
|
||||||
|
await replaceUIFile(osuPath, false);
|
||||||
|
|
||||||
|
const userConfig = getUserConfig(osuPath);
|
||||||
|
richPresence.updateVersion(await userConfig.get("LastVersion"));
|
||||||
|
richPresence.update();
|
||||||
|
await userConfig.set("ShowInterfaceDuringRelax", "1");
|
||||||
|
if (currentUser) {
|
||||||
|
await userConfig.set("CredentialEndpoint", "ez-pp.farm");
|
||||||
|
await userConfig.set("SavePassword", "1");
|
||||||
|
await userConfig.set("SaveUsername", "1");
|
||||||
|
await userConfig.set("Username", currentUser.username);
|
||||||
|
await userConfig.set("Password", currentUser.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Launching osu!...",
|
||||||
|
});
|
||||||
|
|
||||||
|
const onExitHook = () => {
|
||||||
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
|
stopOsuStatus();
|
||||||
|
richPresence.updateVersion();
|
||||||
|
richPresence.updateStatus({
|
||||||
|
state: "Idle in Launcher...",
|
||||||
|
details: undefined,
|
||||||
|
});
|
||||||
|
richPresence.update();
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchstatus", {
|
||||||
|
status: "Waiting for cleanup...",
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
await replaceUIFile(osuPath, true);
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchabort");
|
||||||
|
osuLoaded = false;
|
||||||
|
}, 5000);
|
||||||
|
};
|
||||||
|
runOsuWithDevServer(osuPath, "ez-pp.farm", onExitHook);
|
||||||
|
mainWindow.hide();
|
||||||
|
startOsuStatus();
|
||||||
|
|
||||||
|
/* mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: 0,
|
||||||
|
});
|
||||||
|
mainWindow.webContents.send("ezpplauncher:launchprogress", {
|
||||||
|
progress: 100,
|
||||||
|
}); */
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -94,11 +538,12 @@ function createWindow() {
|
|||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 600,
|
width: 550,
|
||||||
height: 380,
|
height: 350,
|
||||||
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"),
|
||||||
@@ -126,6 +571,14 @@ function createWindow() {
|
|||||||
|
|
||||||
registerIPCPipes();
|
registerIPCPipes();
|
||||||
|
|
||||||
|
const presenceEnabled = config.get("presence");
|
||||||
|
if (presenceEnabled == undefined) {
|
||||||
|
richPresence.connect();
|
||||||
|
} else {
|
||||||
|
if (presenceEnabled == "true") {
|
||||||
|
richPresence.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Uncomment the following line of code when app is ready to be packaged.
|
// Uncomment the following line of code when app is ready to be packaged.
|
||||||
// loadURL(mainWindow);
|
// loadURL(mainWindow);
|
||||||
|
|
||||||
@@ -145,8 +598,13 @@ 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 updateInfo = await updateAvailable();
|
||||||
|
if (updateInfo.update) {
|
||||||
|
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
||||||
|
}
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,9 +614,10 @@ function createWindow() {
|
|||||||
app.on("ready", createWindow);
|
app.on("ready", createWindow);
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on("window-all-closed", function () {
|
app.on("window-all-closed", async function () {
|
||||||
// On macOS it is common for applications and their menu bar
|
// On macOS it is common for applications and their menu bar
|
||||||
// to stay active until the user quits explicitly with Cmd + Q
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||||
|
await richPresence.disconnect();
|
||||||
if (process.platform !== "darwin") app.quit();
|
if (process.platform !== "darwin") app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
421
package-lock.json
generated
421
package-lock.json
generated
@@ -7,14 +7,23 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "ezpplauncher-next",
|
"name": "ezpplauncher-next",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/better-sqlite3": "^7.6.8",
|
"@types/better-sqlite3": "^7.6.8",
|
||||||
"axios": "^1.6.5",
|
"axios": "^1.6.5",
|
||||||
"better-sqlite3": "^9.2.2",
|
"better-sqlite3": "^9.2.2",
|
||||||
|
"crypto": "^1.0.1",
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
"custom-electron-titlebar": "^4.2.7",
|
"custom-electron-titlebar": "^4.2.7",
|
||||||
|
"discord-auto-rpc": "^1.0.17",
|
||||||
"electron-serve": "^1.1.0",
|
"electron-serve": "^1.1.0",
|
||||||
"svelte-french-toast": "^1.2.0"
|
"get-window-by-name": "^2.0.0",
|
||||||
|
"regedit-rs": "^1.0.2",
|
||||||
|
"semver": "^7.5.4",
|
||||||
|
"svelte-french-toast": "^1.2.0",
|
||||||
|
"sweetalert2": "^11.10.3",
|
||||||
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron/rebuild": "^3.5.0",
|
"@electron/rebuild": "^3.5.0",
|
||||||
@@ -161,6 +170,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",
|
||||||
@@ -355,21 +372,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",
|
||||||
@@ -1140,21 +1142,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",
|
||||||
@@ -1686,11 +1673,24 @@
|
|||||||
"@types/ms": "*"
|
"@types/ms": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/discord-rpc": {
|
||||||
|
"version": "4.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/discord-rpc/-/discord-rpc-4.0.8.tgz",
|
||||||
|
"integrity": "sha512-1tZf217Natkj+TziNXRRLwNmdm5GNa1bnrQr8VWowquo/Su5hMjdhobj8URxW1COMk2da28XCU1ahsYCAlxirA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/events": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
||||||
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
|
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/events": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g=="
|
||||||
|
},
|
||||||
"node_modules/@types/fs-extra": {
|
"node_modules/@types/fs-extra": {
|
||||||
"version": "9.0.13",
|
"version": "9.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
|
||||||
@@ -2024,21 +2024,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",
|
||||||
@@ -3049,6 +3034,17 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/crypto": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
|
||||||
|
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in."
|
||||||
|
},
|
||||||
|
"node_modules/crypto-js": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||||
|
},
|
||||||
"node_modules/css-declaration-sorter": {
|
"node_modules/css-declaration-sorter": {
|
||||||
"version": "6.4.1",
|
"version": "6.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz",
|
||||||
@@ -3444,6 +3440,27 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/discord-auto-rpc": {
|
||||||
|
"version": "1.0.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/discord-auto-rpc/-/discord-auto-rpc-1.0.17.tgz",
|
||||||
|
"integrity": "sha512-ZTK8azvfapMmwjxLAowHuOSglAens7UtBuQnL8b4VDmqzPM0K8ze1A/uPViWkJ8ROEOjZeHoK3zu0jwsQKGavQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/discord-rpc": "^4.0.2",
|
||||||
|
"discord-rpc": "^3.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/discord-rpc": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/discord-rpc/-/discord-rpc-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-KJv0EVbGMlr04HoG6f5b3wD7X9kSHzQ2Ed2qfHSDvYJ1MkE8RbCQmMcQQrSvAxpfsqZgUjB/bsfi/mjyicCH+A==",
|
||||||
|
"dependencies": {
|
||||||
|
"node-fetch": "^2.6.1",
|
||||||
|
"ws": "^7.3.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"register-scheme": "github:devsnek/node-register-scheme"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/dlv": {
|
"node_modules/dlv": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
||||||
@@ -3782,7 +3799,6 @@
|
|||||||
"version": "0.1.13",
|
"version": "0.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
|
||||||
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
|
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"iconv-lite": "^0.6.2"
|
"iconv-lite": "^0.6.2"
|
||||||
@@ -4291,6 +4307,78 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-window-by-name": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-window-by-name/-/get-window-by-name-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-VXszlUFwkmWAZzxEERRJisiVvGMeB+Zjl5I9f0mwJjhfLTOkD5n5OR9Z518XBZemKLRzIs91TlfKbPmZywS84Q==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.2.1",
|
||||||
|
"cross-spawn": "^6.0.5",
|
||||||
|
"nan": "^2.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/cross-spawn": {
|
||||||
|
"version": "6.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||||
|
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"nice-try": "^1.0.4",
|
||||||
|
"path-key": "^2.0.1",
|
||||||
|
"semver": "^5.5.0",
|
||||||
|
"shebang-command": "^1.2.0",
|
||||||
|
"which": "^1.2.9"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/path-key": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/semver": {
|
||||||
|
"version": "5.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
|
||||||
|
"integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/shebang-command": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
|
||||||
|
"dependencies": {
|
||||||
|
"shebang-regex": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/shebang-regex": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-window-by-name/node_modules/which": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"which": "bin/which"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/github-from-package": {
|
"node_modules/github-from-package": {
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||||
@@ -4365,21 +4453,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",
|
||||||
@@ -4605,7 +4678,7 @@
|
|||||||
"version": "0.6.3",
|
"version": "0.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||||
"dev": true,
|
"devOptional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
},
|
},
|
||||||
@@ -4905,8 +4978,7 @@
|
|||||||
"node_modules/isexe": {
|
"node_modules/isexe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/jackspeak": {
|
"node_modules/jackspeak": {
|
||||||
"version": "2.3.6",
|
"version": "2.3.6",
|
||||||
@@ -5553,6 +5625,11 @@
|
|||||||
"thenify-all": "^1.0.0"
|
"thenify-all": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nan": {
|
||||||
|
"version": "2.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
|
||||||
|
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
|
||||||
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.7",
|
"version": "3.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
||||||
@@ -5585,6 +5662,11 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nice-try": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
||||||
|
},
|
||||||
"node_modules/node-abi": {
|
"node_modules/node-abi": {
|
||||||
"version": "3.54.0",
|
"version": "3.54.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz",
|
||||||
@@ -5596,26 +5678,10 @@
|
|||||||
"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",
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"node_modules/node-api-version": {
|
"node_modules/node-api-version": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
@@ -5626,19 +5692,23 @@
|
|||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-api-version/node_modules/semver": {
|
"node_modules/node-fetch": {
|
||||||
"version": "7.5.4",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": "4.x || >=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"encoding": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"encoding": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-gyp": {
|
"node_modules/node-gyp": {
|
||||||
@@ -5701,21 +5771,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",
|
||||||
@@ -6904,12 +6959,81 @@
|
|||||||
"node": ">=8.10.0"
|
"node": ">=8.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/regedit-rs": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/regedit-rs/-/regedit-rs-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-4vEgiZNO1FCG8z/Zx3v/6PU1+eZ+ELe6R0ca+VB96Vw+Mi3M0IVHAjtMFbl97lUSX11dJqpyousX/wY8QcI1lA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"regedit-rs-win32-arm64-msvc": "1.0.2",
|
||||||
|
"regedit-rs-win32-ia32-msvc": "1.0.2",
|
||||||
|
"regedit-rs-win32-x64-msvc": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/regedit-rs-win32-arm64-msvc": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/regedit-rs-win32-arm64-msvc/-/regedit-rs-win32-arm64-msvc-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-hM1sxazOJWKmiC9DM8QXW9Iqm50Mh/Y9G4/rRYQpWXjMzq7lTqjwVZRkAoBrHliFS6d1Lt4qkm5+Ybt6GkbDpw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/regedit-rs-win32-ia32-msvc": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/regedit-rs-win32-ia32-msvc/-/regedit-rs-win32-ia32-msvc-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-FLINrCJ30wm6NYw7skQUDET8NP1N46kH77dqesCiU+/FjWzzPE5luZYY+j4uf+hKjPY6/MCj2CB9l9VdPhaBVQ==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/regedit-rs-win32-x64-msvc": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/regedit-rs-win32-x64-msvc/-/regedit-rs-win32-x64-msvc-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-ccCSyd5vWBKVWftBKLKzegqwwPMWcQtIW0ub66dCFFuv2s+x2EcZZWGdD9dVXX2Z6V9DU2JRPKgWUNjVPaj6Xg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/regenerator-runtime": {
|
"node_modules/regenerator-runtime": {
|
||||||
"version": "0.14.1",
|
"version": "0.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
||||||
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
|
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/register-scheme": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "git+ssh://git@github.com/devsnek/node-register-scheme.git#e7cc9a63a1f512565da44cb57316d9fb10750e17",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.3.0",
|
||||||
|
"node-addon-api": "^1.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/require-directory": {
|
"node_modules/require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
@@ -7455,7 +7579,7 @@
|
|||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||||
"dev": true
|
"devOptional": true
|
||||||
},
|
},
|
||||||
"node_modules/sander": {
|
"node_modules/sander": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
@@ -7494,11 +7618,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": {
|
||||||
@@ -7634,21 +7764,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",
|
||||||
@@ -8370,6 +8485,40 @@
|
|||||||
"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": {
|
||||||
|
"version": "5.21.22",
|
||||||
|
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.22.tgz",
|
||||||
|
"integrity": "sha512-gNHloAJSyS+sKWkwvmvozZ1eHrdVTEsynWMTY6lvLGBB70gflkBQFw8drXXr1oEXY84+Vr9tOOrN8xHZLJSycA==",
|
||||||
|
"os": [
|
||||||
|
"darwin",
|
||||||
|
"linux",
|
||||||
|
"win32",
|
||||||
|
"freebsd",
|
||||||
|
"openbsd",
|
||||||
|
"netbsd",
|
||||||
|
"sunos",
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"systeminformation": "lib/cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "Buy me a coffee",
|
||||||
|
"url": "https://www.buymeacoffee.com/systeminfo"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tailwind-merge": {
|
"node_modules/tailwind-merge": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.2.0.tgz",
|
||||||
@@ -8721,6 +8870,11 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tr46": {
|
||||||
|
"version": "0.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||||
|
},
|
||||||
"node_modules/tree-kill": {
|
"node_modules/tree-kill": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
|
||||||
@@ -8987,6 +9141,20 @@
|
|||||||
"defaults": "^1.0.3"
|
"defaults": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webidl-conversions": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||||
|
},
|
||||||
|
"node_modules/whatwg-url": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||||
|
"dependencies": {
|
||||||
|
"tr46": "~0.0.3",
|
||||||
|
"webidl-conversions": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/which": {
|
"node_modules/which": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
@@ -9055,7 +9223,6 @@
|
|||||||
"version": "7.5.9",
|
"version": "7.5.9",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
||||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.3.0"
|
"node": ">=8.3.0"
|
||||||
},
|
},
|
||||||
|
17
package.json
17
package.json
@@ -12,7 +12,9 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"public/**/*",
|
"public/**/*",
|
||||||
"main.js",
|
"main.js",
|
||||||
"preload.js"
|
"preload.js",
|
||||||
|
"electron/*",
|
||||||
|
"electron/**/*"
|
||||||
],
|
],
|
||||||
"win": {
|
"win": {
|
||||||
"target": [
|
"target": [
|
||||||
@@ -29,17 +31,26 @@
|
|||||||
"start": "sirv public --no-clear",
|
"start": "sirv public --no-clear",
|
||||||
"electron": "wait-on http://localhost:8080 && electron .",
|
"electron": "wait-on http://localhost:8080 && electron .",
|
||||||
"electron-dev": "concurrently \"yarn run dev\" \"yarn run electron\"",
|
"electron-dev": "concurrently \"yarn run dev\" \"yarn run electron\"",
|
||||||
"preelectron-pack": "yarn run build",
|
"preelectron-pack": "electron-rebuild && yarn run build",
|
||||||
"electron-pack": "electron-builder",
|
"electron-pack": "electron-builder",
|
||||||
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/better-sqlite3": "^7.6.8",
|
"@types/better-sqlite3": "^7.6.8",
|
||||||
"axios": "^1.6.5",
|
"axios": "^1.6.5",
|
||||||
"better-sqlite3": "^9.2.2",
|
"better-sqlite3": "^9.2.2",
|
||||||
|
"crypto": "^1.0.1",
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
"custom-electron-titlebar": "^4.2.7",
|
"custom-electron-titlebar": "^4.2.7",
|
||||||
|
"discord-auto-rpc": "^1.0.17",
|
||||||
"electron-serve": "^1.1.0",
|
"electron-serve": "^1.1.0",
|
||||||
"svelte-french-toast": "^1.2.0"
|
"get-window-by-name": "^2.0.0",
|
||||||
|
"regedit-rs": "^1.0.2",
|
||||||
|
"semver": "^7.5.4",
|
||||||
|
"svelte-french-toast": "^1.2.0",
|
||||||
|
"sweetalert2": "^11.10.3",
|
||||||
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron/rebuild": "^3.5.0",
|
"@electron/rebuild": "^3.5.0",
|
||||||
|
85
preload.js
85
preload.js
@@ -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) => {
|
||||||
@@ -22,17 +24,94 @@ window.addEventListener("login-attempt", async (e) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("autologin-attempt", async (e) => {
|
window.addEventListener("autologin-active", async (e) => {
|
||||||
|
const autologin = await ipcRenderer.invoke(
|
||||||
|
"ezpplauncher:autologin-active",
|
||||||
|
);
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("autologin-result", { detail: autologin }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("autologin-attempt", async () => {
|
||||||
const loginResult = await ipcRenderer.invoke("ezpplauncher:autologin");
|
const loginResult = await ipcRenderer.invoke("ezpplauncher:autologin");
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new CustomEvent("login-result", { detail: loginResult }),
|
new CustomEvent("login-result", { detail: loginResult }),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("logout", async (e) => {
|
window.addEventListener("logout", async () => {
|
||||||
await ipcRenderer.invoke("ezpplauncher:logout");
|
await ipcRenderer.invoke("ezpplauncher:logout");
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("guest-login", async (e) => {
|
window.addEventListener("guest-login", async () => {
|
||||||
await ipcRenderer.invoke("ezpplauncher:guestlogin");
|
await ipcRenderer.invoke("ezpplauncher:guestlogin");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("launch", async (e) => {
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:launch", e.detail);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("settings-get", async () => {
|
||||||
|
const settings = await ipcRenderer.invoke("ezpplauncher:settings");
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("settings-result", { detail: settings }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("setting-update", async (e) => {
|
||||||
|
const detail = e.detail;
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:setting-update", detail);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("folder-auto", async (e) => {
|
||||||
|
const result = await ipcRenderer.invoke("ezpplauncher:detect-folder");
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("settings-result", { detail: result }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("folder-set", async (e) => {
|
||||||
|
const result = await ipcRenderer.invoke("ezpplauncher:set-folder");
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("settings-result", { detail: result }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("settings-set", async (e) => {
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("updateExit", async () => {
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:exitAndUpdate");
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:launchabort", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("launch-abort"),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:alert", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("alert", { detail: args }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:launchstatus", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("launchStatusUpdate", { detail: args }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:launchprogress", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("launchProgressUpdate", { detail: args }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.addListener("ezpplauncher:update", (e, args) => {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("update", { detail: args }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
@@ -18,5 +18,5 @@
|
|||||||
<script defer src="/build/bundle.js"></script>
|
<script defer src="/build/bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="select-none bg-gray-100 dark:bg-gray-900"></body>
|
<body class="select-none bg-gray-100 dark:bg-gray-900 overflow-hidden"></body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -9,7 +9,6 @@ import image from "@rollup/plugin-image";
|
|||||||
import sveltePreprocess from "svelte-preprocess";
|
import sveltePreprocess from "svelte-preprocess";
|
||||||
import typescript from "@rollup/plugin-typescript";
|
import typescript from "@rollup/plugin-typescript";
|
||||||
import progress from "rollup-plugin-progress";
|
import progress from "rollup-plugin-progress";
|
||||||
import findUnused from "rollup-plugin-unused";
|
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH;
|
const production = !process.env.ROLLUP_WATCH;
|
||||||
|
|
||||||
@@ -48,8 +47,7 @@ export default {
|
|||||||
file: "public/build/bundle.js",
|
file: "public/build/bundle.js",
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
findUnused(),
|
!production && progress({ clearLine: true }),
|
||||||
progress({ clearLine: true }),
|
|
||||||
svelte({
|
svelte({
|
||||||
preprocess: sveltePreprocess({ sourceMap: !production }),
|
preprocess: sveltePreprocess({ sourceMap: !production }),
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
@@ -61,7 +59,7 @@ export default {
|
|||||||
// we'll extract any component CSS out into
|
// we'll extract any component CSS out into
|
||||||
// a separate file - better for performance
|
// a separate file - better for performance
|
||||||
css({ output: "bundle.css" }),
|
css({ output: "bundle.css" }),
|
||||||
postcss(),
|
postcss({ sourceMap: "inline" }),
|
||||||
|
|
||||||
// If you have external dependencies installed from
|
// If you have external dependencies installed from
|
||||||
// npm, you'll most likely need these plugins. In
|
// npm, you'll most likely need these plugins. In
|
||||||
|
251
src/App.svelte
251
src/App.svelte
@@ -4,30 +4,38 @@
|
|||||||
Dropdown,
|
Dropdown,
|
||||||
DropdownItem,
|
DropdownItem,
|
||||||
DropdownHeader,
|
DropdownHeader,
|
||||||
DropdownDivider
|
DropdownDivider,
|
||||||
|
Button,
|
||||||
|
Indicator,
|
||||||
} from "flowbite-svelte";
|
} from "flowbite-svelte";
|
||||||
import {
|
import {
|
||||||
|
ArrowLeftSolid,
|
||||||
ArrowRightFromBracketSolid,
|
ArrowRightFromBracketSolid,
|
||||||
ArrowRightToBracketSolid,
|
ArrowRightToBracketSolid,
|
||||||
UserSettingsSolid
|
HeartSolid,
|
||||||
|
UserSettingsSolid,
|
||||||
} from "flowbite-svelte-icons";
|
} from "flowbite-svelte-icons";
|
||||||
import ezppLogo from "../public/favicon.png";
|
import ezppLogo from "../public/favicon.png";
|
||||||
import {
|
import {
|
||||||
currentPage,
|
currentPage,
|
||||||
currentUser,
|
currentUser,
|
||||||
launching,
|
launching,
|
||||||
launchStatus
|
launchPercentage,
|
||||||
|
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";
|
||||||
import Launch from "./pages/Launch.svelte";
|
import Launch from "./pages/Launch.svelte";
|
||||||
import { Toaster } from "svelte-french-toast";
|
import toast, { Toaster } from "svelte-french-toast";
|
||||||
import type { User } from "./types/user";
|
import type { User } from "./types/user";
|
||||||
import Settings from "./pages/Settings.svelte";
|
import Settings from "./pages/Settings.svelte";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
|
||||||
let user: User | undefined = undefined;
|
let user: User | undefined = undefined;
|
||||||
let loggedIn = false;
|
let loggedIn = false;
|
||||||
|
|
||||||
|
let updateInfo: Record<string, unknown>;
|
||||||
|
|
||||||
currentUser.subscribe((newUser) => {
|
currentUser.subscribe((newUser) => {
|
||||||
loggedIn = newUser != undefined;
|
loggedIn = newUser != undefined;
|
||||||
user = newUser;
|
user = newUser;
|
||||||
@@ -37,93 +45,178 @@
|
|||||||
window.dispatchEvent(new CustomEvent("logout"));
|
window.dispatchEvent(new CustomEvent("logout"));
|
||||||
currentUser.set(undefined);
|
currentUser.set(undefined);
|
||||||
currentPage.set(Page.Login);
|
currentPage.set(Page.Login);
|
||||||
|
toast.success("Successfully logged out!", {
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.addEventListener("update", async (e) => {
|
||||||
|
const update = (e as CustomEvent).detail;
|
||||||
|
await Swal.fire({
|
||||||
|
html: `EZPPLauncher ${update.tag_name} is now available!<br>Click the Button bellow to download the latest release!`,
|
||||||
|
title: "It's your lucky day!",
|
||||||
|
allowOutsideClick: false,
|
||||||
|
allowEscapeKey: false,
|
||||||
|
allowEnterKey: false,
|
||||||
|
confirmButtonText: "Thanks!",
|
||||||
|
});
|
||||||
|
window.dispatchEvent(new CustomEvent("updateExit"));
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener("launchStatusUpdate", (e) => {
|
window.addEventListener("launchStatusUpdate", (e) => {
|
||||||
const status = (e as CustomEvent).detail;
|
const status = (e as CustomEvent).detail.status;
|
||||||
launchStatus.set(status);
|
launchStatus.set(status);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("launchProgressUpdate", (e) => {
|
||||||
|
const progress = (e as CustomEvent).detail.progress;
|
||||||
|
launchPercentage.set(progress);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("launch-abort", () => {
|
||||||
|
launchPercentage.set(-1);
|
||||||
|
launchStatus.set("");
|
||||||
|
launching.set(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("alert", (e) => {
|
||||||
|
console.log((e as CustomEvent).detail);
|
||||||
|
const toastMessage = (e as CustomEvent).detail;
|
||||||
|
switch (toastMessage.type) {
|
||||||
|
case "success": {
|
||||||
|
toast.success(toastMessage.message, {
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "error": {
|
||||||
|
toast.error(toastMessage.message, {
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 4000,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
toast(toastMessage.message, {
|
||||||
|
icon: "ℹ",
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 1500,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Toaster></Toaster>
|
<Toaster></Toaster>
|
||||||
|
|
||||||
<div class="p-2 flex flex-row justify-between items-center">
|
{#if !updateInfo}
|
||||||
<div class="flex flex-row items-center">
|
<div class="p-2 flex flex-row justify-between items-center">
|
||||||
<img src={ezppLogo} alt="EZPPFarm Logo" class="w-12 h-12 mr-2" />
|
<div class="flex flex-row items-center animate-fadeIn opacity-0">
|
||||||
<span class="text-gray-700 dark:text-gray-100 text-xl font-extralight">
|
{#if $currentPage == Page.Settings}
|
||||||
EZPPLauncher
|
<Button
|
||||||
</span>
|
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"
|
||||||
</div>
|
color="light"
|
||||||
{#if $currentPage == Page.Launch}
|
|
||||||
<div class="flex flex-row gap-2 w-fill cursor-pointer md:order-2">
|
|
||||||
<Avatar
|
|
||||||
class="rounded-lg border dark:border-gray-700 hover:ring-4 hover:ring-gray-200 dark:hover:ring-gray-800"
|
|
||||||
src={loggedIn
|
|
||||||
? "https://a.ez-pp.farm/" + user?.id
|
|
||||||
: "https://a.ez-pp.farm/0"}
|
|
||||||
id="avatar-menu"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<Dropdown placement="bottom-start" triggeredBy="#avatar-menu">
|
|
||||||
<DropdownHeader>
|
|
||||||
<span class="block text-sm">{loggedIn ? user?.name : "Guest"}</span>
|
|
||||||
<span
|
|
||||||
class="block truncate text-sm font-medium text-gray-500 dark:text-gray-200"
|
|
||||||
>
|
|
||||||
{loggedIn ? user?.email : "Please log in!"}
|
|
||||||
</span>
|
|
||||||
</DropdownHeader>
|
|
||||||
<DropdownItem
|
|
||||||
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
|
||||||
on:click={() => {
|
|
||||||
if (!$launching) currentPage.set(Page.Settings);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<UserSettingsSolid class="select-none outline-none border-none" />
|
|
||||||
Settings
|
|
||||||
</DropdownItem>
|
|
||||||
<DropdownDivider />
|
|
||||||
{#if loggedIn}
|
|
||||||
<DropdownItem
|
|
||||||
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!$launching) logout();
|
currentPage.set(Page.Launch);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowRightFromBracketSolid
|
<ArrowLeftSolid class="outline-none border-none" size="sm" />
|
||||||
class="select-none outline-none border-none"
|
</Button>
|
||||||
/>
|
|
||||||
Sign out
|
|
||||||
</DropdownItem>
|
|
||||||
{:else}
|
|
||||||
<DropdownItem
|
|
||||||
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
|
||||||
on:click={() => {
|
|
||||||
if (!$launching) currentPage.set(Page.Login);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ArrowRightToBracketSolid
|
|
||||||
class="select-none outline-none border-none"
|
|
||||||
/>
|
|
||||||
Login
|
|
||||||
</DropdownItem>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Dropdown>
|
<img src={ezppLogo} alt="EZPPFarm Logo" class="w-12 h-12 mr-2" />
|
||||||
|
<span class="text-gray-700 dark:text-gray-100 text-xl font-extralight">
|
||||||
|
EZPPLauncher
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{#if $currentPage == Page.Launch}
|
||||||
|
<div
|
||||||
|
class="flex flex-row gap-2 w-fill cursor-pointer md:order-2 animate-lsideIn opacity-0"
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
class="rounded-lg border dark:border-gray-700 hover:ring-4 hover:ring-gray-200 dark:hover:ring-gray-800"
|
||||||
|
src={loggedIn
|
||||||
|
? "https://a.ez-pp.farm/" + user?.id
|
||||||
|
: "https://a.ez-pp.farm/0"}
|
||||||
|
id="avatar-menu"
|
||||||
|
/>
|
||||||
|
<!-- TODO: if user has donator, display heart indicator-->
|
||||||
|
{#if $currentUser && $currentUser.donor}
|
||||||
|
<Indicator
|
||||||
|
class="pointer-events-none"
|
||||||
|
color="red"
|
||||||
|
border
|
||||||
|
size="xl"
|
||||||
|
placement="top-right"
|
||||||
|
>
|
||||||
|
<span class="text-red-300 text-xs font-bold">
|
||||||
|
<HeartSolid class="select-none pointer-events-none" size="xs" />
|
||||||
|
</span>
|
||||||
|
</Indicator>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<Dropdown placement="bottom-start" triggeredBy="#avatar-menu">
|
||||||
|
<DropdownHeader>
|
||||||
|
<span class="block text-sm">{loggedIn ? user?.name : "Guest"}</span>
|
||||||
|
<span
|
||||||
|
class="block truncate text-sm font-medium text-gray-500 dark:text-gray-200"
|
||||||
|
>
|
||||||
|
{loggedIn ? user?.email : "Please log in!"}
|
||||||
|
</span>
|
||||||
|
</DropdownHeader>
|
||||||
|
<DropdownItem
|
||||||
|
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
||||||
|
on:click={() => {
|
||||||
|
if (!$launching) currentPage.set(Page.Settings);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<UserSettingsSolid class="select-none outline-none border-none" />
|
||||||
|
Settings
|
||||||
|
</DropdownItem>
|
||||||
|
<DropdownDivider />
|
||||||
|
{#if loggedIn}
|
||||||
|
<DropdownItem
|
||||||
|
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
||||||
|
on:click={() => {
|
||||||
|
if (!$launching) logout();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowRightFromBracketSolid
|
||||||
|
class="select-none outline-none border-none"
|
||||||
|
/>
|
||||||
|
Sign out
|
||||||
|
</DropdownItem>
|
||||||
|
{:else}
|
||||||
|
<DropdownItem
|
||||||
|
class="flex flex-row gap-2 border-0 dark:!bg-gray-700 dark:active:!bg-gray-900 dark:hover:!bg-gray-800 transition-colors"
|
||||||
|
on:click={() => {
|
||||||
|
if (!$launching) currentPage.set(Page.Login);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowRightToBracketSolid
|
||||||
|
class="select-none outline-none border-none"
|
||||||
|
/>
|
||||||
|
Login
|
||||||
|
</DropdownItem>
|
||||||
|
{/if}
|
||||||
|
</Dropdown>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if $currentPage == Page.Login}
|
||||||
|
<Login />
|
||||||
|
{:else if $currentPage == Page.Settings}
|
||||||
|
<Settings />
|
||||||
|
{:else}
|
||||||
|
<Launch />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if $currentPage == Page.Login}
|
|
||||||
<Login />
|
|
||||||
{:else if $currentPage == Page.Settings}
|
|
||||||
<Settings />
|
|
||||||
{:else}
|
|
||||||
<Launch />
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
text-align: center;
|
|
||||||
padding: 1em;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
24
src/app.pcss
24
src/app.pcss
@@ -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 {
|
||||||
@@ -20,6 +22,10 @@ html .cet-titlebar .cet-control-icon svg {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cet-container {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
.indeterminate {
|
.indeterminate {
|
||||||
background-image: repeating-linear-gradient(
|
background-image: repeating-linear-gradient(
|
||||||
90deg,
|
90deg,
|
||||||
@@ -52,6 +58,24 @@ html .cet-titlebar .cet-control-icon svg {
|
|||||||
background-color: #202020 !important;
|
background-color: #202020 !important;
|
||||||
color: #ececec !important;
|
color: #ececec !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.swal2-container {
|
||||||
|
background: #202020 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swal2-container .swal2-popup {
|
||||||
|
background: #323232 !important;
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animatedProgress div {
|
||||||
|
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 {
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
import { cubicOut } from "svelte/easing";
|
import { cubicOut } from "svelte/easing";
|
||||||
import { tweened } from "svelte/motion";
|
import { tweened } from "svelte/motion";
|
||||||
import { twMerge, twJoin } from "tailwind-merge";
|
import { twMerge, twJoin } from "tailwind-merge";
|
||||||
|
import { clamp } from "../util/mathUtil";
|
||||||
|
|
||||||
export let progress: string | number | undefined | null = "45";
|
export let progress: number = 45;
|
||||||
export let precision = 0;
|
export let precision = 2;
|
||||||
export let tweenDuration = 400;
|
export let tweenDuration = 400;
|
||||||
export let animate = false;
|
export let animate = false;
|
||||||
export let size = "h-2.5";
|
export let size = "h-2.5";
|
||||||
@@ -12,10 +13,10 @@
|
|||||||
export let labelOutside = "";
|
export let labelOutside = "";
|
||||||
export let easing = cubicOut;
|
export let easing = cubicOut;
|
||||||
export let color = "primary";
|
export let color = "primary";
|
||||||
|
export let indeterminate = false;
|
||||||
export let labelInsideClass =
|
export let labelInsideClass =
|
||||||
"text-primary-100 text-xs font-medium text-center p-0.5 leading-none rounded-full";
|
"text-primary-100 text-xs font-medium text-center p-0.5 leading-none rounded-full";
|
||||||
export let divClass = "w-full bg-gray-200 rounded-full dark:bg-gray-700";
|
export let divClass = "w-full bg-gray-200 rounded-full dark:bg-gray-700";
|
||||||
export let indeterminate = progress == null;
|
|
||||||
|
|
||||||
const barColors: Record<string, string> = {
|
const barColors: Record<string, string> = {
|
||||||
primary: "bg-primary-600",
|
primary: "bg-primary-600",
|
||||||
@@ -28,15 +29,14 @@
|
|||||||
indigo: "bg-indigo-600 dark:bg-indigo-500",
|
indigo: "bg-indigo-600 dark:bg-indigo-500",
|
||||||
};
|
};
|
||||||
|
|
||||||
const _progress = tweened(0, {
|
let _progress = tweened(0, {
|
||||||
duration: animate && !indeterminate ? tweenDuration : 0,
|
duration: tweenDuration,
|
||||||
easing,
|
easing,
|
||||||
});
|
});
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (!indeterminate) {
|
progress = clamp(Number(progress), 0, 100);
|
||||||
_progress.set(Number(progress));
|
_progress.set(progress);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -49,7 +49,9 @@
|
|||||||
>{labelOutside}</span
|
>{labelOutside}</span
|
||||||
>
|
>
|
||||||
<span class="text-sm font-medium text-blue-700 dark:text-white"
|
<span class="text-sm font-medium text-blue-700 dark:text-white"
|
||||||
>{progress}%</span
|
>{animate
|
||||||
|
? $_progress.toFixed(precision)
|
||||||
|
: progress.toFixed(precision)}%</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -59,9 +61,9 @@
|
|||||||
{#if !indeterminate}
|
{#if !indeterminate}
|
||||||
<div
|
<div
|
||||||
class={twJoin(labelInsideClass, barColors[color])}
|
class={twJoin(labelInsideClass, barColors[color])}
|
||||||
style="width: {$_progress}%"
|
style="width: {animate ? $_progress : progress}%"
|
||||||
>
|
>
|
||||||
{$_progress.toFixed(precision)}%
|
{animate ? $_progress.toFixed(precision) : progress.toFixed(precision)}%
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
@@ -75,7 +77,7 @@
|
|||||||
{:else if !indeterminate}
|
{:else if !indeterminate}
|
||||||
<div
|
<div
|
||||||
class={twJoin(barColors[color], size, "rounded-full")}
|
class={twJoin(barColors[color], size, "rounded-full")}
|
||||||
style="width: {$_progress}%"
|
style="width: {animate ? $_progress : progress}%"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, Checkbox } from "flowbite-svelte";
|
import { Button, Checkbox } from "flowbite-svelte";
|
||||||
import Progressbar from "../lib/Progressbar.svelte";
|
import Progressbar from "../lib/Progressbar.svelte";
|
||||||
import { launching, patch, launchStatus } from "./../storage/localStore";
|
import {
|
||||||
|
launching,
|
||||||
|
patch,
|
||||||
|
launchStatus,
|
||||||
|
launchPercentage,
|
||||||
|
} from "./../storage/localStore";
|
||||||
let progressbarFix = true;
|
let progressbarFix = true;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -10,7 +15,9 @@
|
|||||||
|
|
||||||
const launch = () => {
|
const launch = () => {
|
||||||
launching.set(true);
|
launching.set(true);
|
||||||
}
|
const patching = $patch;
|
||||||
|
window.dispatchEvent(new CustomEvent("launch", { detail: { patch: patching } }));;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
@@ -26,12 +33,7 @@
|
|||||||
? ''
|
? ''
|
||||||
: 'active:scale-95 '}transition-transform duration-75"
|
: 'active:scale-95 '}transition-transform duration-75"
|
||||||
disabled={$launching}
|
disabled={$launching}
|
||||||
on:click={() => launching.set(!$launching)}>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
|
||||||
@@ -40,10 +42,12 @@
|
|||||||
>
|
>
|
||||||
<Progressbar
|
<Progressbar
|
||||||
animate={true}
|
animate={true}
|
||||||
progress={null}
|
progress={$launchPercentage}
|
||||||
|
indeterminate={$launchPercentage == -1}
|
||||||
labelInside={true}
|
labelInside={true}
|
||||||
size="h-3"
|
size="h-3"
|
||||||
labelInsideClass="bg-primary-600 drop-shadow-xl text-gray-100 text-base font-medium text-center p-1 leading-none rounded-full"
|
class=""
|
||||||
|
labelInsideClass="bg-primary-600 drop-shadow-xl text-gray-100 text-base font-medium text-center p-1 leading-none rounded-full !text-[0.7rem] !leading-[0.45]"
|
||||||
/>
|
/>
|
||||||
<p class="m-0 p-0 dark:text-gray-400 font-light">{$launchStatus}</p>
|
<p class="m-0 p-0 dark:text-gray-400 font-light">{$launchStatus}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -15,81 +15,118 @@
|
|||||||
|
|
||||||
const processLogin = async () => {
|
const processLogin = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
window.addEventListener(
|
const loginPromise = new Promise<void>((res, rej) => {
|
||||||
"login-result",
|
window.addEventListener(
|
||||||
(e) => {
|
"login-result",
|
||||||
const customEvent = e as CustomEvent;
|
(e) => {
|
||||||
const resultData = customEvent.detail;
|
const customEvent = e as CustomEvent;
|
||||||
const wasSuccessful = "user" in resultData;
|
const resultData = customEvent.detail;
|
||||||
|
const wasSuccessful = "user" in resultData;
|
||||||
|
|
||||||
if (!wasSuccessful) {
|
if (!wasSuccessful) {
|
||||||
const errorResult = resultData as Error;
|
/* const errorResult = resultData as Error;
|
||||||
toast.error(errorResult.message, {
|
toast.error(errorResult.message, {
|
||||||
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,
|
||||||
});
|
}); */
|
||||||
loading = false;
|
rej();
|
||||||
return;
|
loading = false;
|
||||||
}
|
return;
|
||||||
const userResult = resultData.user as User;
|
}
|
||||||
currentUser.set(userResult);
|
const userResult = resultData.user as User;
|
||||||
currentPage.set(Page.Launch);
|
currentUser.set(userResult);
|
||||||
toast.success(`Welcome back, ${userResult.name}!`, {
|
|
||||||
position: "bottom-center",
|
|
||||||
className:
|
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
|
||||||
duration: 3000,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
{ once: true }
|
|
||||||
);
|
|
||||||
window.dispatchEvent(
|
|
||||||
new CustomEvent("login-attempt", {
|
|
||||||
detail: { username, password, saveCredentials },
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const tryAutoLogin = async () => {
|
|
||||||
loading = true;
|
|
||||||
await new Promise((res) => setTimeout(res, 1500));
|
|
||||||
window.addEventListener(
|
|
||||||
"login-result",
|
|
||||||
(e) => {
|
|
||||||
const customEvent = e as CustomEvent;
|
|
||||||
const resultData = customEvent.detail;
|
|
||||||
const isGuest = "guest" in resultData;
|
|
||||||
const wasSuccessful = "user" in resultData;
|
|
||||||
if (isGuest) {
|
|
||||||
currentPage.set(Page.Launch);
|
currentPage.set(Page.Launch);
|
||||||
toast.success(`Logged in as Guest`, {
|
res();
|
||||||
|
toast.success(`Welcome back, ${userResult.name}!`, {
|
||||||
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: 3000,
|
duration: 3000,
|
||||||
});
|
});
|
||||||
return;
|
},
|
||||||
}
|
{ once: true }
|
||||||
if (!wasSuccessful) {
|
);
|
||||||
loading = false;
|
window.dispatchEvent(
|
||||||
return;
|
new CustomEvent("login-attempt", {
|
||||||
}
|
detail: { username, password, saveCredentials },
|
||||||
const userResult = resultData.user as User;
|
})
|
||||||
currentUser.set(userResult);
|
);
|
||||||
currentPage.set(Page.Launch);
|
});
|
||||||
toast.success(`Welcome back, ${userResult.name}!`, {
|
toast.promise(
|
||||||
position: "bottom-center",
|
loginPromise,
|
||||||
className:
|
{
|
||||||
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
loading: "Logging in...",
|
||||||
duration: 3000,
|
success: "Successfully logged in!",
|
||||||
});
|
error: "Failed to login.",
|
||||||
loading = false;
|
|
||||||
},
|
},
|
||||||
{ once: true }
|
{
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 3000,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const tryAutoLogin = async () => {
|
||||||
|
loading = true;
|
||||||
|
const loginPromise = new Promise<void>((res, rej) => {
|
||||||
|
window.addEventListener(
|
||||||
|
"login-result",
|
||||||
|
(e) => {
|
||||||
|
const customEvent = e as CustomEvent;
|
||||||
|
const resultData = customEvent.detail;
|
||||||
|
const isGuest = "guest" in resultData;
|
||||||
|
const wasSuccessful = "user" in resultData;
|
||||||
|
console.log(resultData);
|
||||||
|
if (isGuest) {
|
||||||
|
currentPage.set(Page.Launch);
|
||||||
|
res();
|
||||||
|
toast.success(`Logged in as Guest`, {
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 3000,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!wasSuccessful) {
|
||||||
|
loading = false;
|
||||||
|
rej();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const userResult = resultData.user as User;
|
||||||
|
currentUser.set(userResult);
|
||||||
|
currentPage.set(Page.Launch);
|
||||||
|
res();
|
||||||
|
toast.success(`Welcome back, ${userResult.name}!`, {
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 3000,
|
||||||
|
});
|
||||||
|
loading = false;
|
||||||
|
},
|
||||||
|
{ once: true }
|
||||||
|
);
|
||||||
|
window.dispatchEvent(new CustomEvent("autologin-attempt"));
|
||||||
|
});
|
||||||
|
toast.promise(
|
||||||
|
loginPromise,
|
||||||
|
{
|
||||||
|
loading: "Logging in...",
|
||||||
|
success: "Successfully logged in!",
|
||||||
|
error: "Failed to login.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: "bottom-center",
|
||||||
|
className:
|
||||||
|
"dark:!bg-gray-800 border-1 dark:!border-gray-700 dark:!text-gray-100",
|
||||||
|
duration: 3000,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
window.dispatchEvent(new CustomEvent("autologin-attempt"));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const proceedAsGuest = () => {
|
const proceedAsGuest = () => {
|
||||||
@@ -103,10 +140,24 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!$startup) {
|
const shouldAutologin = async () => {
|
||||||
startup.set(true);
|
const shouldAutologin = await new Promise<boolean>((res) => {
|
||||||
tryAutoLogin();
|
window.addEventListener("autologin-result", (e) => {
|
||||||
}
|
const customEvent = e as CustomEvent;
|
||||||
|
const resultData = customEvent.detail;
|
||||||
|
res(resultData);
|
||||||
|
});
|
||||||
|
window.dispatchEvent(new CustomEvent("autologin-active"));
|
||||||
|
});
|
||||||
|
return shouldAutologin;
|
||||||
|
};
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
if (!$startup) {
|
||||||
|
startup.set(true);
|
||||||
|
if (await shouldAutologin()) tryAutoLogin();
|
||||||
|
}
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
@@ -142,8 +193,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Button>
|
</Button>
|
||||||
</Input>
|
</Input>
|
||||||
<Checkbox bind:checked={saveCredentials}>Save credentials</Checkbox>
|
<Checkbox bind:checked={saveCredentials} disabled={loading}
|
||||||
<div class="flex flex-col justify-center items-center gap-5 mt-1">
|
>Save credentials</Checkbox
|
||||||
|
>
|
||||||
|
<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,36 +1,88 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, ButtonGroup, Input } from "flowbite-svelte";
|
import { Button, ButtonGroup, Input, Toggle } from "flowbite-svelte";
|
||||||
import { FolderSolid } from "flowbite-svelte-icons";
|
import { FileSearchSolid, FolderSolid } from "flowbite-svelte-icons";
|
||||||
import { currentPage } from "../storage/localStore";
|
import { patch, presence } from "./../storage/localStore";
|
||||||
import { Page } from "../consts/pages";
|
|
||||||
|
let folderPath: string = "";
|
||||||
|
|
||||||
|
window.addEventListener("settings-result", (e) => {
|
||||||
|
const settings: Record<string, string>[] = (e as CustomEvent).detail;
|
||||||
|
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 : "";
|
||||||
|
});
|
||||||
|
window.dispatchEvent(new CustomEvent("settings-get"));
|
||||||
|
|
||||||
|
const setFolderPath = () => {
|
||||||
|
window.dispatchEvent(new CustomEvent("folder-set"));
|
||||||
|
};
|
||||||
|
|
||||||
|
const detectFolderPath = () => {
|
||||||
|
window.dispatchEvent(new CustomEvent("folder-auto"));
|
||||||
|
};
|
||||||
|
|
||||||
|
const togglePatching = () => {
|
||||||
|
patch.set(!$patch);
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("setting-update", { detail: { patch: $patch } })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const togglePresence = () => {
|
||||||
|
presence.set(!$presence);
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("setting-update", { detail: { presence: $presence } })
|
||||||
|
);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
class="h-[265px] my-auto flex flex-col justify-center items-center p-5 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">
|
||||||
|
<Toggle class="w-fit" bind:checked={$presence} on:click={togglePresence}
|
||||||
|
>Discord Presence</Toggle
|
||||||
|
>
|
||||||
|
<Toggle class="w-fit" bind:checked={$patch} on:click={togglePatching}
|
||||||
|
>Patching</Toggle
|
||||||
|
>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="container flex flex-col items-center justify-center gap-5 rounded-lg p-3"
|
class="container flex flex-col items-center justify-center gap-5 rounded-lg p-3"
|
||||||
>
|
>
|
||||||
<ButtonGroup class="w-full">
|
<ButtonGroup class="w-full">
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
|
id="oip"
|
||||||
placeholder="Path to your osu! installation"
|
placeholder="Path to your osu! installation"
|
||||||
|
value={folderPath}
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
<Button color="light" class="dark:active:!bg-gray-900"
|
<Button
|
||||||
><FolderSolid
|
color="light"
|
||||||
|
class="dark:active:!bg-gray-900"
|
||||||
|
on:click={detectFolderPath}
|
||||||
|
>
|
||||||
|
<FileSearchSolid
|
||||||
size="sm"
|
size="sm"
|
||||||
class="dark:text-gray-300 text-gray-500 outline-none border-none select-none pointer-events-none"
|
class="dark:text-gray-300 text-gray-500 outline-none border-none select-none pointer-events-none"
|
||||||
/></Button
|
/>
|
||||||
>
|
</Button>
|
||||||
</ButtonGroup>
|
|
||||||
<div class="flex flex-row justify-center items-center gap-5">
|
|
||||||
<Button color="light" class="dark:active:!bg-gray-900">Save</Button>
|
|
||||||
<Button
|
<Button
|
||||||
color="red"
|
color="light"
|
||||||
class="dark:active:!bg-red-900 border-red-400"
|
class="dark:active:!bg-gray-900 active:!rounded-lg"
|
||||||
on:click={() => currentPage.set(Page.Launch)}>Cancel</Button
|
on:click={setFolderPath}
|
||||||
>
|
>
|
||||||
</div>
|
<FolderSolid
|
||||||
|
size="sm"
|
||||||
|
class="dark:text-gray-300 text-gray-500 outline-none border-none select-none pointer-events-none"
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@@ -3,10 +3,12 @@ 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);
|
||||||
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);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
export type User = {
|
export type User = {
|
||||||
id: number;
|
id: number;
|
||||||
|
donor: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
};
|
};
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
import type { Error } from "../types/error";
|
|
||||||
import type { User } from "../types/user";
|
|
||||||
|
|
||||||
const loginCheckEndpoint = "https://ez-pp.farm/login/check";
|
|
||||||
let retries = 0;
|
|
||||||
|
|
||||||
export const performLogin = async (
|
|
||||||
username: string,
|
|
||||||
password: string,
|
|
||||||
): Promise<Error | User> => {
|
|
||||||
const fetchResult = await fetch("https://ez-pp.farm/login/check", {
|
|
||||||
method: "POST",
|
|
||||||
mode: "cors",
|
|
||||||
body: JSON.stringify({ username, password }),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (fetchResult.ok) {
|
|
||||||
const result = await fetchResult.json();
|
|
||||||
retries = 0;
|
|
||||||
return result.user;
|
|
||||||
} else {
|
|
||||||
if (retries++ >= 5) {
|
|
||||||
console.log("Login failed after 5 retries.");
|
|
||||||
retries = 0;
|
|
||||||
return { code: 403, message: "Login failed." } as Error;
|
|
||||||
}
|
|
||||||
return await performLogin(username, password);
|
|
||||||
}
|
|
||||||
};
|
|
3
src/util/mathUtil.ts
Normal file
3
src/util/mathUtil.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const clamp = (val: number, min: number, max: number) => {
|
||||||
|
return Math.max(min, Math.min(val, max));
|
||||||
|
};
|
@@ -8,6 +8,14 @@ const config = {
|
|||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
keyframes: {
|
keyframes: {
|
||||||
|
slideIn: {
|
||||||
|
"0%": { opacity: "0", transform: "translateX(-5px)" },
|
||||||
|
"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" },
|
||||||
@@ -18,9 +26,14 @@ const config = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
animation: {
|
animation: {
|
||||||
|
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",
|
||||||
},
|
},
|
||||||
|
transitionProperty: {
|
||||||
|
"width": "width",
|
||||||
|
},
|
||||||
colors: {
|
colors: {
|
||||||
// flowbite-svelte
|
// flowbite-svelte
|
||||||
primary: {
|
primary: {
|
||||||
|
@@ -1,7 +1,16 @@
|
|||||||
{
|
{
|
||||||
"extends": "./node_modules/@tsconfig/svelte/tsconfig.json",
|
"extends": "./node_modules/@tsconfig/svelte/tsconfig.json",
|
||||||
|
|
||||||
"include": ["src/**/*"],
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"electron/richPresence.js",
|
||||||
|
"electron/config.js",
|
||||||
|
"electron/cryptoUtil.js",
|
||||||
|
"electron/executeUtil.js",
|
||||||
|
"electron/formattingUtil.js",
|
||||||
|
"electron/hwidUtil.js",
|
||||||
|
"electron/osuUtil.js"
|
||||||
|
],
|
||||||
"exclude": ["node_modules/*", "__sapper__/*", "public/*"],
|
"exclude": ["node_modules/*", "__sapper__/*", "public/*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
|
Reference in New Issue
Block a user