Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
f870b48b25 | |||
94db97ef30 | |||
7e2fe2ec96 | |||
7cba78b270 | |||
f6e5ead7ed | |||
7ed7d3045f | |||
37b7bbd2e3 | |||
47f86501b8 | |||
42777c9e0c | |||
769a88521e | |||
f5287b6378 | |||
dd6866f680 | |||
cb1a05d58c | |||
fdfedab77f | |||
fc284e08f0 | |||
361db1df17 | |||
0a664d1f64 | |||
232043d686 | |||
10a4c540dd | |||
b111cf4fa4 | |||
e2713179c8 | |||
92ee92d636 | |||
b3463378e9 | |||
00e3e80d43 | |||
2df9f533fe | |||
cc93e24ab6 | |||
48cd81f28d | |||
068d02f1f7 | |||
e725592ef1 | |||
6bc0b215d7 | |||
da1b05c9a1 | |||
f1ef41dfea | |||
a358ff08fa | |||
5db981228e | |||
3247a3fcdf | |||
7b9a6d77ab | |||
337a8af68f | |||
84c13331d2 | |||
e77cb22028 | |||
b673b74eee | |||
53a2fb55a6 | |||
3e4186d3a7 | |||
89cdc8f316 | |||
67a53fdd2d | |||
78c554be2d | |||
586857146c | |||
2cea272836 | |||
02d4fa2199 | |||
72a0d9b780 | |||
1489d44a31 | |||
adaaf32acf | |||
033ce8f3a4 | |||
2857345997 | |||
4f3eaddfc7 | |||
573bcd393c | |||
11c3f9f657 | |||
c3c5390830 | |||
67de9b7c16 | |||
37567b5767 | |||
0a780b84e4 | |||
c8a07fbb0d |
50
.github/workflows/build.yml
vendored
Normal file
50
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Compile and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run rebuild
|
||||||
|
- run: npm run pack-linux
|
||||||
|
- name: Add Artifact to Workflow
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: |
|
||||||
|
release/*.AppImage
|
||||||
|
|
||||||
|
build-win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run rebuild
|
||||||
|
- run: npm run pack-win
|
||||||
|
- name: Add Artifact to Workflow
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: |
|
||||||
|
release/*.exe
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
release/
|
release/
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
pnpm-lock.yaml
|
||||||
|
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Debug Main Process",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||||
|
"windows": {
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||||
|
},
|
||||||
|
"args" : ["."],
|
||||||
|
"outputCapture": "std"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
12
README.md
12
README.md
@@ -1,16 +1,18 @@
|
|||||||
# EZPPLauncher
|
# EZPPLauncher
|
||||||
|
|
||||||
Welcome to the EZPPLauncher! A new way to connect to the EZPPFarm server.
|
Welcome to the EZPPLauncher! A new way to connect to the EZPPFarm server.
|
||||||
|
|
||||||
Just one click and you are ready to go!
|
Just one click and you are ready to go!
|
||||||
|
|
||||||
|
## Preview Image
|
||||||
|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
The Launcher is a "plug and play thing", download it, place it on the desktop and execute!
|
The Launcher is a "plug and play thing", download it, place it on the desktop and execute!
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Automatic osu! client updating before Launch
|
* Automatic osu! client updating before Launch
|
||||||
* Account saving (soon)
|
* Account saving
|
||||||
|
|
||||||
## Used Libraries
|
## Used Libraries
|
||||||
|
|
||||||
@@ -18,14 +20,16 @@ The Launcher is a "plug and play thing", download it, place it on the desktop an
|
|||||||
* [custom-electron-titlebar](https://www.npmjs.com/package/custom-electron-titlebar)
|
* [custom-electron-titlebar](https://www.npmjs.com/package/custom-electron-titlebar)
|
||||||
* [axios](https://www.npmjs.com/package/axios)
|
* [axios](https://www.npmjs.com/package/axios)
|
||||||
* [jquery](https://www.npmjs.com/package/jquery)
|
* [jquery](https://www.npmjs.com/package/jquery)
|
||||||
|
* [discord-auto-rpc](https://www.npmjs.com/package/discord-auto-rpc)
|
||||||
|
* [get-window-by-name](https://www.npmjs.com/package/get-window-by-name)
|
||||||
|
* [sweetalert2](https://www.npmjs.com/package/sweetalert2)
|
||||||
|
* [node-downloader-helper](https://www.npmjs.com/package/node-downloader-helper)
|
||||||
|
|
||||||
## Build from source
|
## Build from source
|
||||||
|
|
||||||
- clone repo
|
- clone repo
|
||||||
- cd into the repo
|
- cd into the repo
|
||||||
- use `yarn install` to install all dependencies
|
- use `yarn install` to install all dependencies
|
||||||
- (if node-gyp cant build the natives try clearing the cache at `%localappdata%\node-gyp\Cache\`)
|
|
||||||
- run `yarn rebuild` to rebuild the natives to the current `NODE_MODULE_VERSION`
|
|
||||||
- use the buildscript `pack-win` to build a executeable
|
- use the buildscript `pack-win` to build a executeable
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
553
app.js
553
app.js
@@ -1,209 +1,412 @@
|
|||||||
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
|
const { app, BrowserWindow, ipcMain, dialog, Tray, Menu } = require('electron');
|
||||||
const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main');
|
const { setupTitlebar } = require('custom-electron-titlebar/main');
|
||||||
const windowManager = require('./ui/windowManager');
|
const windowManager = require('./ui/windowManager');
|
||||||
const osuUtil = require('./osuUtil');
|
const osuUtil = require('./osuUtil');
|
||||||
const ezppUtil = require('./ezppUtil');
|
const ezppUtil = require('./ezppUtil');
|
||||||
const config = require('./config');
|
const config = require('./config');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const rpc = require('./discordPresence');
|
||||||
|
const windowName = require('get-window-by-name');
|
||||||
|
const terminalUtil = require('./terminalUtil');
|
||||||
|
const osUtil = require('./osUtil');
|
||||||
|
const appInfo = require('./appInfo');
|
||||||
|
const { DownloaderHelper } = require('node-downloader-helper');
|
||||||
|
|
||||||
let tempOsuPath;
|
let tempOsuPath;
|
||||||
|
let osuWindowInfo;
|
||||||
|
let isIngame;
|
||||||
|
const platform = process.platform;
|
||||||
|
let linuxWMCtrlFound = false;
|
||||||
|
let osuLoaded = false;
|
||||||
|
|
||||||
const run = () => {
|
const run = () => {
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
const gotTheLock = app.requestSingleInstanceLock()
|
||||||
if (!gotTheLock) {
|
if (!gotTheLock) {
|
||||||
app.quit();
|
app.quit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupTitlebar();
|
setInterval(async () => {
|
||||||
|
if (platform == "win32") {
|
||||||
|
osuWindowInfo = windowName.getWindowText("osu!.exe");
|
||||||
|
const firstInstance = osuWindowInfo[0];
|
||||||
|
if (firstInstance) {
|
||||||
|
if (firstInstance.processTitle && firstInstance.processTitle.length > 0) {
|
||||||
|
if (!osuLoaded) {
|
||||||
|
osuLoaded = true;
|
||||||
|
//TODO: do patch
|
||||||
|
}
|
||||||
|
const windowTitle = firstInstance.processTitle;
|
||||||
|
let rpcOsuVersion = "";
|
||||||
|
let currentMap = undefined;
|
||||||
|
if (!windowTitle.includes("-")) {
|
||||||
|
rpcOsuVersion = windowTitle;
|
||||||
|
rpc.updateState("Idle...");
|
||||||
|
} else {
|
||||||
|
var string = windowTitle;
|
||||||
|
var components = string.split(' - ');
|
||||||
|
const splitArray = [components.shift(), components.join(' - ')];
|
||||||
|
rpcOsuVersion = splitArray[0];
|
||||||
|
currentMap = splitArray[1];
|
||||||
|
if (currentMap.endsWith(".osu")) {
|
||||||
|
rpc.updateState("Editing...");
|
||||||
|
currentMap = currentMap.substring(0, currentMap.length - 4);
|
||||||
|
} else rpc.updateState("Playing...");
|
||||||
|
}
|
||||||
|
|
||||||
let mainWindow;
|
rpc.updateStatus(currentMap, rpcOsuVersion);
|
||||||
app.whenReady().then(() => {
|
|
||||||
|
|
||||||
mainWindow = createWindow();
|
|
||||||
mainWindow.on('show', async () => {
|
|
||||||
await updateConfigVars(mainWindow);
|
|
||||||
await tryLogin(mainWindow);
|
|
||||||
await doUpdateCheck(mainWindow);
|
|
||||||
})
|
|
||||||
app.on('activate', function () {
|
|
||||||
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
|
|
||||||
})
|
|
||||||
app.on('window-all-closed', () => {
|
|
||||||
app.quit()
|
|
||||||
})
|
|
||||||
ipcMain.handle('launch', async () => {
|
|
||||||
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
|
||||||
const username = await config.get('username');
|
|
||||||
const password = await config.get('password');
|
|
||||||
if (password && username) {
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "SaveUsername", "1");
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "SavePassword", "1");
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Username", username);
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Password", await osuUtil.decryptString(password));
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "CredentialEndpoint", "ez-pp.farm");
|
|
||||||
} else {
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Username", "");
|
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Password", "");
|
|
||||||
}
|
|
||||||
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
|
||||||
await doUpdateCheck(mainWindow);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
})
|
|
||||||
ipcMain.on('do-update-check', async () => {
|
|
||||||
await doUpdateCheck(mainWindow);
|
|
||||||
})
|
|
||||||
ipcMain.on('do-update', async () => {
|
|
||||||
const osuPath = await config.get("osuPath", "");
|
|
||||||
const isValid = await osuUtil.isValidOsuFolder(osuPath);
|
|
||||||
if (osuPath.trim == "" || !isValid) {
|
|
||||||
mainWindow.webContents.send('status_update', {
|
|
||||||
type: "error",
|
|
||||||
message: "Invalid osu! folder"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (fs.existsSync(osuPath)) {
|
|
||||||
tempOsuPath = osuPath;
|
|
||||||
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
|
||||||
const lastVersion = await osuConfig.get("LastVersion");
|
|
||||||
let releaseStream = "stable40";
|
|
||||||
if (lastVersion.endsWith("cuttingedge"))
|
|
||||||
releaseStream = "cuttingedge"
|
|
||||||
else if (lastVersion.endsWith("beta"))
|
|
||||||
releaseStream = "beta";
|
|
||||||
|
|
||||||
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
|
|
||||||
const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles);
|
|
||||||
const downloadTask = await osuUtil.downloadUpdateFiles(osuPath, filesToDownload);
|
|
||||||
downloadTask.on('completed', () => {
|
|
||||||
mainWindow.webContents.send('status_update', {
|
|
||||||
type: "update-complete"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
downloadTask.on('error', () => {
|
|
||||||
mainWindow.webContents.send('status_update', {
|
|
||||||
type: "error",
|
|
||||||
message: "An error occured while updating."
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
} else
|
|
||||||
mainWindow.webContents.send('status_update', {
|
|
||||||
type: "error",
|
|
||||||
message: "Invalid osu! folder"
|
|
||||||
});
|
|
||||||
})
|
|
||||||
ipcMain.handle('set-osu-dir', async (event) => {
|
|
||||||
const yes = await dialog.showOpenDialog({
|
|
||||||
properties: ['openDirectory']
|
|
||||||
})
|
|
||||||
if (yes.filePaths.length <= 0)
|
|
||||||
return undefined;
|
|
||||||
const folderPath = yes.filePaths[0];
|
|
||||||
const validOsuDir = await osuUtil.isValidOsuFolder(folderPath);
|
|
||||||
|
|
||||||
if (validOsuDir) await config.set("osuPath", folderPath);
|
|
||||||
|
|
||||||
return { validOsuDir, folderPath };
|
|
||||||
})
|
|
||||||
ipcMain.handle('perform-login', async (event, data) => {
|
|
||||||
const { username, password } = data;
|
|
||||||
const loginData = await ezppUtil.performLogin(username, password);
|
|
||||||
if (loginData && loginData.code === 200) {
|
|
||||||
await config.set("username", username);
|
|
||||||
await config.set("password", await osuUtil.encryptString(password));
|
|
||||||
}
|
|
||||||
return loginData;
|
|
||||||
})
|
|
||||||
ipcMain.on('perform-logout', async (event) => {
|
|
||||||
await config.remove("username");
|
|
||||||
await config.remove("password");
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateConfigVars(window) {
|
|
||||||
const osuPath = await config.get("osuPath", "");
|
|
||||||
window.webContents.send('config_update', {
|
|
||||||
osuPath: osuPath
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function tryLogin(window) {
|
|
||||||
const username = await config.get("username", "");
|
|
||||||
const password = await config.get("password", "");
|
|
||||||
if ((username && username.length > 0) && (password && password.length > 0)) {
|
|
||||||
const passwordPlain = await osuUtil.decryptString(password);
|
|
||||||
const loginResponse = await ezppUtil.performLogin(username, passwordPlain);
|
|
||||||
if (loginResponse && loginResponse.code === 200) {
|
|
||||||
window.webContents.send('account_update', {
|
|
||||||
type: "loggedin",
|
|
||||||
user: loginResponse.user
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
window.webContents.send('account_update', {
|
if (osuLoaded) osuLoaded = false;
|
||||||
type: "login-failed"
|
rpc.updateState("Idle in Launcher...");
|
||||||
})
|
rpc.updateStatus(undefined, undefined);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (osuLoaded) osuLoaded = false;
|
||||||
|
rpc.updateState("Idle in Launcher...");
|
||||||
|
rpc.updateStatus(undefined, undefined);
|
||||||
|
}
|
||||||
|
} else if (platform == "linux") {
|
||||||
|
if (!linuxWMCtrlFound) {
|
||||||
|
if (isIngame) {
|
||||||
|
rpc.updateState("Playing...");
|
||||||
|
rpc.updateStatus("Clicking circles!", "runningunderwine");
|
||||||
|
} else {
|
||||||
|
rpc.updateState("Idle in Launcher...");
|
||||||
|
rpc.updateStatus(undefined, undefined);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const processesOutput = await terminalUtil.execCommand(`wmctrl -l|awk '{$3=""; $2=""; $1=""; print $0}'`);
|
||||||
|
const allLines = processesOutput.split("\n");
|
||||||
|
const filteredProcesses = allLines.filter((line) => line.trim().startsWith("osu!"));
|
||||||
|
if (filteredProcesses.length > 0) {
|
||||||
|
const windowTitle = filteredProcesses[0].trim();
|
||||||
|
let rpcOsuVersion = "";
|
||||||
|
let currentMap = undefined;
|
||||||
|
if (!windowTitle.includes("-")) {
|
||||||
|
rpcOsuVersion = windowTitle;
|
||||||
|
rpc.updateState("Idle...");
|
||||||
|
} else {
|
||||||
|
var string = windowTitle;
|
||||||
|
var components = string.split(' - ');
|
||||||
|
const splitArray = [components.shift(), components.join(' - ')];
|
||||||
|
rpcOsuVersion = splitArray[0];
|
||||||
|
currentMap = splitArray[1];
|
||||||
|
if (currentMap.endsWith(".osu")) {
|
||||||
|
rpc.updateState("Editing/Modding...");
|
||||||
|
currentMap = currentMap.substring(0, currentMap.length - 4);
|
||||||
|
}
|
||||||
|
else rpc.updateState("Playing...");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
window.webContents.send('account_update', {
|
|
||||||
type: "not-loggedin"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function doUpdateCheck(window) {
|
rpc.updateStatus(currentMap, rpcOsuVersion);
|
||||||
const osuPath = await config.get("osuPath");
|
} else {
|
||||||
if (!osuPath || osuPath.trim == "") {
|
rpc.updateState("Idle in Launcher...");
|
||||||
window.webContents.send('status_update', {
|
rpc.updateStatus(undefined, undefined);
|
||||||
type: "missing-folder"
|
}
|
||||||
})
|
} else {
|
||||||
return;
|
if (isIngame) {
|
||||||
|
rpc.updateState("Playing...");
|
||||||
|
rpc.updateStatus("Clicking circles!", "runningunderwine");
|
||||||
|
} else {
|
||||||
|
rpc.updateState("Idle in Launcher...");
|
||||||
|
rpc.updateStatus(undefined, undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const isValid = await osuUtil.isValidOsuFolder(osuPath);
|
}, 2000);
|
||||||
if (!isValid) {
|
|
||||||
window.webContents.send('status_update', {
|
setupTitlebar();
|
||||||
type: "missing-folder"
|
|
||||||
})
|
rpc.connect();
|
||||||
return;
|
|
||||||
|
let mainWindow;
|
||||||
|
let tray = null
|
||||||
|
app.whenReady().then(async () => {
|
||||||
|
const logoFile = path.join(config.configFolder, "logo.png");
|
||||||
|
if (!fs.existsSync(logoFile)) {
|
||||||
|
const logoDownload = new DownloaderHelper("https://ez-pp.farm/assets/img/icon.png", config.configFolder, {
|
||||||
|
fileName: "logo.png",
|
||||||
|
})
|
||||||
|
await logoDownload.start();
|
||||||
}
|
}
|
||||||
if (fs.existsSync(osuPath)) {
|
tray = new Tray(logoFile);
|
||||||
|
const trayMenuTemplate = [
|
||||||
|
{
|
||||||
|
label: `EZPPLauncher ${appInfo.appVersion}`,
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: "Show/Hide",
|
||||||
|
click: function () {
|
||||||
|
if (mainWindow.isVisible()) mainWindow.hide();
|
||||||
|
else mainWindow.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: 'Exit',
|
||||||
|
click: function () {
|
||||||
|
if (isIngame) return;
|
||||||
|
app.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
let trayMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
|
tray.setContextMenu(trayMenu)
|
||||||
|
|
||||||
|
mainWindow = createWindow();
|
||||||
|
mainWindow.on('close', (e) => {
|
||||||
|
if (isIngame) e.preventDefault();
|
||||||
|
});
|
||||||
|
mainWindow.once('show', async () => {
|
||||||
|
await updateConfigVars(mainWindow);
|
||||||
|
await tryLogin(mainWindow);
|
||||||
|
await doUpdateCheck(mainWindow);
|
||||||
|
if (platform === "linux") {
|
||||||
|
const linuxDistroInfo = await osUtil.getLinuxDistroInfo();
|
||||||
|
if (linuxDistroInfo?.id != "arch") {
|
||||||
|
if (linuxDistroInfo?.id_like != "arch") {
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "info",
|
||||||
|
message: "We detected that you are running the Launcher under Linux. It's currently just compatible with Arch like distributions!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await terminalUtil.execCommand(`osu-stable -h`);
|
||||||
|
} catch (err) {
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "package-issue",
|
||||||
|
message: "Seems like you dont have the osu AUR Package installed, please install it."
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* mainWindow.webContents.send('status_update', {
|
||||||
|
type: "info",
|
||||||
|
message: "We detected that you are running the Launcher under Linux. It's currently just compatible with Arch and the osu AUR package!"
|
||||||
|
}); */
|
||||||
|
const terminalTest = await terminalUtil.execCommand(`wmctrl -l|awk '{$3=""; $2=""; $1=""; print $0}'`);
|
||||||
|
const isFailed = terminalTest.trim() == "";
|
||||||
|
if (isFailed) {
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "info",
|
||||||
|
message: "Seems like you are missing the wmctrl package, please install it for the RPC to work!"
|
||||||
|
});
|
||||||
|
} else linuxWMCtrlFound = true;
|
||||||
|
} else {
|
||||||
|
const osuFolder = await config.get("osuPath");
|
||||||
|
if (!osuFolder || osuFolder == "") {
|
||||||
|
const foundFolder = await osuUtil.findOsuInstallation();
|
||||||
|
if (foundFolder && osuUtil.isValidOsuFolder(foundFolder)) {
|
||||||
|
mainWindow.webContents.send('alert_message', foundFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ipcMain.on("alert_response", async (event, path) => {
|
||||||
|
await config.set("osuPath", path);
|
||||||
|
})
|
||||||
|
app.on('activate', function () {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
|
||||||
|
})
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
app.quit()
|
||||||
|
})
|
||||||
|
ipcMain.handle('launch', async () => {
|
||||||
|
const osuFolder = await config.get("osuPath");
|
||||||
|
await osuUtil.updateOsuCfg(path.join(osuFolder, "osu!.cfg"));
|
||||||
|
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
||||||
|
const username = await config.get('username');
|
||||||
|
const password = await config.get('password');
|
||||||
|
if (password && username) {
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "SaveUsername", "1");
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "SavePassword", "1");
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "Username", username);
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "Password", password);
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "CredentialEndpoint", "ez-pp.farm");
|
||||||
|
} else {
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "Username", "");
|
||||||
|
await osuUtil.setConfigValue(osuConfig.path, "Password", "");
|
||||||
|
}
|
||||||
|
await osuUtil.replaceUI(osuFolder, true);
|
||||||
|
rpc.updateState("Launching osu!...");
|
||||||
|
isIngame = true;
|
||||||
|
mainWindow.closable = false;
|
||||||
|
if (mainWindow.isVisible()) mainWindow.hide();
|
||||||
|
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
||||||
|
if (!mainWindow.isVisible()) mainWindow.show();
|
||||||
|
setTimeout(async () => {
|
||||||
|
isIngame = false;
|
||||||
|
await osuUtil.replaceUI(osuFolder, false);
|
||||||
|
await doUpdateCheck(mainWindow);
|
||||||
|
mainWindow.closable = true;
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
ipcMain.on('do-update-check', async () => {
|
||||||
|
await doUpdateCheck(mainWindow);
|
||||||
|
})
|
||||||
|
ipcMain.on('do-update', async () => {
|
||||||
|
const osuPath = await config.get("osuPath", "");
|
||||||
|
const isValid = await osuUtil.isValidOsuFolder(osuPath);
|
||||||
|
if (osuPath.trim == "" || !isValid) {
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "error",
|
||||||
|
message: "Invalid osu! folder"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fs.existsSync(osuPath)) {
|
||||||
tempOsuPath = osuPath;
|
tempOsuPath = osuPath;
|
||||||
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
||||||
const lastVersion = await osuConfig.get("LastVersion");
|
const lastVersion = await osuConfig.get("LastVersion");
|
||||||
let releaseStream = "stable40";
|
let releaseStream = "stable40";
|
||||||
if (lastVersion.endsWith("cuttingedge"))
|
if (lastVersion.endsWith("cuttingedge"))
|
||||||
releaseStream = "cuttingedge"
|
releaseStream = "cuttingedge"
|
||||||
else if (lastVersion.endsWith("beta"))
|
else if (lastVersion.endsWith("beta"))
|
||||||
releaseStream = "beta";
|
releaseStream = "beta";
|
||||||
|
|
||||||
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
|
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
|
||||||
const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles);
|
const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles);
|
||||||
window.webContents.send('status_update', {
|
const downloadTask = await osuUtil.downloadUpdateFiles(osuPath, filesToDownload);
|
||||||
type: filesToDownload.length > 0 ? "update-available" : "up-to-date"
|
downloadTask.on('completed', () => {
|
||||||
})
|
mainWindow.webContents.send('status_update', {
|
||||||
} else
|
type: "update-complete"
|
||||||
window.webContents.send('status_update', {
|
})
|
||||||
type: "missing-folder"
|
});
|
||||||
})
|
downloadTask.on('error', () => {
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "error",
|
||||||
|
message: "An error occured while updating."
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
} else
|
||||||
|
mainWindow.webContents.send('status_update', {
|
||||||
|
type: "error",
|
||||||
|
message: "Invalid osu! folder"
|
||||||
|
});
|
||||||
|
})
|
||||||
|
ipcMain.handle('set-osu-dir', async (event) => {
|
||||||
|
const yes = await dialog.showOpenDialog({
|
||||||
|
properties: ['openDirectory']
|
||||||
|
})
|
||||||
|
if (yes.filePaths.length <= 0)
|
||||||
|
return undefined;
|
||||||
|
const folderPath = yes.filePaths[0];
|
||||||
|
const validOsuDir = await osuUtil.isValidOsuFolder(folderPath);
|
||||||
|
|
||||||
|
if (validOsuDir) await config.set("osuPath", folderPath);
|
||||||
|
|
||||||
|
return { validOsuDir, folderPath };
|
||||||
|
})
|
||||||
|
ipcMain.handle('perform-login', async (event, data) => {
|
||||||
|
const { username, password } = data;
|
||||||
|
const loginData = await ezppUtil.performLogin(username, password);
|
||||||
|
if (loginData && loginData.code === 200) {
|
||||||
|
await config.set("username", username);
|
||||||
|
await config.set("password", password);
|
||||||
|
}
|
||||||
|
return loginData;
|
||||||
|
})
|
||||||
|
ipcMain.on('perform-logout', async (event) => {
|
||||||
|
await config.remove("username");
|
||||||
|
await config.remove("password");
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateConfigVars(window) {
|
||||||
|
const osuPath = await config.get("osuPath", "");
|
||||||
|
window.webContents.send('config_update', {
|
||||||
|
osuPath: osuPath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function tryLogin(window) {
|
||||||
|
const username = await config.get("username", "");
|
||||||
|
const password = await config.get("password", "");
|
||||||
|
if ((username && username.length > 0) && (password && password.length > 0)) {
|
||||||
|
const passwordPlain = password;
|
||||||
|
const loginResponse = await ezppUtil.performLogin(username, passwordPlain);
|
||||||
|
if (loginResponse && loginResponse.code === 200) {
|
||||||
|
window.webContents.send('account_update', {
|
||||||
|
type: "loggedin",
|
||||||
|
user: loginResponse.user
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await config.remove("username");
|
||||||
|
await config.remove("password");
|
||||||
|
window.webContents.send('account_update', {
|
||||||
|
type: "login-failed",
|
||||||
|
message: loginResponse.message
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
window.webContents.send('account_update', {
|
||||||
|
type: "not-loggedin"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkUpdate = await appInfo.hasUpdate();
|
||||||
|
if (checkUpdate) {
|
||||||
|
window.webContents.send('launcher_update', checkUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doUpdateCheck(window) {
|
||||||
|
const osuPath = await config.get("osuPath");
|
||||||
|
if (!osuPath || osuPath.trim == "") {
|
||||||
|
window.webContents.send('status_update', {
|
||||||
|
type: "missing-folder"
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const isValid = await osuUtil.isValidOsuFolder(osuPath);
|
||||||
|
if (!isValid) {
|
||||||
|
window.webContents.send('status_update', {
|
||||||
|
type: "missing-folder"
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fs.existsSync(osuPath)) {
|
||||||
|
tempOsuPath = osuPath;
|
||||||
|
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
||||||
|
const lastVersion = await osuConfig.get("LastVersion");
|
||||||
|
let releaseStream = "stable40";
|
||||||
|
if (lastVersion.endsWith("cuttingedge"))
|
||||||
|
releaseStream = "cuttingedge"
|
||||||
|
else if (lastVersion.endsWith("beta"))
|
||||||
|
releaseStream = "beta";
|
||||||
|
|
||||||
|
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
|
||||||
|
const filesToDownload = await osuUtil.filesThatNeedUpdate(tempOsuPath, releaseFiles);
|
||||||
|
window.webContents.send('status_update', {
|
||||||
|
type: filesToDownload.length > 0 ? "update-available" : "up-to-date"
|
||||||
|
})
|
||||||
|
} else
|
||||||
|
window.webContents.send('status_update', {
|
||||||
|
type: "missing-folder"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const win = windowManager.createWindow(700, 420);
|
const win = windowManager.createWindow(700, 460);
|
||||||
|
|
||||||
win.loadFile('./html/index.html');
|
win.loadFile('./html/index.html');
|
||||||
|
|
||||||
attachTitlebarToWindow(win);
|
win.webContents.setWindowOpenHandler(() => "deny");
|
||||||
win.webContents.setWindowOpenHandler(() => "deny");
|
win.webContents.on('did-finish-load', function () {
|
||||||
win.webContents.on('did-finish-load', function () {
|
if (win.webContents.getZoomFactor() != 0.9)
|
||||||
if (win.webContents.getZoomFactor() != 0.9)
|
win.webContents.setZoomFactor(0.9)
|
||||||
win.webContents.setZoomFactor(0.9)
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
22
appInfo.js
22
appInfo.js
@@ -1,4 +1,20 @@
|
|||||||
const appName = "EZPPLauncher"
|
const { default: axios } = require("axios");
|
||||||
const appVersion = "1.1.0";
|
const { compareVersions } = require("compare-versions");
|
||||||
|
|
||||||
module.exports = { appName, appVersion };
|
const appName = "EZPPLauncher"
|
||||||
|
const appVersion = "1.1.5";
|
||||||
|
|
||||||
|
const hasUpdate = async () => {
|
||||||
|
const releaseInfo = await axios.get(`https://git.ez-pp.farm/api/v1/repos/EZPPFarm/${appName}/releases/latest`);
|
||||||
|
if (releaseInfo.status !== 200) return false;
|
||||||
|
const latestReleaseVersion = releaseInfo.data.tag_name;
|
||||||
|
const updateAvailable = compareVersions(latestReleaseVersion, appVersion);
|
||||||
|
if(updateAvailable > 0)
|
||||||
|
return {
|
||||||
|
version: latestReleaseVersion,
|
||||||
|
url: releaseInfo.data.html_url,
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { appName, appVersion, hasUpdate };
|
85
assets/checkbox.css
Normal file
85
assets/checkbox.css
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
[type="checkbox"]:not(:checked),
|
||||||
|
[type="checkbox"]:checked {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
opacity: 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="checkbox"]:not(:checked)+label,
|
||||||
|
[type="checkbox"]:checked+label {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 2.3em;
|
||||||
|
font-size: 1.05em;
|
||||||
|
line-height: 1.7;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* checkbox aspect */
|
||||||
|
[type="checkbox"]:not(:checked)+label:before,
|
||||||
|
[type="checkbox"]:checked+label:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 1.4em;
|
||||||
|
height: 1.4em;
|
||||||
|
border: 1px solid #565656;
|
||||||
|
background: #4c4c4c;
|
||||||
|
border-radius: .2em;
|
||||||
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 hsla(var(--main-accent), 93%, 48%, 20%);
|
||||||
|
-webkit-transition: all .275s;
|
||||||
|
transition: all .275s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* checked mark aspect */
|
||||||
|
[type="checkbox"]:not(:checked)+label:after,
|
||||||
|
[type="checkbox"]:checked+label:after {
|
||||||
|
content: '✕';
|
||||||
|
position: absolute;
|
||||||
|
top: .525em;
|
||||||
|
left: .18em;
|
||||||
|
font-size: 1.375em;
|
||||||
|
font-weight: bolder;
|
||||||
|
color: hsl(var(--main-accent), 93%, 48%);
|
||||||
|
line-height: 0;
|
||||||
|
-webkit-transition: all .2s;
|
||||||
|
transition: all .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* checked mark aspect changes */
|
||||||
|
[type="checkbox"]:not(:checked)+label:after {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transform: scale(0) rotate(45deg);
|
||||||
|
transform: scale(0) rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="checkbox"]:checked+label:after {
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transform: scale(1) rotate(0);
|
||||||
|
transform: scale(1) rotate(0);
|
||||||
|
translate: -1.5px -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disabled checkbox */
|
||||||
|
[type="checkbox"]:disabled:not(:checked)+label:before,
|
||||||
|
[type="checkbox"]:disabled:checked+label:before {
|
||||||
|
box-shadow: none;
|
||||||
|
border-color: #565656;
|
||||||
|
background-color: #4c4c4c;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="checkbox"]:disabled:checked+label:after {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="checkbox"]:disabled+label {
|
||||||
|
color: #aaa;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Accessibility */
|
||||||
|
[type="checkbox"]:checked:focus+label:before,
|
||||||
|
[type="checkbox"]:not(:checked):focus+label:before {
|
||||||
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 6px hsla(var(--main-accent), 93%, 48%, 20%);
|
||||||
|
}
|
@@ -1,39 +1,66 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--main-accent: 335deg;
|
--main-accent: 335deg;
|
||||||
|
--main-bg: 230deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: 'Exo 2', 'Roboto' !important;
|
font-family: 'Exo 2', 'Roboto' !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: hsl(var(--main-bg), 24%, 19%);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.text-white {
|
||||||
|
margin: .5rem 0;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quotetext {
|
||||||
|
color: white;
|
||||||
|
background-color: #727272;
|
||||||
|
border-radius: .35rem;
|
||||||
|
font-size: .95rem;
|
||||||
|
padding: .25rem .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sections {
|
.sections {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-name {
|
.app-name {
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-shadow: 0 0 15px rgba(255, 255, 255, 0.37);
|
text-shadow: 0 0 15px rgba(255, 255, 255, 0.37);
|
||||||
}
|
}
|
||||||
|
|
||||||
.launcher-window {
|
.launcher-window {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-button-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.launch-button-section button {
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-section,
|
.loading-section,
|
||||||
.login-section {
|
.login-section {
|
||||||
margin-top: 35px;
|
margin-top: 35px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-section {
|
.loading-section {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-section {}
|
.loading-section {}
|
||||||
@@ -41,265 +68,268 @@
|
|||||||
.loading-indicator {}
|
.loading-indicator {}
|
||||||
|
|
||||||
.loading-indicator-text {
|
.loading-indicator-text {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-section {
|
.folder-section {
|
||||||
margin-top: 45px;
|
margin-top: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-action {
|
.folder-action {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
line-height: .9;
|
line-height: .9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.launch-section {
|
.launch-section {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.btn-launch {
|
.btn.btn-launch {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
font-size: 23px;
|
font-size: 23px;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-section {
|
.account-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.server-logo img {
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info {
|
.user-info {
|
||||||
text-align: start;
|
text-align: start;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info .welcome-text {
|
.user-info .welcome-text {
|
||||||
font-size: 31px;
|
font-size: 31px;
|
||||||
letter-spacing: .02rem;
|
letter-spacing: .02rem;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: .8;
|
line-height: .8;
|
||||||
text-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
text-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info .account-action {
|
.user-info .account-action {
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
letter-spacing: .05rem;
|
letter-spacing: .05rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
text-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
text-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-image {
|
.user-image {
|
||||||
border: 5px solid white;
|
border: 5px solid white;
|
||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.349);
|
||||||
}
|
background-image: url(https://a.ez-pp.farm/0);
|
||||||
|
width: 100px;
|
||||||
#user-img {
|
height: 100px;
|
||||||
border-radius: .2rem;
|
background-size: cover;
|
||||||
width: 80px;
|
background-position: center;
|
||||||
/* somehow its misplaced without that */
|
|
||||||
transform: translate(-0.25px, 0.25px) scale(1.05);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-outline .form-control:focus~.form-notch .form-notch-leading {
|
.form-outline .form-control:focus~.form-notch .form-notch-leading {
|
||||||
border-color: hsl(var(--main-accent), 93%, 48%);
|
border-color: hsl(var(--main-accent), 93%, 48%);
|
||||||
box-shadow: -1px 0 0 0 hsl(var(--main-accent), 93%, 48%), 0 1px 0 0 hsl(var(--main-accent), 93%, 48%), 0 -1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
box-shadow: -1px 0 0 0 hsl(var(--main-accent), 93%, 48%), 0 1px 0 0 hsl(var(--main-accent), 93%, 48%), 0 -1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-outline .form-control:focus~.form-notch .form-notch-middle {
|
.form-outline .form-control:focus~.form-notch .form-notch-middle {
|
||||||
border-color: hsl(var(--main-accent), 93%, 48%);
|
border-color: hsl(var(--main-accent), 93%, 48%);
|
||||||
box-shadow: 0 1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
box-shadow: 0 1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
||||||
border-top: 1px solid transparent;
|
border-top: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-outline .form-control:focus~.form-notch .form-notch-trailing {
|
.form-outline .form-control:focus~.form-notch .form-notch-trailing {
|
||||||
border-color: hsl(var(--main-accent), 93%, 48%);
|
border-color: hsl(var(--main-accent), 93%, 48%);
|
||||||
box-shadow: 1px 0 0 0 hsl(var(--main-accent), 93%, 48%), 0 -1px 0 0 hsl(var(--main-accent), 93%, 48%), 0 1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
box-shadow: 1px 0 0 0 hsl(var(--main-accent), 93%, 48%), 0 -1px 0 0 hsl(var(--main-accent), 93%, 48%), 0 1px 0 0 hsl(var(--main-accent), 93%, 48%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-outline .form-control:focus~.form-label {
|
.form-outline .form-control:focus~.form-label {
|
||||||
color: hsl(var(--main-accent), 93%, 48%);
|
color: hsl(var(--main-accent), 93%, 48%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-accent,
|
.btn-accent,
|
||||||
.btn-accent:active {
|
.btn-accent:active {
|
||||||
background: hsl(var(--main-accent), 93%, 48%);
|
background: hsl(var(--main-accent), 93%, 48%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-accent:hover {
|
.btn-accent:hover {
|
||||||
background: hsl(var(--main-accent), 93%, 42%);
|
background: hsl(var(--main-accent), 93%, 42%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-grey,
|
.btn-grey,
|
||||||
.btn-grey:active {
|
.btn-grey:active {
|
||||||
background: #727272;
|
background: #727272;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-grey:hover {
|
.btn-grey:hover {
|
||||||
background: #626262;
|
background: #626262;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-grouped {
|
.btn-grouped {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 50px;
|
gap: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clickable {
|
.clickable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader {
|
.loader {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0px auto;
|
margin: 0px auto;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
transform: scale(0.5);
|
transform: scale(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader:before {
|
.loader:before {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 100%;
|
padding-top: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.circular-loader {
|
.circular-loader {
|
||||||
-webkit-animation: rotate 2s linear infinite;
|
-webkit-animation: rotate 2s linear infinite;
|
||||||
animation: rotate 2s linear infinite;
|
animation: rotate 2s linear infinite;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-transform-origin: center center;
|
-webkit-transform-origin: center center;
|
||||||
-ms-transform-origin: center center;
|
-ms-transform-origin: center center;
|
||||||
transform-origin: center center;
|
transform-origin: center center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader-path {
|
.loader-path {
|
||||||
stroke-dasharray: 150, 200;
|
stroke-dasharray: 150, 200;
|
||||||
stroke-dashoffset: -10;
|
stroke-dashoffset: -10;
|
||||||
-webkit-animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
|
-webkit-animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
|
||||||
animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
|
animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
|
||||||
stroke-linecap: round;
|
stroke-linecap: round;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes rotate {
|
@-webkit-keyframes rotate {
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(360deg);
|
-webkit-transform: rotate(360deg);
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotate {
|
@keyframes rotate {
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(360deg);
|
-webkit-transform: rotate(360deg);
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes dash {
|
@-webkit-keyframes dash {
|
||||||
0% {
|
0% {
|
||||||
stroke-dasharray: 1, 200;
|
stroke-dasharray: 1, 200;
|
||||||
stroke-dashoffset: 0;
|
stroke-dashoffset: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
stroke-dasharray: 89, 200;
|
stroke-dasharray: 89, 200;
|
||||||
stroke-dashoffset: -35;
|
stroke-dashoffset: -35;
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
stroke-dasharray: 89, 200;
|
stroke-dasharray: 89, 200;
|
||||||
stroke-dashoffset: -124;
|
stroke-dashoffset: -124;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes dash {
|
@keyframes dash {
|
||||||
0% {
|
0% {
|
||||||
stroke-dasharray: 1, 200;
|
stroke-dasharray: 1, 200;
|
||||||
stroke-dashoffset: 0;
|
stroke-dashoffset: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
stroke-dasharray: 89, 200;
|
stroke-dasharray: 89, 200;
|
||||||
stroke-dashoffset: -35;
|
stroke-dashoffset: -35;
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
stroke-dasharray: 89, 200;
|
stroke-dasharray: 89, 200;
|
||||||
stroke-dashoffset: -124;
|
stroke-dashoffset: -124;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes color {
|
@-webkit-keyframes color {
|
||||||
0% {
|
0% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
40% {
|
40% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
66% {
|
66% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
80%,
|
80%,
|
||||||
90% {
|
90% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes color {
|
@keyframes color {
|
||||||
0% {
|
0% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
40% {
|
40% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
66% {
|
66% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
80%,
|
80%,
|
||||||
90% {
|
90% {
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -346,12 +346,17 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0.25em;
|
border-radius: 0.25em;
|
||||||
background: initial;
|
background: initial;
|
||||||
background-color: #7066e0;
|
background: hsl(var(--main-accent), 93%, 48%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
transition: all .35s ease;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
.swal2-styled.swal2-confirm:hover {
|
||||||
|
background: hsl(var(--main-accent), 93%, 42%);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
.swal2-styled.swal2-confirm:focus {
|
.swal2-styled.swal2-confirm:focus {
|
||||||
box-shadow: 0 0 0 3px rgba(112, 102, 224, 0.5);
|
box-shadow: 0 0 0 0px rgba(112, 102, 224, 0.0);
|
||||||
}
|
}
|
||||||
.swal2-styled.swal2-deny {
|
.swal2-styled.swal2-deny {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const configFolder = path.join(process.env['LOCALAPPDATA'], 'EZPPLauncher');
|
const configFolder = path.join(process.platform == "win32" ? process.env['LOCALAPPDATA'] : process.env['HOME'], 'EZPPLauncher');
|
||||||
if (!fs.existsSync(configFolder)) fs.mkdirSync(configFolder);
|
if (!fs.existsSync(configFolder)) fs.mkdirSync(configFolder);
|
||||||
|
|
||||||
const configLocation = path.join(configFolder, `ezpplauncher.${path.basename(process.env['USERNAME'])}.cfg`);
|
const configLocation = path.join(configFolder, `ezpplauncher.${path.basename(process.env['USERNAME'])}.cfg`);
|
||||||
if (!fs.existsSync(configLocation)) fs.writeFileSync(configLocation, "");
|
if (!fs.existsSync(configLocation)) fs.writeFileSync(configLocation, "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function get(key, defaultValue) {
|
async function get(key, defaultValue) {
|
||||||
const fileStream = await fs.promises.readFile(configLocation, "utf-8");
|
const fileStream = await fs.promises.readFile(configLocation, "utf-8");
|
||||||
const lines = fileStream.split(/\r?\n/)
|
const lines = fileStream.split(/\r?\n/)
|
||||||
@@ -69,4 +68,4 @@ async function remove(key) {
|
|||||||
await fs.promises.writeFile(configLocation, arr.join('\n'));
|
await fs.promises.writeFile(configLocation, arr.join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { get, set, remove }
|
module.exports = { get, set, remove, configFolder }
|
59
discordPresence.js
Normal file
59
discordPresence.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
const appInfo = require('./appInfo.js');
|
||||||
|
const DiscordAutoRPC = require("discord-auto-rpc");
|
||||||
|
const clientId = "1032772293220384808";
|
||||||
|
let client = undefined;
|
||||||
|
let lastState = "Idle in Launcher...";
|
||||||
|
let presenceEnabled = true;
|
||||||
|
let startDate = new Date();
|
||||||
|
const actionButtons = [
|
||||||
|
{
|
||||||
|
label: "Download the Launcher",
|
||||||
|
url: "https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Join EZPPFarm",
|
||||||
|
url: "https://ez-pp.farm/discord"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
let lastActivity = {
|
||||||
|
details: " ",
|
||||||
|
state: lastState,
|
||||||
|
startTimestamp: startDate,
|
||||||
|
largeImageKey: "ezppfarm",
|
||||||
|
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
||||||
|
buttons: actionButtons,
|
||||||
|
instance: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
connect: () => {
|
||||||
|
if (client === undefined) {
|
||||||
|
client = new DiscordAutoRPC.AutoClient({ transport: "ipc" });
|
||||||
|
client.endlessLogin({ clientId: clientId });
|
||||||
|
client.once("ready", () => {
|
||||||
|
setInterval(() => {
|
||||||
|
if (lastActivity !== undefined)
|
||||||
|
lastActivity.state = lastState;
|
||||||
|
client.setActivity(presenceEnabled ? lastActivity : undefined);
|
||||||
|
}, 2500);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enablePresence: () => presenceEnabled = true,
|
||||||
|
disablePresence: () => presenceEnabled = false,
|
||||||
|
updateStartDate: () => startDate = new Date(),
|
||||||
|
updateState: (state) => lastState = state,
|
||||||
|
updateStatus: (details, osuVersion) => {
|
||||||
|
lastActivity = {
|
||||||
|
details: details ? details : " ",
|
||||||
|
state: lastState,
|
||||||
|
startTimestamp: startDate,
|
||||||
|
smallImageKey: osuVersion ? "osu" : " ",
|
||||||
|
smallImageText: osuVersion ? osuVersion : " ",
|
||||||
|
largeImageKey: "ezppfarm",
|
||||||
|
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
||||||
|
buttons: actionButtons,
|
||||||
|
instance: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
ezppUtil.js
12
ezppUtil.js
@@ -1,10 +1,18 @@
|
|||||||
const axios = require('axios').default;
|
const axios = require('axios').default;
|
||||||
|
|
||||||
const loginCheckEndpoint = 'https://new.ez-pp.farm/login/check';
|
const loginCheckEndpoint = 'https://ez-pp.farm/login/check';
|
||||||
|
let retries = 0;
|
||||||
|
|
||||||
const performLogin = async (username, password) => {
|
const performLogin = async (username, password) => {
|
||||||
const result = await axios.post(loginCheckEndpoint, { username, password });
|
const result = await axios.post(loginCheckEndpoint, { username, password });
|
||||||
return result.data;
|
const code = result.data.code ?? 404;
|
||||||
|
if (code === 200 || code === 403) {
|
||||||
|
retries = 0;
|
||||||
|
return result.data;
|
||||||
|
} else {
|
||||||
|
if (retries++ >= 5) return { code: 403, message: "Login failed." }
|
||||||
|
return await performLogin(username, password);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { performLogin };
|
module.exports = { performLogin };
|
@@ -8,6 +8,7 @@
|
|||||||
<link rel="icon" type="image/png" href="../assets/logo.png" />
|
<link rel="icon" type="image/png" href="../assets/logo.png" />
|
||||||
<link href="../assets/mdb.min.css" rel="stylesheet" />
|
<link href="../assets/mdb.min.css" rel="stylesheet" />
|
||||||
<link href="../assets/launcher.css" rel="stylesheet" />
|
<link href="../assets/launcher.css" rel="stylesheet" />
|
||||||
|
<link href="../assets/checkbox.css" rel="stylesheet" />
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
<div class="launcher-window position-relative overflow-hidden">
|
<div class="launcher-window position-relative overflow-hidden">
|
||||||
<div class="container px-1 py-2 w-100 mw-100 h-100">
|
<div class="container px-1 py-2 w-100 mw-100 h-100">
|
||||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||||
<div id="loading-page" class="sections col col-xl-10" style="//display: none;">
|
<div id="loading-page" class="sections col col-xl-10">
|
||||||
<div class="launch-section flex-row">
|
<div class="launch-section flex-row">
|
||||||
<div class="server-logo">
|
<div class="server-logo">
|
||||||
<img src="../assets/logo.png" height="120">
|
<img src="../assets/logo.png" height="120">
|
||||||
@@ -47,7 +48,6 @@
|
|||||||
<div id="launch-page" class="sections col col-xl-10" style="display: none;">
|
<div id="launch-page" class="sections col col-xl-10" style="display: none;">
|
||||||
<div class="account-section">
|
<div class="account-section">
|
||||||
<div class="user-image">
|
<div class="user-image">
|
||||||
<img id="user-img" src="https://a.ez-pp.farm/0">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div class="welcome-text" id="welcome-text">
|
<div class="welcome-text" id="welcome-text">
|
||||||
@@ -62,8 +62,13 @@
|
|||||||
<div class="server-logo">
|
<div class="server-logo">
|
||||||
<img src="../assets/logo.png" height="150">
|
<img src="../assets/logo.png" height="150">
|
||||||
</div>
|
</div>
|
||||||
<div class="launch-button">
|
<div class="launch-button-section">
|
||||||
<button class="btn btn-lg btn-launch btn-accent" id="launch-btn">Launch</button>
|
<button class="btn btn-lg btn-launch btn-accent" id="launch-btn">Launch</button>
|
||||||
|
<div class="patch-checkbox" style="display: none;">
|
||||||
|
<input type="checkbox" id="enablePatching" disabled />
|
||||||
|
<label for="enablePatching" style="display: initial;">enable
|
||||||
|
Patching</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="folder-section">
|
<div class="folder-section">
|
||||||
@@ -71,7 +76,7 @@
|
|||||||
Current osu! directory: <span id="currentOsuPath"></span>
|
Current osu! directory: <span id="currentOsuPath"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="folder-action" id="change-folder-btn">
|
<div class="folder-action" id="change-folder-btn">
|
||||||
Not right?
|
Not correct?
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -88,7 +93,8 @@
|
|||||||
<label class="form-label" for="login-username">Username</label>
|
<label class="form-label" for="login-username">Username</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-outline mb-3 w-50">
|
<div class="form-outline mb-3 w-50">
|
||||||
<input type="password" id="login-password" class="form-control form-control-lg" />
|
<input type="password" id="login-password"
|
||||||
|
class="form-control form-control-lg" />
|
||||||
<label class="form-label" for="login-password">Password</label>
|
<label class="form-label" for="login-password">Password</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-1 mb-4">
|
<div class="pt-1 mb-4">
|
||||||
@@ -109,6 +115,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript" src="../assets/mdb.min.js"></script>
|
<script type="text/javascript" src="../assets/mdb.min.js"></script>
|
||||||
|
|
||||||
</html>
|
</html>
|
@@ -1,62 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>EZPPLauncher</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<link rel="icon" type="image/png" href="../assets/logo.png" />
|
|
||||||
<link href="../assets/mdb.min.css" rel="stylesheet" />
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="fixed-sn mdb-skin-custom" data-spy="scroll" data-target="#scrollspy" data-offset="15"
|
|
||||||
oncontextmenu="return false;">
|
|
||||||
<main>
|
|
||||||
<div class="noselect">
|
|
||||||
<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center text-lg-end d-flex align-items-center justify-content-center"
|
|
||||||
style="border-radius: 0.5em;">
|
|
||||||
<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3">
|
|
||||||
<div class="container py-2 h-100">
|
|
||||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
|
||||||
<div class="col col-xl-10">
|
|
||||||
<div class="card" style="border-radius: 1rem;">
|
|
||||||
<div class="row g-0">
|
|
||||||
<div class="card-body p-4 p-lg-5 text-black">
|
|
||||||
<div class="d-flex align-items-center mb-2 pb-1 text-white">
|
|
||||||
<span class="h1 fw-bold mb-0">EZPPLauncher</span>
|
|
||||||
</div>
|
|
||||||
<h5 class="fw-lighter fs-5 mb-3 pb-3 text-white text-start"
|
|
||||||
style="letter-spacing: 1px;">
|
|
||||||
Launch osu! with connection to the EZPPFarm server
|
|
||||||
</h5>
|
|
||||||
<div class="pt-1 mb-4">
|
|
||||||
<button id="launch-btn" class="btn btn-primary btn-lg btn-block"
|
|
||||||
type="button" style="background-color:#d6016f" disabled>Looking for
|
|
||||||
updates...</button>
|
|
||||||
</div>
|
|
||||||
<button class="btn btn-dark btn-sm float-start" id="account-btn" disabled>
|
|
||||||
set account
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-dark btn-sm float-end" id="folder-btn">
|
|
||||||
set osu! directory
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
<script type="text/javascript" src="../assets/mdb.min.js"></script>
|
|
||||||
|
|
||||||
</html>
|
|
17
osUtil.js
Normal file
17
osUtil.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
const getLinuxDistroInfo = async() => {
|
||||||
|
let os = await fs.promises.readFile('/etc/os-release', 'utf8')
|
||||||
|
let opj = {}
|
||||||
|
|
||||||
|
os?.split('\n')?.forEach((line, index) => {
|
||||||
|
let words = line?.split('=')
|
||||||
|
let key = words[0]?.toLowerCase()
|
||||||
|
if (key === '') return
|
||||||
|
let value = words[1]?.replace(/"/g, '')
|
||||||
|
opj[key] = value
|
||||||
|
})
|
||||||
|
return opj;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { getLinuxDistroInfo };
|
379
osuUtil.js
379
osuUtil.js
@@ -3,181 +3,284 @@ const fu = require('./fileUtil');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const axios = require('axios').default;
|
const axios = require('axios').default;
|
||||||
const dpapi = require('wincrypt');
|
|
||||||
const executeUtil = require('./executeUtil');
|
const executeUtil = require('./executeUtil');
|
||||||
const { EventEmitter } = require('events');
|
const { EventEmitter } = require('events');
|
||||||
const { DownloaderHelper } = require('node-downloader-helper');
|
const { DownloaderHelper } = require('node-downloader-helper');
|
||||||
|
|
||||||
const checkUpdateURL = "https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
|
const checkUpdateURL = "https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
|
||||||
const osuEncryptBuffer = Buffer.from('cu24180ncjeiu0ci1nwui', "utf-8")
|
const customUIDLLPath = "https://ez-pp.farm/assets/ezpp!ui.dll";
|
||||||
|
const customUIDLLHash = "https://ez-pp.farm/assets/ezpp!ui.md5";
|
||||||
|
const customUIDLLName = "ezpp!ui.dll";
|
||||||
|
const ignoredOsuEntities = [
|
||||||
|
'osu!auth.dll',
|
||||||
|
]
|
||||||
const osuEntities = [
|
const osuEntities = [
|
||||||
'avcodec-51.dll',
|
'avcodec-51.dll',
|
||||||
'avformat-52.dll',
|
'avformat-52.dll',
|
||||||
'avutil-49.dll',
|
'avutil-49.dll',
|
||||||
'bass.dll',
|
'bass.dll',
|
||||||
'bass_fx.dll',
|
'bass_fx.dll',
|
||||||
'collection.db',
|
'collection.db',
|
||||||
'd3dcompiler_47.dll',
|
'd3dcompiler_47.dll',
|
||||||
'Data',
|
'libEGL.dll',
|
||||||
'Downloads',
|
'libGLESv2.dll',
|
||||||
'libEGL.dll',
|
'Microsoft.Ink.dll',
|
||||||
'libGLESv2.dll',
|
'OpenTK.dll',
|
||||||
'Logs',
|
'osu!.cfg',
|
||||||
'Microsoft.Ink.dll',
|
'osu!.db',
|
||||||
'OpenTK.dll',
|
'osu!.exe',
|
||||||
'osu!.cfg',
|
'osu!auth.dll',
|
||||||
'osu!.db',
|
'osu!gameplay.dll',
|
||||||
'osu!.exe',
|
'osu!seasonal.dll',
|
||||||
'osu!auth.dll',
|
'osu!ui.dll',
|
||||||
'osu!gameplay.dll',
|
'presence.db',
|
||||||
'osu!seasonal.dll',
|
'pthreadGC2.dll',
|
||||||
'osu!ui.dll',
|
'scores.db',
|
||||||
'presence.db',
|
|
||||||
'pthreadGC2.dll',
|
|
||||||
'scores.db',
|
|
||||||
'Skins',
|
|
||||||
'Songs'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
async function isValidOsuFolder(path) {
|
async function isValidOsuFolder(path) {
|
||||||
const allFiles = await fs.promises.readdir(path);
|
const allFiles = await fs.promises.readdir(path);
|
||||||
let matches = 0;
|
let matches = 0;
|
||||||
for (const file of allFiles) {
|
for (const file of allFiles) {
|
||||||
if (osuEntities.includes(file)) matches = matches + 1;
|
if (osuEntities.includes(file)) matches = matches + 1;
|
||||||
}
|
}
|
||||||
return Math.round((matches / osuEntities.length) * 100) >= 60;
|
return Math.round((matches / osuEntities.length) * 100) >= 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getLatestConfig(osuPath) {
|
async function getLatestConfig(osuPath) {
|
||||||
const configFileInfo = {
|
const configFileInfo = {
|
||||||
name: "",
|
name: "",
|
||||||
path: "",
|
path: "",
|
||||||
get: async (key) => {
|
get: async (key) => {
|
||||||
if (!configFileInfo.path)
|
if (!configFileInfo.path)
|
||||||
return "";
|
return "";
|
||||||
const fileStream = await fs.promises.readFile(configFileInfo.path, "utf-8");
|
const fileStream = await fs.promises.readFile(configFileInfo.path, "utf-8");
|
||||||
const lines = fileStream.split(/\r?\n/)
|
const lines = fileStream.split(/\r?\n/)
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.includes(' = ')) {
|
if (line.includes(' = ')) {
|
||||||
const argsPair = line.split(' = ', 2);
|
const argsPair = line.split(' = ', 2);
|
||||||
const keyname = argsPair[0]
|
const keyname = argsPair[0]
|
||||||
const value = argsPair[1];
|
const value = argsPair[1];
|
||||||
if (keyname == key) {
|
if (keyname == key) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const userOsuConfig = path.join(osuPath, `osu!.${process.env['USERNAME']}.cfg`)
|
}
|
||||||
if (fs.existsSync(userOsuConfig)) {
|
const userOsuConfig = path.join(osuPath, `osu!.${process.env['USERNAME']}.cfg`)
|
||||||
configFileInfo.name = `osu!.${process.env['USERNAME']}.cfg`;
|
if (fs.existsSync(userOsuConfig)) {
|
||||||
configFileInfo.path = userOsuConfig;
|
configFileInfo.name = `osu!.${process.env['USERNAME']}.cfg`;
|
||||||
}
|
configFileInfo.path = userOsuConfig;
|
||||||
return configFileInfo;
|
}
|
||||||
|
return configFileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getUpdateFiles(releaseStream) {
|
async function getUpdateFiles(releaseStream) {
|
||||||
const releaseData = await axios.get(checkUpdateURL + releaseStream, {});
|
const releaseData = await axios.get(checkUpdateURL + releaseStream, {});
|
||||||
return releaseData.data;
|
return releaseData.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getEZPPUIMD5() {
|
||||||
|
const releaseData = await axios.get(customUIDLLHash, {});
|
||||||
|
return releaseData.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function filesThatNeedUpdate(osuPath, updateFiles) {
|
async function filesThatNeedUpdate(osuPath, updateFiles) {
|
||||||
const filesToDownload = [];
|
const filesToDownload = [];
|
||||||
for (const updatedFile of updateFiles) {
|
for (const updatedFile of updateFiles) {
|
||||||
const fileName = updatedFile.filename;
|
let fileName = updatedFile.filename;
|
||||||
const fileHash = updatedFile.file_hash;
|
let fileHash = updatedFile.file_hash;
|
||||||
const fileURL = updatedFile.url_full;
|
let fileURL = updatedFile.url_full;
|
||||||
|
|
||||||
const fileOnDisk = path.join(osuPath, fileName);
|
if ("url_patch" in updatedFile && updatedFile.url_patch != undefined) {
|
||||||
if (await fu.existsAsync(fileOnDisk)) {
|
const stripped = updatedFile.url_patch.split("_");
|
||||||
const binaryFileContents = await fs.promises.readFile(fileOnDisk);
|
fileHash = stripped[stripped.length - 1];
|
||||||
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex");
|
const lastIndex = fileURL.lastIndexOf("/");
|
||||||
if (existingFileMD5.toLowerCase() != fileHash.toLowerCase()) {
|
const baseUrl = fileURL.slice(0, lastIndex);
|
||||||
filesToDownload.push({
|
fileURL = baseUrl + "/f_" + fileHash;
|
||||||
fileName,
|
|
||||||
fileURL
|
|
||||||
})
|
|
||||||
//console.log("hashes are not matching", `(${existingFileMD5} - ${fileHash})`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
filesToDownload.push({
|
|
||||||
fileName,
|
|
||||||
fileURL
|
|
||||||
});
|
|
||||||
//console.log("new file " + fileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return filesToDownload;
|
|
||||||
|
if (ignoredOsuEntities.includes(fileName)) continue;
|
||||||
|
|
||||||
|
const fileOnDisk = path.join(osuPath, fileName);
|
||||||
|
if (await fu.existsAsync(fileOnDisk)) {
|
||||||
|
const binaryFileContents = await fs.promises.readFile(fileOnDisk);
|
||||||
|
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex");
|
||||||
|
if (existingFileMD5.toLowerCase() != fileHash.toLowerCase()) {
|
||||||
|
filesToDownload.push({
|
||||||
|
fileName,
|
||||||
|
fileURL
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filesToDownload.push({
|
||||||
|
fileName,
|
||||||
|
fileURL
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ezppUI = path.join(osuPath, "EZPPLauncher", customUIDLLName);
|
||||||
|
if (await fu.existsAsync(ezppUI)) {
|
||||||
|
const latestMd5Hash = await getEZPPUIMD5();
|
||||||
|
const binaryUIContents = await fs.promises.readFile(ezppUI);
|
||||||
|
const existingUIMD5 = crypto.createHash("md5").update(binaryUIContents).digest("hex");
|
||||||
|
if (existingUIMD5 != latestMd5Hash) {
|
||||||
|
filesToDownload.push({
|
||||||
|
folder: "EZPPLauncher",
|
||||||
|
fileName: "ezpp!ui.dll",
|
||||||
|
fileURL: customUIDLLPath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filesToDownload.push({
|
||||||
|
folder: "EZPPLauncher",
|
||||||
|
fileName: "ezpp!ui.dll",
|
||||||
|
fileURL: customUIDLLPath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return filesToDownload;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadUpdateFiles(osuPath, filesToUpdate) {
|
async function downloadUpdateFiles(osuPath, filesToUpdate) {
|
||||||
const eventEmitter = new EventEmitter();
|
const eventEmitter = new EventEmitter();
|
||||||
let completedIndex = 0;
|
let completedIndex = 0;
|
||||||
filesToUpdate.forEach(async (fileToUpdate) => {
|
filesToUpdate.forEach(async (fileToUpdate) => {
|
||||||
const filePath = path.join(osuPath, fileToUpdate.fileName);
|
|
||||||
console.log(filePath);
|
|
||||||
if (await fu.existsAsync(filePath))
|
|
||||||
await fs.promises.rm(filePath);
|
|
||||||
|
|
||||||
const fileDownload = new DownloaderHelper(fileToUpdate.fileURL, osuPath, {
|
if ("folder" in fileToUpdate) {
|
||||||
fileName: fileToUpdate.fileName,
|
osuPath = path.join(osuPath, fileToUpdate.folder);
|
||||||
override: true,
|
if (!(await fu.existsAsync(osuPath))) await fs.promises.mkdir(osuPath);
|
||||||
});
|
}
|
||||||
fileDownload.on('end', () => {
|
|
||||||
completedIndex = completedIndex + 1;
|
|
||||||
if (completedIndex >= filesToUpdate.length)
|
|
||||||
eventEmitter.emit('completed');
|
|
||||||
});
|
|
||||||
fileDownload.on('error', (err) => {
|
|
||||||
console.log(err);
|
|
||||||
eventEmitter.emit('error');
|
|
||||||
});
|
|
||||||
|
|
||||||
fileDownload.start().catch(err => console.error(err));
|
const filePath = path.join(osuPath, fileToUpdate.fileName);
|
||||||
|
if (await fu.existsAsync(filePath))
|
||||||
|
await fs.promises.rm(filePath);
|
||||||
|
|
||||||
|
const fileDownload = new DownloaderHelper(fileToUpdate.fileURL, osuPath, {
|
||||||
|
fileName: fileToUpdate.fileName,
|
||||||
|
override: true,
|
||||||
|
});
|
||||||
|
fileDownload.on('end', () => {
|
||||||
|
completedIndex = completedIndex + 1;
|
||||||
|
if (completedIndex >= filesToUpdate.length)
|
||||||
|
eventEmitter.emit('completed');
|
||||||
|
});
|
||||||
|
fileDownload.on('error', (err) => {
|
||||||
|
console.log(err);
|
||||||
|
eventEmitter.emit('error');
|
||||||
});
|
});
|
||||||
|
|
||||||
return eventEmitter;
|
fileDownload.start().catch(err => console.error(err));
|
||||||
|
});
|
||||||
|
|
||||||
|
return eventEmitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startWithDevServer(osuPath, serverDomain, onExit) {
|
async function startWithDevServer(osuPath, serverDomain, onExit) {
|
||||||
const osuExe = path.join(osuPath, "osu!.exe");
|
const osuExe = path.join(osuPath, "osu!.exe");
|
||||||
if (!await fu.existsAsync(osuExe)) return false;
|
if (!await fu.existsAsync(osuExe)) return false;
|
||||||
executeUtil.runFile(osuPath, osuExe, ["-devserver", serverDomain], onExit);
|
switch (process.platform) {
|
||||||
return true;
|
case "linux":
|
||||||
}
|
executeUtil.runFile(osuPath, 'osu-stable', ["-devserver", serverDomain], onExit);
|
||||||
|
return true;
|
||||||
async function encryptString(value) {
|
case "win32":
|
||||||
return Buffer.from(await dpapi.protect(Buffer.from(value, 'utf-8'), osuEncryptBuffer, 'CurrentUser'), 'utf-8').toString('base64');
|
executeUtil.runFile(osuPath, osuExe, ["-devserver", serverDomain], onExit);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
async function decryptString(value) {
|
return false;
|
||||||
const decrypted = await dpapi.unprotect(Buffer.from(value, 'base64'), osuEncryptBuffer, 'CurrentUser');
|
|
||||||
return decrypted.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setConfigValue(configPath, key, value) {
|
async function setConfigValue(configPath, key, value) {
|
||||||
const configLines = new Array();
|
const configLines = new Array();
|
||||||
const fileStream = await fs.promises.readFile(configPath, "utf-8");
|
const fileStream = await fs.promises.readFile(configPath, "utf-8");
|
||||||
const lines = fileStream.split(/\r?\n/)
|
const lines = fileStream.split(/\r?\n/)
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.includes(' = ')) {
|
if (line.includes(' = ')) {
|
||||||
const argsPair = line.split(' = ', 2);
|
const argsPair = line.split(' = ', 2);
|
||||||
const keyname = argsPair[0].trim();
|
const keyname = argsPair[0].trim();
|
||||||
if (key == keyname) {
|
if (key == keyname) {
|
||||||
configLines.push(`${keyname} = ${value}`);
|
configLines.push(`${keyname} = ${value}`);
|
||||||
} else {
|
} else {
|
||||||
configLines.push(line);
|
configLines.push(line);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
configLines.push(line);
|
configLines.push(line);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await fs.promises.writeFile(configPath, configLines.join("\n"), 'utf-8');
|
}
|
||||||
|
await fs.promises.writeFile(configPath, configLines.join("\n"), 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateOsuCfg(cfgPath) {
|
||||||
|
const osuFolder = path.dirname(cfgPath);
|
||||||
|
const fileStream = await fs.promises.readFile(cfgPath, "utf-8");
|
||||||
|
const lines = fileStream.split(/\r?\n/);
|
||||||
|
const newLines = [];
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes(' = ')) {
|
||||||
|
const argsPair = line.split(' = ', 2);
|
||||||
|
const keyname = argsPair[0]
|
||||||
|
const value = argsPair[1];
|
||||||
|
|
||||||
|
if (keyname.startsWith("h_")) {
|
||||||
|
const filename = keyname.substring(2, keyname.length);
|
||||||
|
const filepath = path.join(osuFolder, 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(`${keyname} = ${existingFileMD5}`);
|
||||||
|
} else {
|
||||||
|
newLines.push(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ezppUI = path.join(osuFolder, customUIDLLName);
|
||||||
|
if (fs.existsSync(ezppUI)) {
|
||||||
|
const binaryFileContents = await fs.promises.readFile(ezppUI);
|
||||||
|
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex");
|
||||||
|
newLines.push(`h_${customUIDLLName} = ${existingFileMD5}`);
|
||||||
|
}
|
||||||
|
await fs.promises.writeFile(cfgPath, newLines.join("\n"), 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findOsuInstallation() {
|
||||||
|
const regedit = require('qiao-regedit');
|
||||||
|
|
||||||
|
const osuLocationFromDefaultIcon = "HKLM\\SOFTWARE\\Classes\\osu\\DefaultIcon";
|
||||||
|
const osuStruct = await regedit.listValuesSync(osuLocationFromDefaultIcon);
|
||||||
|
for (const line of osuStruct.split("\n")) {
|
||||||
|
if (line.includes("REG_SZ")) {
|
||||||
|
let value = (line.trim().split(" ")[2]);
|
||||||
|
value = value.substring(1, value.length - 3);
|
||||||
|
return path.dirname(value.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function replaceUI(folder, isStart) {
|
||||||
|
const ezppUIFile = path.join(folder, "EZPPLauncher", customUIDLLName);
|
||||||
|
const osuUIFile = path.join(folder, "osu!ui.dll");
|
||||||
|
const osuUIFileBackup = path.join(folder, "osu!ui.dll.bak");
|
||||||
|
if (isStart) {
|
||||||
|
if (fs.existsSync(osuUIFileBackup)) await fs.promises.unlink(osuUIFileBackup);
|
||||||
|
await fs.promises.rename(osuUIFile, osuUIFileBackup);
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
await fs.promises.copyFile(ezppUIFile, osuUIFile);
|
||||||
|
} else {
|
||||||
|
if (!fs.existsSync(osuUIFileBackup)) return;
|
||||||
|
await fs.promises.unlink(osuUIFile);
|
||||||
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
|
await fs.promises.rename(osuUIFileBackup, osuUIFile);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
||||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
||||||
encryptString, decryptString
|
findOsuInstallation, replaceUI, updateOsuCfg, getEZPPUIMD5
|
||||||
}
|
}
|
3963
package-lock.json
generated
Normal file
3963
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
package.json
29
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ezpplauncher",
|
"name": "ezpplauncher",
|
||||||
"version": "1.1.0",
|
"version": "1.1.5",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "HorizonCode",
|
"author": "HorizonCode",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"runAfterFinish": true
|
"runAfterFinish": true
|
||||||
},
|
},
|
||||||
"portable": {
|
"portable": {
|
||||||
"artifactName": "EZPPLauncher.exe"
|
"artifactName": "ezpplauncher-${version}.exe"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"frontend": {
|
"frontend": {
|
||||||
@@ -32,27 +32,28 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"test": "electron ./test/encrypt.js",
|
"rebuild": "electron-rebuild -f -w get-window-by-name",
|
||||||
"rebuild": "electron-rebuild -f -w wincrypt",
|
"pack-win": "electron-builder --win --x64",
|
||||||
"pack-win": "electron-builder --x64",
|
"pack-linux": "electron-builder --linux --x64",
|
||||||
"pack-win32": "electron-builder --ia32",
|
"pack-mac": "electron-builder --mac --x64",
|
||||||
"pack-winarm": "electron-builder --arm64",
|
|
||||||
"pack-linux": "electron-builder --dir --linux --ia32 --arm64 --x64",
|
|
||||||
"pack-mac": "electron-builder --dir --mac --ia32 --arm64 --x64",
|
|
||||||
"dist": "electron-builder"
|
"dist": "electron-builder"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^21.1.1",
|
"electron": "^24.2.0",
|
||||||
"electron-builder": "^23.0.3",
|
"electron-builder": "^23.6.0",
|
||||||
"electron-packager": "^15.5.1",
|
"electron-packager": "^17.1.1",
|
||||||
"electron-rebuild": "^3.2.9"
|
"electron-rebuild": "^3.2.9"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
"compare-versions": "^6.0.0-rc.1",
|
||||||
"custom-electron-titlebar": "^4.1.1",
|
"custom-electron-titlebar": "^4.1.1",
|
||||||
|
"discord-auto-rpc": "^1.0.17",
|
||||||
|
"discord-rpc": "^4.0.1",
|
||||||
|
"get-window-by-name": "^2.0.0",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"node-downloader-helper": "^2.1.4",
|
"node-downloader-helper": "^2.1.4",
|
||||||
"sweetalert2": "^11.5.2",
|
"qiao-regedit": "^0.1.5",
|
||||||
"wincrypt": "^1.5.0"
|
"sweetalert2": "^11.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,192 +1,278 @@
|
|||||||
const { ipcRenderer } = require('electron');
|
const { ipcRenderer, shell } = require('electron');
|
||||||
const { Titlebar, Color } = require('custom-electron-titlebar');
|
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
|
||||||
const appInfo = require('../appInfo');
|
const appInfo = require('../appInfo');
|
||||||
let titlebar;
|
|
||||||
let currentPage = "loading";
|
let currentPage = "loading";
|
||||||
let loggedIn = false;
|
let loggedIn = false;
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
titlebar = new Titlebar({
|
const titlebar = new Titlebar({
|
||||||
backgroundColor: Color.fromHex("#303030"),
|
backgroundColor: TitlebarColor.fromHex("#24283B"),
|
||||||
itemBackgroundColor: Color.fromHex("#121212"),
|
itemBackgroundColor: TitlebarColor.fromHex("#121212"),
|
||||||
menu: null,
|
menu: null,
|
||||||
maximizable: false
|
enableMnemonics: false,
|
||||||
});
|
maximizable: false,
|
||||||
|
});
|
||||||
|
|
||||||
titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`);
|
titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`);
|
||||||
|
|
||||||
const $ = require('jquery');
|
const $ = require('jquery');
|
||||||
const axios = require('axios').default;
|
const Swal = require('sweetalert2');
|
||||||
const Swal = require('sweetalert2');
|
|
||||||
|
|
||||||
$('#account-action').on('click', () => {
|
$('#account-action').on('click', () => {
|
||||||
if (!loggedIn) {
|
if (!loggedIn) {
|
||||||
changePage('login');
|
changePage('login');
|
||||||
|
} else {
|
||||||
|
$('#welcome-text').text(`Nice to see you!`);
|
||||||
|
$('#account-action').text('Click to login');
|
||||||
|
$('.user-image').css('background-image', `url(https://a.ez-pp.farm/0)`)
|
||||||
|
loggedIn = false;
|
||||||
|
ipcRenderer.send("perform-logout");
|
||||||
|
Swal.fire({
|
||||||
|
title: 'See ya soon!',
|
||||||
|
text: "Successfully logged out!",
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#action-cancel').on('click', () => {
|
||||||
|
if (!loggedIn) {
|
||||||
|
changePage('launch');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let currentState;
|
||||||
|
$("#launch-btn").on('click', async () => {
|
||||||
|
switch (currentState) {
|
||||||
|
case "up-to-date":
|
||||||
|
$("#launch-btn").attr('disabled', true);
|
||||||
|
$('#launch-btn').html('Launching...');
|
||||||
|
const result = await ipcRenderer.invoke("launch");
|
||||||
|
if (!result) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: "Something went wrong while launching!",
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
$("#launch-btn").attr('disabled', false);
|
||||||
|
$('#launch-btn').html('Launch');
|
||||||
} else {
|
} else {
|
||||||
$('#welcome-text').text(`Nice to see you!`);
|
$("#launch-btn").attr('disabled', true);
|
||||||
$('#account-action').text('Click to login');
|
$('#launch-btn').html('Running...');
|
||||||
$('#user-img').prop('src', `https://a.ez-pp.farm/0`)
|
|
||||||
loggedIn = false;
|
|
||||||
ipcRenderer.send("perform-logout");
|
|
||||||
Swal.fire({
|
|
||||||
title: 'See ya soon!',
|
|
||||||
text: "Successfully logged out!",
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'Okay'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
break;
|
||||||
|
case "update-available":
|
||||||
$('#action-cancel').on('click', () => {
|
$("#launch-btn").attr('disabled', true);
|
||||||
if (!loggedIn) {
|
$('#launch-btn').html('Updating...');
|
||||||
changePage('launch');
|
ipcRenderer.send("do-update");
|
||||||
}
|
break;
|
||||||
});
|
case "missing-folder":
|
||||||
|
|
||||||
let currentState;
|
|
||||||
$("#launch-btn").on('click', async () => {
|
|
||||||
switch (currentState) {
|
|
||||||
case "up-to-date":
|
|
||||||
$("#launch-btn").attr('disabled', true);
|
|
||||||
$('#launch-btn').html('Launching...');
|
|
||||||
const result = await ipcRenderer.invoke("launch");
|
|
||||||
if (!result) {
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Uh oh!',
|
|
||||||
text: "Something went wrong while launching!",
|
|
||||||
icon: 'error',
|
|
||||||
confirmButtonText: 'Okay'
|
|
||||||
});
|
|
||||||
$("#launch-btn").attr('disabled', false);
|
|
||||||
$('#launch-btn').html('Launch');
|
|
||||||
} else {
|
|
||||||
$("#launch-btn").attr('disabled', true);
|
|
||||||
$('#launch-btn').html('Running...');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "update-available":
|
|
||||||
$("#launch-btn").attr('disabled', true);
|
|
||||||
$('#launch-btn').html('Updating...');
|
|
||||||
ipcRenderer.send("do-update");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#action-login").on('click', async () => {
|
|
||||||
const username = $('#login-username').val();
|
|
||||||
const password = $('#login-password').val();
|
|
||||||
$("#action-login").attr('disabled', true);
|
|
||||||
$("#action-cancel").attr('disabled', true);
|
|
||||||
const responseData = await ipcRenderer.invoke('perform-login', { username, password });
|
|
||||||
$("#action-login").attr('disabled', false);
|
|
||||||
$("#action-cancel").attr('disabled', false);
|
|
||||||
if (!responseData)
|
|
||||||
return;
|
|
||||||
if (responseData.code != 200) {
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Uh oh!',
|
|
||||||
text: responseData.message,
|
|
||||||
icon: 'error',
|
|
||||||
confirmButtonText: 'Oops.. my bad!'
|
|
||||||
})
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$('#login-username').val("");
|
|
||||||
$('#login-password').val("");
|
|
||||||
$('#welcome-text').text(`Welcome back, ${responseData.user.name}!`);
|
|
||||||
$('#account-action').text('Not you?');
|
|
||||||
$('#user-img').prop('src', `https://a.ez-pp.farm/${responseData.user.id}`);
|
|
||||||
loggedIn = true;
|
|
||||||
changePage('launch');
|
|
||||||
})
|
|
||||||
|
|
||||||
$("#change-folder-btn").on('click', async () => {
|
|
||||||
const responseData = await ipcRenderer.invoke('set-osu-dir');
|
const responseData = await ipcRenderer.invoke('set-osu-dir');
|
||||||
if (!responseData)
|
if (!responseData)
|
||||||
return;
|
return;
|
||||||
if (responseData.validOsuDir) {
|
if (responseData.validOsuDir) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Success!',
|
title: 'Success!',
|
||||||
text: 'osu! folder set.',
|
text: 'osu! folder set.',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
confirmButtonText: 'Cool'
|
confirmButtonText: 'Cool'
|
||||||
})
|
})
|
||||||
$('#currentOsuPath').text(responseData.folderPath);
|
$('#currentOsuPath').text(responseData.folderPath);
|
||||||
ipcRenderer.send("do-update-check");
|
ipcRenderer.send("do-update-check");
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Uh oh!',
|
title: 'Uh oh!',
|
||||||
text: 'The selected folder is not a osu! directory.',
|
text: 'The selected folder is not a osu! directory.',
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
confirmButtonText: 'Oops.. my bad!'
|
confirmButtonText: 'Oops.. my bad!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
break;
|
||||||
|
|
||||||
ipcRenderer.on('config_update', (event, data) => {
|
|
||||||
if (data.osuPath) {
|
|
||||||
$('#currentOsuPath').text(data.osuPath);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcRenderer.on('account_update', (event, data) => {
|
|
||||||
switch (data.type) {
|
|
||||||
case "not-loggedin":
|
|
||||||
changePage("launch");
|
|
||||||
break;
|
|
||||||
case "loggedin":
|
|
||||||
changePage("launch");
|
|
||||||
$('#welcome-text').text(`Welcome back, ${data.user.name}!`);
|
|
||||||
$('#account-action').text('Not you?');
|
|
||||||
$('#user-img').prop('src', `https://a.ez-pp.farm/${data.user.id}`)
|
|
||||||
loggedIn = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcRenderer.on('status_update', (event, status) => {
|
|
||||||
currentState = status.type;
|
|
||||||
switch (status.type) {
|
|
||||||
case "up-to-date":
|
|
||||||
$("#launch-btn").attr('disabled', false);
|
|
||||||
$('#launch-btn').html('Launch');
|
|
||||||
break;
|
|
||||||
case "update-available":
|
|
||||||
$("#launch-btn").attr('disabled', false);
|
|
||||||
$('#launch-btn').html('Update');
|
|
||||||
break;
|
|
||||||
case "missing-folder":
|
|
||||||
$("#launch-btn").attr('disabled', true);
|
|
||||||
$('#launch-btn').html('set your osu! folder');
|
|
||||||
break;
|
|
||||||
case "error":
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Uh oh!',
|
|
||||||
text: status.message,
|
|
||||||
icon: 'error',
|
|
||||||
confirmButtonText: 'Okay'
|
|
||||||
});
|
|
||||||
ipcRenderer.send("do-update-check");
|
|
||||||
break;
|
|
||||||
case "update-complete":
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Yaaay!',
|
|
||||||
text: "Your osu! client has been successfully updated!",
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'Thanks :3'
|
|
||||||
});
|
|
||||||
ipcRenderer.send("do-update-check");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function changePage(page) {
|
|
||||||
$(`#${currentPage}-page`).fadeOut(50, "swing", () => {
|
|
||||||
$(`#${page}-page`).fadeIn(350);
|
|
||||||
});
|
|
||||||
currentPage = page;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// workaround for the dark theme
|
$("#action-login").on('click', async () => {
|
||||||
$('head').append($('<link href="../assets/sweetalert2.dark.css" rel="stylesheet" />'));
|
const username = $('#login-username').val();
|
||||||
|
const password = $('#login-password').val();
|
||||||
|
$("#action-login").attr('disabled', true);
|
||||||
|
$("#action-cancel").attr('disabled', true);
|
||||||
|
const responseData = await ipcRenderer.invoke('perform-login', { username, password });
|
||||||
|
$("#action-login").attr('disabled', false);
|
||||||
|
$("#action-cancel").attr('disabled', false);
|
||||||
|
if (!responseData)
|
||||||
|
return;
|
||||||
|
if (responseData.code != 200) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: responseData.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Oops.. my bad!'
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#login-username').val("");
|
||||||
|
$('#login-password').val("");
|
||||||
|
$('#welcome-text').text(`Welcome back, ${responseData.user.name}!`);
|
||||||
|
$('#account-action').text('Not you?');
|
||||||
|
$('.user-image').css('background-image', `url(https://a.ez-pp.farm/${responseData.user.id})`);
|
||||||
|
loggedIn = true;
|
||||||
|
changePage('launch');
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#change-folder-btn").on('click', async () => {
|
||||||
|
const responseData = await ipcRenderer.invoke('set-osu-dir');
|
||||||
|
if (!responseData)
|
||||||
|
return;
|
||||||
|
if (responseData.validOsuDir) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'osu! folder set.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Cool'
|
||||||
|
})
|
||||||
|
$('#currentOsuPath').text(responseData.folderPath);
|
||||||
|
ipcRenderer.send("do-update-check");
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: 'The selected folder is not a osu! directory.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Oops.. my bad!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('config_update', (event, data) => {
|
||||||
|
if (data.osuPath) {
|
||||||
|
$('#currentOsuPath').text(data.osuPath);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on('launcher_update', async (event, data) => {
|
||||||
|
const res = await Swal.fire({
|
||||||
|
title: 'Update available!',
|
||||||
|
text: `Version ${data.version} has been released!`,
|
||||||
|
icon: 'info',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Download',
|
||||||
|
cancelButtonText: 'Remind me later',
|
||||||
|
});
|
||||||
|
if (res.isConfirmed) {
|
||||||
|
shell.openExternal(data.url);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on('account_update', (event, data) => {
|
||||||
|
switch (data.type) {
|
||||||
|
case "login-failed":
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: data.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
changePage("launch");
|
||||||
|
break;
|
||||||
|
case "not-loggedin":
|
||||||
|
changePage("launch");
|
||||||
|
break;
|
||||||
|
case "loggedin":
|
||||||
|
changePage("launch");
|
||||||
|
$('#welcome-text').text(`Welcome back, ${data.user.name}!`);
|
||||||
|
$('#account-action').text('Not you?');
|
||||||
|
$('.user-image').css('background-image', `url(https://a.ez-pp.farm/${data.user.id})`);
|
||||||
|
loggedIn = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on('alert_message', async (event, path) => {
|
||||||
|
const res = await Swal.fire({
|
||||||
|
title: 'Hey!',
|
||||||
|
html: `<p class="text-white">Detected a osu! installation at</p><span class="quotetext">${path}</span><p class="text-white">Is this correct?</p>`,
|
||||||
|
icon: 'info',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Yes',
|
||||||
|
cancelButtonText: 'No',
|
||||||
|
});
|
||||||
|
if (res.isConfirmed) {
|
||||||
|
$('#currentOsuPath').text(path);
|
||||||
|
ipcRenderer.send('alert_response', path);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'osu! folder set.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Cool'
|
||||||
|
})
|
||||||
|
ipcRenderer.send("do-update-check");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on('status_update', (event, status) => {
|
||||||
|
switch (status.type) {
|
||||||
|
case "up-to-date":
|
||||||
|
$("#launch-btn").attr('disabled', false);
|
||||||
|
$('#launch-btn').html('Launch');
|
||||||
|
currentState = status.type;
|
||||||
|
break;
|
||||||
|
case "update-available":
|
||||||
|
$("#launch-btn").attr('disabled', false);
|
||||||
|
$('#launch-btn').html('Update');
|
||||||
|
currentState = status.type;
|
||||||
|
break;
|
||||||
|
case "missing-folder":
|
||||||
|
$("#launch-btn").attr('disabled', false);
|
||||||
|
$('#launch-btn').html('set your osu! folder');
|
||||||
|
currentState = status.type;
|
||||||
|
break;
|
||||||
|
case "error":
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: status.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
ipcRenderer.send("do-update-check");
|
||||||
|
break;
|
||||||
|
case "info":
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Info!',
|
||||||
|
text: status.message,
|
||||||
|
icon: 'info',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "package-issue":
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Uh oh!',
|
||||||
|
text: status.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'Okay'
|
||||||
|
});
|
||||||
|
$("#launch-btn").attr('disabled', true);
|
||||||
|
$('#launch-btn').html('missing packages');
|
||||||
|
break;
|
||||||
|
case "update-complete":
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Yaaay!',
|
||||||
|
text: "Your osu! client has been successfully updated!",
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Thanks :3'
|
||||||
|
});
|
||||||
|
ipcRenderer.send("do-update-check");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function changePage(page) {
|
||||||
|
$(`#${currentPage}-page`).fadeOut(50, "swing", () => {
|
||||||
|
$(`#${page}-page`).fadeIn(350);
|
||||||
|
});
|
||||||
|
currentPage = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
// workaround for the dark theme
|
||||||
|
$('head').append($('<link href="../assets/sweetalert2.dark.css" rel="stylesheet" />'));
|
||||||
})
|
})
|
BIN
preview/EZPPLauncher.png
Normal file
BIN
preview/EZPPLauncher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
16
terminalUtil.js
Normal file
16
terminalUtil.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
const execPromise = function (cmd) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
exec(cmd, function (err, stdout) {
|
||||||
|
if (err) return reject(err);
|
||||||
|
resolve(stdout);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const execCommand = async (command) => {
|
||||||
|
return await execPromise(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { execCommand };
|
@@ -1,26 +0,0 @@
|
|||||||
const dpapi = require('wincrypt');
|
|
||||||
const entropyBuffer = Buffer.from('cu24180ncjeiu0ci1nwui', 'utf-8');
|
|
||||||
|
|
||||||
const run = async () => {
|
|
||||||
const stringToEncrypt = "Test123456!";
|
|
||||||
|
|
||||||
|
|
||||||
const encrypted = await encryptString(stringToEncrypt)
|
|
||||||
console.log(encrypted);
|
|
||||||
const decrypted = await decryptString(encrypted);
|
|
||||||
console.log(decrypted);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async function encryptString(value) {
|
|
||||||
const encryptedString = await dpapi.protect(Buffer.from(value, 'utf-8'), entropyBuffer, 'CurrentUser');
|
|
||||||
const encodedBase64 = Buffer.from(encryptedString, 'utf-8').toString('base64');
|
|
||||||
return encodedBase64;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function decryptString(value) {
|
|
||||||
const decrypted = await dpapi.unprotect(Buffer.from(value, 'base64'), entropyBuffer, 'CurrentUser');
|
|
||||||
return decrypted.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
run();
|
|
@@ -1,6 +1,6 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const appInfo = require('../appInfo');
|
const appInfo = require('../appInfo');
|
||||||
const { BrowserWindow } = require('electron');
|
const { BrowserWindow, Menu } = require('electron');
|
||||||
const { attachTitlebarToWindow } = require('custom-electron-titlebar/main');
|
const { attachTitlebarToWindow } = require('custom-electron-titlebar/main');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -12,7 +12,7 @@ module.exports = {
|
|||||||
minWidth: windowWidth / 1.25,
|
minWidth: windowWidth / 1.25,
|
||||||
frame: false,
|
frame: false,
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
backgroundColor: "#121212",
|
backgroundColor: "#24283B",
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
minimizable: true,
|
minimizable: true,
|
||||||
@@ -26,6 +26,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
icon: './assets/logo.png'
|
icon: './assets/logo.png'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const menu = Menu.buildFromTemplate([])
|
||||||
|
Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
window.hide();
|
window.hide();
|
||||||
|
|
||||||
window.webContents.once("did-finish-load", function (event, input) {
|
window.webContents.once("did-finish-load", function (event, input) {
|
||||||
@@ -33,10 +37,8 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.webContents.setUserAgent(`${appInfo.appName} ${appInfo.appVersion}`);
|
window.webContents.setUserAgent(`${appInfo.appName} ${appInfo.appVersion}`);
|
||||||
|
|
||||||
attachTitlebarToWindow(window);
|
attachTitlebarToWindow(window);
|
||||||
// window.webContents.openDevTools({
|
|
||||||
// mode: "detach"
|
|
||||||
// });
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user