Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher
This commit is contained in:
commit
a358ff08fa
17
app.js
17
app.js
|
@ -15,6 +15,7 @@ let osuWindowInfo;
|
|||
let isIngame;
|
||||
const platform = process.platform;
|
||||
let linuxWMCtrlFound = false;
|
||||
let osuLoaded = false;
|
||||
|
||||
const run = () => {
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
@ -29,6 +30,10 @@ const run = () => {
|
|||
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;
|
||||
|
@ -49,10 +54,12 @@ const run = () => {
|
|||
|
||||
rpc.updateStatus(currentMap, rpcOsuVersion);
|
||||
} else {
|
||||
if (osuLoaded) osuLoaded = false;
|
||||
rpc.updateState("Idle in Launcher...");
|
||||
rpc.updateStatus(undefined, undefined);
|
||||
}
|
||||
} else {
|
||||
if (osuLoaded) osuLoaded = false;
|
||||
rpc.updateState("Idle in Launcher...");
|
||||
rpc.updateStatus(undefined, undefined);
|
||||
}
|
||||
|
@ -150,6 +157,12 @@ const run = () => {
|
|||
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();
|
||||
console.log("osu! Installation located at: ",foundFolder);
|
||||
}
|
||||
}
|
||||
})
|
||||
app.on('activate', function () {
|
||||
|
@ -174,8 +187,10 @@ const run = () => {
|
|||
}
|
||||
rpc.updateState("Launching osu!...");
|
||||
isIngame = true;
|
||||
mainWindow.hide();
|
||||
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
||||
isIngame = false;
|
||||
mainWindow.show();
|
||||
await doUpdateCheck(mainWindow);
|
||||
});
|
||||
return result;
|
||||
|
@ -321,7 +336,7 @@ async function doUpdateCheck(window) {
|
|||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const win = windowManager.createWindow(700, 420);
|
||||
const win = windowManager.createWindow(700, 460);
|
||||
|
||||
win.loadFile('./html/index.html');
|
||||
|
||||
|
|
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%);
|
||||
}
|
|
@ -27,6 +27,15 @@ body {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.launch-button-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.launch-button-section button {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.loading-section,
|
||||
.login-section {
|
||||
margin-top: 35px;
|
||||
|
@ -52,7 +61,7 @@ body {
|
|||
}
|
||||
|
||||
.folder-section {
|
||||
margin-top: 45px;
|
||||
margin-top: 50px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: center;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<link rel="icon" type="image/png" href="../assets/logo.png" />
|
||||
<link href="../assets/mdb.min.css" rel="stylesheet" />
|
||||
<link href="../assets/launcher.css" rel="stylesheet" />
|
||||
<link href="../assets/checkbox.css" rel="stylesheet" />
|
||||
<style>
|
||||
* {
|
||||
user-select: none;
|
||||
|
@ -61,8 +62,12 @@
|
|||
<div class="server-logo">
|
||||
<img src="../assets/logo.png" height="150">
|
||||
</div>
|
||||
<div class="launch-button">
|
||||
<div class="launch-button-section">
|
||||
<button class="btn btn-lg btn-launch btn-accent" id="launch-btn">Launch</button>
|
||||
<div class="patch-checkbox">
|
||||
<input type="checkbox" id="enablePatching" disabled/>
|
||||
<label for="enablePatching" style="display: initial;">enable Patching</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="folder-section">
|
||||
|
@ -87,7 +92,8 @@
|
|||
<label class="form-label" for="login-username">Username</label>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<div class="pt-1 mb-4">
|
||||
|
|
17
osuUtil.js
17
osuUtil.js
|
@ -171,8 +171,23 @@ async function setConfigValue(configPath, key, value) {
|
|||
}
|
||||
await fs.promises.writeFile(configPath, configLines.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 value.trim();
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue
|
||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
||||
findOsuInstallation
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"rebuild": "electron-rebuild -f -w get-window-by-name",
|
||||
"pack-win": "electron-builder --x64",
|
||||
"pack-win32": "electron-builder --ia32",
|
||||
"pack-winarm": "electron-builder --arm64",
|
||||
|
@ -53,6 +54,7 @@
|
|||
"get-window-by-name": "^2.0.0",
|
||||
"jquery": "^3.6.0",
|
||||
"node-downloader-helper": "^2.1.4",
|
||||
"qiao-regedit": "^0.1.5",
|
||||
"sweetalert2": "^11.5.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`);
|
||||
|
||||
const $ = require('jquery');
|
||||
const axios = require('axios').default;
|
||||
const Swal = require('sweetalert2');
|
||||
|
||||
$('#account-action').on('click', () => {
|
||||
|
@ -69,6 +68,28 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
$('#launch-btn').html('Updating...');
|
||||
ipcRenderer.send("do-update");
|
||||
break;
|
||||
case "missing-folder":
|
||||
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!'
|
||||
})
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -157,7 +178,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
currentState = status.type;
|
||||
break;
|
||||
case "missing-folder":
|
||||
$("#launch-btn").attr('disabled', true);
|
||||
$("#launch-btn").attr('disabled', false);
|
||||
$('#launch-btn').html('set your osu! folder');
|
||||
currentState = status.type;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user