17 Commits

15 changed files with 277 additions and 73 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules/ node_modules/
release/ release/
yarn.lock yarn.lock
pnpm-lock.yaml

View File

@@ -1,9 +1,11 @@
# 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
![preview](https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/raw/branch/master/preview/EZPPLauncher.png)
## 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!
@@ -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

125
app.js
View File

@@ -5,8 +5,15 @@ 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 rpc = require('./discordPresence');
const windowName = require('get-window-by-name');
const terminalUtil = require('./terminalUtil');
let tempOsuPath; let tempOsuPath;
let osuWindowInfo;
let isIngame;
const platform = process.platform;
let linuxWMCtrlFound = false;
const run = () => { const run = () => {
const gotTheLock = app.requestSingleInstanceLock() const gotTheLock = app.requestSingleInstanceLock()
@@ -15,8 +22,94 @@ const run = () => {
return; return;
} }
setInterval(async () => {
if (platform == "win32") {
osuWindowInfo = windowName.getWindowText("osu!.exe");
const firstInstance = osuWindowInfo[0];
if (firstInstance) {
if (firstInstance.processTitle && firstInstance.processTitle.length > 0) {
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...");
}
rpc.updateStatus(currentMap, rpcOsuVersion);
} else {
rpc.updateState("Idle in Launcher...");
rpc.updateStatus(undefined, undefined);
}
} else {
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...");
currentMap = currentMap.substring(0, currentMap.length - 4);
}
else rpc.updateState("Playing...");
}
rpc.updateStatus(currentMap, rpcOsuVersion);
} else {
rpc.updateState("Idle in Launcher...");
rpc.updateStatus(undefined, undefined);
}
} else {
if (isIngame) {
rpc.updateState("Playing...");
rpc.updateStatus("Clicking circles!", "runningunderwine");
} else {
rpc.updateState("Idle in Launcher...");
rpc.updateStatus(undefined, undefined);
}
}
}, 2000);
setupTitlebar(); setupTitlebar();
rpc.connect();
let mainWindow; let mainWindow;
app.whenReady().then(() => { app.whenReady().then(() => {
@@ -25,6 +118,29 @@ const run = () => {
await updateConfigVars(mainWindow); await updateConfigVars(mainWindow);
await tryLogin(mainWindow); await tryLogin(mainWindow);
await doUpdateCheck(mainWindow); await doUpdateCheck(mainWindow);
if (platform === "linux") {
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;
}
}) })
app.on('activate', function () { app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow(); if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
@@ -40,13 +156,16 @@ const run = () => {
await osuUtil.setConfigValue(osuConfig.path, "SaveUsername", "1"); await osuUtil.setConfigValue(osuConfig.path, "SaveUsername", "1");
await osuUtil.setConfigValue(osuConfig.path, "SavePassword", "1"); await osuUtil.setConfigValue(osuConfig.path, "SavePassword", "1");
await osuUtil.setConfigValue(osuConfig.path, "Username", username); await osuUtil.setConfigValue(osuConfig.path, "Username", username);
await osuUtil.setConfigValue(osuConfig.path, "Password", await osuUtil.decryptString(password)); await osuUtil.setConfigValue(osuConfig.path, "Password", password);
await osuUtil.setConfigValue(osuConfig.path, "CredentialEndpoint", "ez-pp.farm"); await osuUtil.setConfigValue(osuConfig.path, "CredentialEndpoint", "ez-pp.farm");
} else { } else {
await osuUtil.setConfigValue(osuConfig.path, "Username", ""); await osuUtil.setConfigValue(osuConfig.path, "Username", "");
await osuUtil.setConfigValue(osuConfig.path, "Password", ""); await osuUtil.setConfigValue(osuConfig.path, "Password", "");
} }
rpc.updateState("Launching osu!...");
isIngame = true;
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => { const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
isIngame = false;
await doUpdateCheck(mainWindow); await doUpdateCheck(mainWindow);
}); });
return result; return result;
@@ -113,7 +232,7 @@ const run = () => {
const loginData = await ezppUtil.performLogin(username, password); const loginData = await ezppUtil.performLogin(username, password);
if (loginData && loginData.code === 200) { if (loginData && loginData.code === 200) {
await config.set("username", username); await config.set("username", username);
await config.set("password", await osuUtil.encryptString(password)); await config.set("password", password);
} }
return loginData; return loginData;
}) })
@@ -135,7 +254,7 @@ async function tryLogin(window) {
const username = await config.get("username", ""); const username = await config.get("username", "");
const password = await config.get("password", ""); const password = await config.get("password", "");
if ((username && username.length > 0) && (password && password.length > 0)) { if ((username && username.length > 0) && (password && password.length > 0)) {
const passwordPlain = await osuUtil.decryptString(password); const passwordPlain = password;
const loginResponse = await ezppUtil.performLogin(username, passwordPlain); const loginResponse = await ezppUtil.performLogin(username, passwordPlain);
if (loginResponse && loginResponse.code === 200) { if (loginResponse && loginResponse.code === 200) {
window.webContents.send('account_update', { window.webContents.send('account_update', {

View File

@@ -1,4 +1,4 @@
const appName = "EZPPLauncher" const appName = "EZPPLauncher"
const appVersion = "1.1.0"; const appVersion = "1.1.1";
module.exports = { appName, appVersion }; module.exports = { appName, appVersion };

View File

@@ -85,6 +85,11 @@
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;
@@ -122,13 +127,11 @@
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 {
@@ -159,7 +162,7 @@
.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,

View File

@@ -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;

View File

@@ -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
discordPresence.js Normal file
View File

@@ -0,0 +1,69 @@
const appInfo = require('./appInfo.js');
const DiscordAutoRPC = require("discord-auto-rpc");
const { app } = require('electron');
const DiscordRPC = require("discord-rpc").default;
const clientId = "1032772293220384808";
let client = undefined;
let lastState = "Idle in Launcher...";
let presenceEnabled = true;
let startDate = new Date();
let lastActivity = {
details: " ",
state: lastState,
startTimestamp: startDate,
largeImageKey: "ezppfarm",
largeImageText: appInfo.appName + " " + appInfo.appVersion,
buttons: [
{
label: "Download the Launcher",
url: "https://ez-pp.farm/download"
},
{
label: "Join EZPPFarm",
url: "https://discord.com/invite/g8Bh7RaKPg"
}
],
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: [
{
label: "Download the Launcher",
url: "https://ez-pp.farm/download"
},
{
label: "Join EZPPFarm",
url: "https://discord.com/invite/g8Bh7RaKPg"
}
],
instance: false,
}
}
}

View File

@@ -25,7 +25,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 +47,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">
@@ -71,7 +70,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>

View File

@@ -3,13 +3,11 @@ 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 osuEntities = [ const osuEntities = [
'avcodec-51.dll', 'avcodec-51.dll',
'avformat-52.dll', 'avformat-52.dll',
@@ -143,17 +141,15 @@ async function downloadUpdateFiles(osuPath, filesToUpdate) {
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) {
@@ -178,6 +174,5 @@ async function setConfigValue(configPath, key, value) {
module.exports = { module.exports = {
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate, isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue, downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue
encryptString, decryptString
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "1.1.0", "version": "1.1.1",
"main": "app.js", "main": "app.js",
"license": "MIT", "license": "MIT",
"author": "HorizonCode", "author": "HorizonCode",
@@ -32,8 +32,6 @@
}, },
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"test": "electron ./test/encrypt.js",
"rebuild": "electron-rebuild -f -w wincrypt",
"pack-win": "electron-builder --x64", "pack-win": "electron-builder --x64",
"pack-win32": "electron-builder --ia32", "pack-win32": "electron-builder --ia32",
"pack-winarm": "electron-builder --arm64", "pack-winarm": "electron-builder --arm64",
@@ -50,9 +48,11 @@
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^0.27.2",
"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", "sweetalert2": "^11.5.2"
"wincrypt": "^1.5.0"
} }
} }

View File

@@ -25,7 +25,7 @@ window.addEventListener('DOMContentLoaded', () => {
} else { } else {
$('#welcome-text').text(`Nice to see you!`); $('#welcome-text').text(`Nice to see you!`);
$('#account-action').text('Click to login'); $('#account-action').text('Click to login');
$('#user-img').prop('src', `https://a.ez-pp.farm/0`) $('.user-image').css('background-image', `url(https://a.ez-pp.farm/0)`)
loggedIn = false; loggedIn = false;
ipcRenderer.send("perform-logout"); ipcRenderer.send("perform-logout");
Swal.fire({ Swal.fire({
@@ -95,7 +95,7 @@ window.addEventListener('DOMContentLoaded', () => {
$('#login-password').val(""); $('#login-password').val("");
$('#welcome-text').text(`Welcome back, ${responseData.user.name}!`); $('#welcome-text').text(`Welcome back, ${responseData.user.name}!`);
$('#account-action').text('Not you?'); $('#account-action').text('Not you?');
$('#user-img').prop('src', `https://a.ez-pp.farm/${responseData.user.id}`); $('.user-image').css('background-image', `url(https://a.ez-pp.farm/${responseData.user.id})`);
loggedIn = true; loggedIn = true;
changePage('launch'); changePage('launch');
}) })
@@ -138,26 +138,28 @@ window.addEventListener('DOMContentLoaded', () => {
changePage("launch"); changePage("launch");
$('#welcome-text').text(`Welcome back, ${data.user.name}!`); $('#welcome-text').text(`Welcome back, ${data.user.name}!`);
$('#account-action').text('Not you?'); $('#account-action').text('Not you?');
$('#user-img').prop('src', `https://a.ez-pp.farm/${data.user.id}`) $('.user-image').css('background-image', `url(https://a.ez-pp.farm/${data.user.id})`);
loggedIn = true; loggedIn = true;
break; break;
} }
}) })
ipcRenderer.on('status_update', (event, status) => { ipcRenderer.on('status_update', (event, status) => {
currentState = status.type;
switch (status.type) { switch (status.type) {
case "up-to-date": case "up-to-date":
$("#launch-btn").attr('disabled', false); $("#launch-btn").attr('disabled', false);
$('#launch-btn').html('Launch'); $('#launch-btn').html('Launch');
currentState = status.type;
break; break;
case "update-available": case "update-available":
$("#launch-btn").attr('disabled', false); $("#launch-btn").attr('disabled', false);
$('#launch-btn').html('Update'); $('#launch-btn').html('Update');
currentState = status.type;
break; break;
case "missing-folder": case "missing-folder":
$("#launch-btn").attr('disabled', true); $("#launch-btn").attr('disabled', true);
$('#launch-btn').html('set your osu! folder'); $('#launch-btn').html('set your osu! folder');
currentState = status.type;
break; break;
case "error": case "error":
Swal.fire({ Swal.fire({
@@ -168,6 +170,24 @@ window.addEventListener('DOMContentLoaded', () => {
}); });
ipcRenderer.send("do-update-check"); ipcRenderer.send("do-update-check");
break; 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": case "update-complete":
Swal.fire({ Swal.fire({
title: 'Yaaay!', title: 'Yaaay!',

BIN
preview/EZPPLauncher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

16
terminalUtil.js Normal file
View 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 };

View File

@@ -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();