some experimental stuff 👀
This commit is contained in:
parent
769a88521e
commit
42777c9e0c
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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
19
app.js
19
app.js
|
@ -195,11 +195,19 @@ const run = () => {
|
||||||
} else linuxWMCtrlFound = true;
|
} else linuxWMCtrlFound = true;
|
||||||
} else {
|
} else {
|
||||||
const osuFolder = await config.get("osuPath");
|
const osuFolder = await config.get("osuPath");
|
||||||
|
console.log(osuFolder, !osuFolder || osuFolder == "");
|
||||||
if (!osuFolder || osuFolder == "") {
|
if (!osuFolder || osuFolder == "") {
|
||||||
const foundFolder = await osuUtil.findOsuInstallation();
|
const foundFolder = await osuUtil.findOsuInstallation();
|
||||||
|
if (foundFolder && osuUtil.isValidOsuFolder(foundFolder)) {
|
||||||
|
mainWindow.webContents.send('alert_message', foundFolder);
|
||||||
|
}
|
||||||
console.log("osu! Installation located at: ", foundFolder);
|
console.log("osu! Installation located at: ", foundFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
ipcMain.on("alert_response", async (event, path) => {
|
||||||
|
console.log("yes");
|
||||||
|
await config.set("osuPath", path);
|
||||||
})
|
})
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
|
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
|
||||||
|
@ -208,6 +216,8 @@ const run = () => {
|
||||||
app.quit()
|
app.quit()
|
||||||
})
|
})
|
||||||
ipcMain.handle('launch', async () => {
|
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 osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
||||||
const username = await config.get('username');
|
const username = await config.get('username');
|
||||||
const password = await config.get('password');
|
const password = await config.get('password');
|
||||||
|
@ -221,13 +231,17 @@ const run = () => {
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Username", "");
|
await osuUtil.setConfigValue(osuConfig.path, "Username", "");
|
||||||
await osuUtil.setConfigValue(osuConfig.path, "Password", "");
|
await osuUtil.setConfigValue(osuConfig.path, "Password", "");
|
||||||
}
|
}
|
||||||
|
await osuUtil.replaceUI(osuFolder, true);
|
||||||
rpc.updateState("Launching osu!...");
|
rpc.updateState("Launching osu!...");
|
||||||
isIngame = true;
|
isIngame = true;
|
||||||
if (mainWindow.isVisible()) mainWindow.hide();
|
if (mainWindow.isVisible()) mainWindow.hide();
|
||||||
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => {
|
||||||
isIngame = false;
|
|
||||||
if (!mainWindow.isVisible()) mainWindow.show();
|
if (!mainWindow.isVisible()) mainWindow.show();
|
||||||
await doUpdateCheck(mainWindow);
|
setTimeout(async () => {
|
||||||
|
isIngame = false;
|
||||||
|
await osuUtil.replaceUI(osuFolder, false);
|
||||||
|
await doUpdateCheck(mainWindow);
|
||||||
|
}, 2000);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
|
@ -344,6 +358,7 @@ async function tryLogin(window) {
|
||||||
|
|
||||||
async function doUpdateCheck(window) {
|
async function doUpdateCheck(window) {
|
||||||
const osuPath = await config.get("osuPath");
|
const osuPath = await config.get("osuPath");
|
||||||
|
console.log("osuPath:", osuPath);
|
||||||
if (!osuPath || osuPath.trim == "") {
|
if (!osuPath || osuPath.trim == "") {
|
||||||
window.webContents.send('status_update', {
|
window.webContents.send('status_update', {
|
||||||
type: "missing-folder"
|
type: "missing-folder"
|
||||||
|
|
|
@ -1,53 +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;
|
--main-bg: 230deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: 'Exo 2', 'Roboto' !important;
|
font-family: 'Exo 2', 'Roboto' !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: hsl(var(--main-bg), 24%, 19%);
|
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 {
|
.launch-button-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.launch-button-section button {
|
.launch-button-section button {
|
||||||
margin-bottom: 10px;
|
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 {}
|
||||||
|
@ -55,268 +68,268 @@ body {
|
||||||
.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: 50px;
|
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 {
|
.server-logo img {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
pointer-events: 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);
|
background-image: url(https://a.ez-pp.farm/0);
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
340
osuUtil.js
340
osuUtil.js
|
@ -8,189 +8,237 @@ 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 customUIDLLPath = "";
|
||||||
|
const customUIDLLName = "ezpp!ui.dll";
|
||||||
const ignoredOsuEntities = [
|
const ignoredOsuEntities = [
|
||||||
'osu!auth.dll'
|
'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',
|
'Data',
|
||||||
'Downloads',
|
'Downloads',
|
||||||
'libEGL.dll',
|
'libEGL.dll',
|
||||||
'libGLESv2.dll',
|
'libGLESv2.dll',
|
||||||
'Logs',
|
'Logs',
|
||||||
'Microsoft.Ink.dll',
|
'Microsoft.Ink.dll',
|
||||||
'OpenTK.dll',
|
'OpenTK.dll',
|
||||||
'osu!.cfg',
|
'osu!.cfg',
|
||||||
'osu!.db',
|
'osu!.db',
|
||||||
'osu!.exe',
|
'osu!.exe',
|
||||||
'osu!auth.dll',
|
'osu!auth.dll',
|
||||||
'osu!gameplay.dll',
|
'osu!gameplay.dll',
|
||||||
'osu!seasonal.dll',
|
'osu!seasonal.dll',
|
||||||
'osu!ui.dll',
|
'osu!ui.dll',
|
||||||
'presence.db',
|
'presence.db',
|
||||||
'pthreadGC2.dll',
|
'pthreadGC2.dll',
|
||||||
'scores.db',
|
'scores.db',
|
||||||
'Skins',
|
'Skins',
|
||||||
'Songs'
|
'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 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;
|
const fileName = updatedFile.filename;
|
||||||
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;
|
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);
|
||||||
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex");
|
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex");
|
||||||
if (existingFileMD5.toLowerCase() != fileHash.toLowerCase()) {
|
if (existingFileMD5.toLowerCase() != fileHash.toLowerCase()) {
|
||||||
filesToDownload.push({
|
filesToDownload.push({
|
||||||
fileName,
|
fileName,
|
||||||
fileURL
|
fileURL
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
filesToDownload.push({
|
filesToDownload.push({
|
||||||
fileName,
|
fileName,
|
||||||
fileURL
|
fileURL
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return filesToDownload;
|
}
|
||||||
|
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);
|
const filePath = path.join(osuPath, fileToUpdate.fileName);
|
||||||
console.log(filePath);
|
console.log(filePath);
|
||||||
if (await fu.existsAsync(filePath))
|
if (await fu.existsAsync(filePath))
|
||||||
await fs.promises.rm(filePath);
|
await fs.promises.rm(filePath);
|
||||||
|
|
||||||
const fileDownload = new DownloaderHelper(fileToUpdate.fileURL, osuPath, {
|
const fileDownload = new DownloaderHelper(fileToUpdate.fileURL, osuPath, {
|
||||||
fileName: fileToUpdate.fileName,
|
fileName: fileToUpdate.fileName,
|
||||||
override: true,
|
override: true,
|
||||||
});
|
});
|
||||||
fileDownload.on('end', () => {
|
fileDownload.on('end', () => {
|
||||||
completedIndex = completedIndex + 1;
|
completedIndex = completedIndex + 1;
|
||||||
if (completedIndex >= filesToUpdate.length)
|
if (completedIndex >= filesToUpdate.length)
|
||||||
eventEmitter.emit('completed');
|
eventEmitter.emit('completed');
|
||||||
});
|
});
|
||||||
fileDownload.on('error', (err) => {
|
fileDownload.on('error', (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
eventEmitter.emit('error');
|
eventEmitter.emit('error');
|
||||||
});
|
|
||||||
|
|
||||||
fileDownload.start().catch(err => console.error(err));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
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;
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "linux":
|
case "linux":
|
||||||
executeUtil.runFile(osuPath, 'osu-stable', ["-devserver", serverDomain], onExit);
|
executeUtil.runFile(osuPath, 'osu-stable', ["-devserver", serverDomain], onExit);
|
||||||
return true;
|
return true;
|
||||||
case "win32":
|
case "win32":
|
||||||
executeUtil.runFile(osuPath, osuExe, ["-devserver", serverDomain], onExit);
|
executeUtil.runFile(osuPath, osuExe, ["-devserver", serverDomain], onExit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 findOsuInstallation() {
|
|
||||||
const regedit = require('qiao-regedit');
|
|
||||||
|
|
||||||
const osuLocationFromDefaultIcon = "HKLM\\SOFTWARE\\Classes\\osu\\DefaultIcon";
|
async function updateOsuCfg(cfgPath) {
|
||||||
const osuStruct = await regedit.listValuesSync(osuLocationFromDefaultIcon);
|
const osuFolder = path.dirname(cfgPath);
|
||||||
for (const line of osuStruct.split("\n")) {
|
const fileStream = await fs.promises.readFile(cfgPath, "utf-8");
|
||||||
if (line.includes("REG_SZ")) {
|
const lines = fileStream.split(/\r?\n/);
|
||||||
let value = (line.trim().split(" ")[2]);
|
const newLines = [];
|
||||||
value = value.substring(1, value.length - 3);
|
for (const line of lines) {
|
||||||
return value.trim();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
}
|
||||||
|
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, 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.rename(ezppUIFile, osuUIFile);
|
||||||
|
} else {
|
||||||
|
if (!fs.existsSync(osuUIFileBackup)) return;
|
||||||
|
await fs.promises.rename(osuUIFile, ezppUIFile);
|
||||||
|
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,
|
||||||
findOsuInstallation
|
findOsuInstallation, replaceUI, updateOsuCfg
|
||||||
}
|
}
|
|
@ -188,6 +188,28 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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) => {
|
ipcRenderer.on('status_update', (event, status) => {
|
||||||
switch (status.type) {
|
switch (status.type) {
|
||||||
case "up-to-date":
|
case "up-to-date":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user