Compare commits
29 Commits
72a0d9b780
...
1.1.2
Author | SHA1 | Date | |
---|---|---|---|
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 |
@@ -12,7 +12,7 @@ The Launcher is a "plug and play thing", download it, place it on the desktop an
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Automatic osu! client updating before Launch
|
* Automatic osu! client updating before Launch
|
||||||
* Account saving (soon)
|
* Account saving
|
||||||
|
|
||||||
## Used Libraries
|
## Used Libraries
|
||||||
|
|
||||||
|
47
app.js
47
app.js
@@ -8,12 +8,14 @@ const fs = require('fs');
|
|||||||
const rpc = require('./discordPresence');
|
const rpc = require('./discordPresence');
|
||||||
const windowName = require('get-window-by-name');
|
const windowName = require('get-window-by-name');
|
||||||
const terminalUtil = require('./terminalUtil');
|
const terminalUtil = require('./terminalUtil');
|
||||||
|
const osUtil = require('./osUtil');
|
||||||
|
|
||||||
let tempOsuPath;
|
let tempOsuPath;
|
||||||
let osuWindowInfo;
|
let osuWindowInfo;
|
||||||
let isIngame;
|
let isIngame;
|
||||||
const platform = process.platform;
|
const platform = process.platform;
|
||||||
let linuxWMCtrlFound = false;
|
let linuxWMCtrlFound = false;
|
||||||
|
let osuLoaded = false;
|
||||||
|
|
||||||
const run = () => {
|
const run = () => {
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
const gotTheLock = app.requestSingleInstanceLock()
|
||||||
@@ -28,6 +30,10 @@ const run = () => {
|
|||||||
const firstInstance = osuWindowInfo[0];
|
const firstInstance = osuWindowInfo[0];
|
||||||
if (firstInstance) {
|
if (firstInstance) {
|
||||||
if (firstInstance.processTitle && firstInstance.processTitle.length > 0) {
|
if (firstInstance.processTitle && firstInstance.processTitle.length > 0) {
|
||||||
|
if (!osuLoaded) {
|
||||||
|
osuLoaded = true;
|
||||||
|
//TODO: do patch
|
||||||
|
}
|
||||||
const windowTitle = firstInstance.processTitle;
|
const windowTitle = firstInstance.processTitle;
|
||||||
let rpcOsuVersion = "";
|
let rpcOsuVersion = "";
|
||||||
let currentMap = undefined;
|
let currentMap = undefined;
|
||||||
@@ -40,15 +46,20 @@ const run = () => {
|
|||||||
const splitArray = [components.shift(), components.join(' - ')];
|
const splitArray = [components.shift(), components.join(' - ')];
|
||||||
rpcOsuVersion = splitArray[0];
|
rpcOsuVersion = splitArray[0];
|
||||||
currentMap = splitArray[1];
|
currentMap = splitArray[1];
|
||||||
rpc.updateState("Playing...");
|
if (currentMap.endsWith(".osu")) {
|
||||||
|
rpc.updateState("Editing...");
|
||||||
|
currentMap = currentMap.substring(0, currentMap.length - 4);
|
||||||
|
} else rpc.updateState("Playing...");
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc.updateStatus(currentMap, rpcOsuVersion);
|
rpc.updateStatus(currentMap, rpcOsuVersion);
|
||||||
} else {
|
} else {
|
||||||
|
if (osuLoaded) osuLoaded = false;
|
||||||
rpc.updateState("Idle in Launcher...");
|
rpc.updateState("Idle in Launcher...");
|
||||||
rpc.updateStatus(undefined, undefined);
|
rpc.updateStatus(undefined, undefined);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (osuLoaded) osuLoaded = false;
|
||||||
rpc.updateState("Idle in Launcher...");
|
rpc.updateState("Idle in Launcher...");
|
||||||
rpc.updateStatus(undefined, undefined);
|
rpc.updateStatus(undefined, undefined);
|
||||||
}
|
}
|
||||||
@@ -79,7 +90,11 @@ const run = () => {
|
|||||||
const splitArray = [components.shift(), components.join(' - ')];
|
const splitArray = [components.shift(), components.join(' - ')];
|
||||||
rpcOsuVersion = splitArray[0];
|
rpcOsuVersion = splitArray[0];
|
||||||
currentMap = splitArray[1];
|
currentMap = splitArray[1];
|
||||||
rpc.updateState("Playing...");
|
if (currentMap.endsWith(".osu")) {
|
||||||
|
rpc.updateState("Editing/Modding...");
|
||||||
|
currentMap = currentMap.substring(0, currentMap.length - 4);
|
||||||
|
}
|
||||||
|
else rpc.updateState("Playing...");
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc.updateStatus(currentMap, rpcOsuVersion);
|
rpc.updateStatus(currentMap, rpcOsuVersion);
|
||||||
@@ -112,6 +127,24 @@ const run = () => {
|
|||||||
await tryLogin(mainWindow);
|
await tryLogin(mainWindow);
|
||||||
await doUpdateCheck(mainWindow);
|
await doUpdateCheck(mainWindow);
|
||||||
if (platform === "linux") {
|
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', {
|
/* mainWindow.webContents.send('status_update', {
|
||||||
type: "info",
|
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!"
|
message: "We detected that you are running the Launcher under Linux. It's currently just compatible with Arch and the osu AUR package!"
|
||||||
@@ -124,6 +157,12 @@ const run = () => {
|
|||||||
message: "Seems like you are missing the wmctrl package, please install it for the RPC to work!"
|
message: "Seems like you are missing the wmctrl package, please install it for the RPC to work!"
|
||||||
});
|
});
|
||||||
} else linuxWMCtrlFound = true;
|
} 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 () {
|
app.on('activate', function () {
|
||||||
@@ -148,8 +187,10 @@ const run = () => {
|
|||||||
}
|
}
|
||||||
rpc.updateState("Launching osu!...");
|
rpc.updateState("Launching osu!...");
|
||||||
isIngame = true;
|
isIngame = true;
|
||||||
|
mainWindow.hide();
|
||||||
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
||||||
isIngame = false;
|
isIngame = false;
|
||||||
|
mainWindow.show();
|
||||||
await doUpdateCheck(mainWindow);
|
await doUpdateCheck(mainWindow);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -295,7 +336,7 @@ async function doUpdateCheck(window) {
|
|||||||
|
|
||||||
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');
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const appName = "EZPPLauncher"
|
const appName = "EZPPLauncher"
|
||||||
const appVersion = "1.1.1";
|
const appVersion = "1.1.2";
|
||||||
|
|
||||||
module.exports = { appName, appVersion };
|
module.exports = { appName, appVersion };
|
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%);
|
||||||
|
}
|
@@ -2,12 +2,17 @@
|
|||||||
|
|
||||||
: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%);
|
||||||
|
}
|
||||||
|
|
||||||
.sections {
|
.sections {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
@@ -23,6 +28,15 @@
|
|||||||
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;
|
||||||
@@ -48,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.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;
|
||||||
@@ -85,6 +99,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;
|
||||||
|
@@ -7,22 +7,23 @@ let client = undefined;
|
|||||||
let lastState = "Idle in Launcher...";
|
let lastState = "Idle in Launcher...";
|
||||||
let presenceEnabled = true;
|
let presenceEnabled = true;
|
||||||
let startDate = new Date();
|
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 = {
|
let lastActivity = {
|
||||||
details: " ",
|
details: " ",
|
||||||
state: lastState,
|
state: lastState,
|
||||||
startTimestamp: startDate,
|
startTimestamp: startDate,
|
||||||
largeImageKey: "ezppfarm",
|
largeImageKey: "ezppfarm",
|
||||||
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
||||||
buttons: [
|
buttons: actionButtons,
|
||||||
{
|
|
||||||
label: "Download the Launcher",
|
|
||||||
url: "https://ez-pp.farm/download"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Join EZPPFarm",
|
|
||||||
url: "https://discord.com/invite/g8Bh7RaKPg"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
instance: false,
|
instance: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,16 +54,7 @@ module.exports = {
|
|||||||
smallImageText: osuVersion ? osuVersion : " ",
|
smallImageText: osuVersion ? osuVersion : " ",
|
||||||
largeImageKey: "ezppfarm",
|
largeImageKey: "ezppfarm",
|
||||||
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
largeImageText: appInfo.appName + " " + appInfo.appVersion,
|
||||||
buttons: [
|
buttons: actionButtons,
|
||||||
{
|
|
||||||
label: "Download the Launcher",
|
|
||||||
url: "https://ez-pp.farm/download"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Join EZPPFarm",
|
|
||||||
url: "https://discord.com/invite/g8Bh7RaKPg"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
instance: false,
|
instance: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
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';
|
||||||
|
|
||||||
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 });
|
||||||
|
@@ -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;
|
||||||
@@ -61,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">
|
||||||
@@ -87,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">
|
||||||
@@ -108,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>
|
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 };
|
24
osuUtil.js
24
osuUtil.js
@@ -8,6 +8,9 @@ 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 ignoredOsuEntities = [
|
||||||
|
'osu!auth.dll'
|
||||||
|
]
|
||||||
const osuEntities = [
|
const osuEntities = [
|
||||||
'avcodec-51.dll',
|
'avcodec-51.dll',
|
||||||
'avformat-52.dll',
|
'avformat-52.dll',
|
||||||
@@ -87,6 +90,8 @@ async function filesThatNeedUpdate(osuPath, updateFiles) {
|
|||||||
const fileHash = updatedFile.file_hash;
|
const fileHash = updatedFile.file_hash;
|
||||||
const fileURL = updatedFile.url_full;
|
const fileURL = updatedFile.url_full;
|
||||||
|
|
||||||
|
if (ignoredOsuEntities.includes(fileName)) continue;
|
||||||
|
|
||||||
const fileOnDisk = path.join(osuPath, fileName);
|
const fileOnDisk = path.join(osuPath, fileName);
|
||||||
if (await fu.existsAsync(fileOnDisk)) {
|
if (await fu.existsAsync(fileOnDisk)) {
|
||||||
const binaryFileContents = await fs.promises.readFile(fileOnDisk);
|
const binaryFileContents = await fs.promises.readFile(fileOnDisk);
|
||||||
@@ -96,14 +101,12 @@ async function filesThatNeedUpdate(osuPath, updateFiles) {
|
|||||||
fileName,
|
fileName,
|
||||||
fileURL
|
fileURL
|
||||||
})
|
})
|
||||||
//console.log("hashes are not matching", `(${existingFileMD5} - ${fileHash})`);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
filesToDownload.push({
|
filesToDownload.push({
|
||||||
fileName,
|
fileName,
|
||||||
fileURL
|
fileURL
|
||||||
});
|
});
|
||||||
//console.log("new file " + fileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filesToDownload;
|
return filesToDownload;
|
||||||
@@ -171,8 +174,23 @@ async function setConfigValue(configPath, key, value) {
|
|||||||
}
|
}
|
||||||
await fs.promises.writeFile(configPath, configLines.join("\n"), 'utf-8');
|
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 = {
|
module.exports = {
|
||||||
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
||||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue
|
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
||||||
|
findOsuInstallation
|
||||||
}
|
}
|
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ezpplauncher",
|
"name": "ezpplauncher",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "HorizonCode",
|
"author": "HorizonCode",
|
||||||
@@ -32,19 +32,16 @@
|
|||||||
},
|
},
|
||||||
"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 --arm64 --x64",
|
||||||
"pack-win": "electron-builder --x64",
|
"pack-linux": "electron-builder --linux --arm64 --x64",
|
||||||
"pack-win32": "electron-builder --ia32",
|
"pack-mac": "electron-builder --mac --arm64 --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": {
|
||||||
@@ -55,6 +52,7 @@
|
|||||||
"get-window-by-name": "^2.0.0",
|
"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",
|
||||||
|
"qiao-regedit": "^0.1.5",
|
||||||
"sweetalert2": "^11.5.2"
|
"sweetalert2": "^11.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ let loggedIn = false;
|
|||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
titlebar = new Titlebar({
|
titlebar = new Titlebar({
|
||||||
backgroundColor: Color.fromHex("#303030"),
|
backgroundColor: Color.fromHex("#24283B"),
|
||||||
itemBackgroundColor: Color.fromHex("#121212"),
|
itemBackgroundColor: Color.fromHex("#121212"),
|
||||||
menu: null,
|
menu: null,
|
||||||
maximizable: false
|
maximizable: false
|
||||||
@@ -16,7 +16,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
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', () => {
|
||||||
@@ -69,6 +68,28 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
$('#launch-btn').html('Updating...');
|
$('#launch-btn').html('Updating...');
|
||||||
ipcRenderer.send("do-update");
|
ipcRenderer.send("do-update");
|
||||||
break;
|
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;
|
currentState = status.type;
|
||||||
break;
|
break;
|
||||||
case "missing-folder":
|
case "missing-folder":
|
||||||
$("#launch-btn").attr('disabled', true);
|
$("#launch-btn").attr('disabled', false);
|
||||||
$('#launch-btn').html('set your osu! folder');
|
$('#launch-btn').html('set your osu! folder');
|
||||||
currentState = status.type;
|
currentState = status.type;
|
||||||
break;
|
break;
|
||||||
@@ -178,6 +199,16 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
confirmButtonText: 'Okay'
|
confirmButtonText: 'Okay'
|
||||||
});
|
});
|
||||||
break;
|
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!',
|
||||||
|
@@ -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,
|
||||||
@@ -34,9 +34,6 @@ 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