Skip to content

Commit

Permalink
Update 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
1ly4s0 committed Oct 20, 2024
1 parent 67fb773 commit 2f00047
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 65 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "BattlyLauncher",
"productname": "Battly Launcher",
"version": "2.2.0",
"version": "2.3.0",
"buildVersion": "1003",
"description": "El mejor Launcher Personalizado para Minecraft Premium y No premium",
"main": "src/app.js",
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ ipcMain.handle("update-app", () => {

const pkgVersion = async () => {
const pkg = {
version: "2.2.0",
version: "2.3.0",
buildVersion: 1004
};
return pkg;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/panels/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

.modal-card-body::-webkit-scrollbar {
width: var(--scroll-size, 15px);
width: var(--scroll-size, 10px);
}

.modal-card-body::-webkit-scrollbar-thumb {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/panels/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ section {
width: 500px;
height: 100px;
margin: 1% 2%;
border-radius: 5px;
border-radius: 10px;
text-align: start;
color: #fff;
cursor: pointer;
Expand Down
8 changes: 4 additions & 4 deletions src/assets/js/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ class Launcher {

this.database.update(refresh_accounts, "accounts");
this.database.update(refresh_profile, "profile");
addAccount(refresh_accounts);
addAccount(refresh_accounts, false, true);
if (account.uuid === selectaccount) accountSelect(refresh.uuid);
} else if (account.meta.type === "Mojang") {
if (account.meta.offline) {
document.querySelector(".preload-content").style.display = "block";
console.log(
`🔄 Iniciando cuenta de Mojang con el nombre de ususario ${account.name}...`
);
addAccount(account);
addAccount(account, false, true);
if (account.uuid === selectaccount) accountSelect(account.uuid);
continue;
}
Expand Down Expand Up @@ -278,7 +278,7 @@ class Launcher {
};

this.database.update(refresh_accounts, "accounts");
addAccount(refresh_accounts);
addAccount(refresh_accounts, false, true);
if (account.uuid === selectaccount) accountSelect(refresh.uuid);
} else if (account.meta.type === "cracked") {
console.log(
Expand All @@ -287,7 +287,7 @@ class Launcher {
let isPremium;
if (!premiums) isPremium = false;
else isPremium = premiums.includes(account.name);
addAccount(account, isPremium);
addAccount(account, isPremium, false);
if (account.uuid === selectaccount) accountSelect(account.uuid);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/assets/js/libs/mc/Launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ class Launch extends events_1.EventEmitter {
try {
if (fs_1.default.existsSync(asset.path)) {
const fileHash = await calculateFileHash(asset.path);
if (fileHash === asset.hash) {
console.log(`File ${asset.path} already exists and matches hash, skipping download.`);
if (fileHash === asset.sha1) {
console.info(`File ${asset.path} already exists and matches hash, skipping download.`);
continue;
}
else {
Expand Down
64 changes: 61 additions & 3 deletions src/assets/js/panels/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2536,6 +2536,7 @@ class Home {
let version_optifine = version.replace(/OptiFine.*$/, "OptiFine");
option.value = version + `-extra`;
option.innerHTML = version_optifine;
option.setAttribute("requiredJavaVersion", this.Versions.versions.find((v) => v.version === version_optifine.toLowerCase()).requiredJavaVersion);
versiones.appendChild(option);
} else {
option.value = version + `-extra`;
Expand All @@ -2550,7 +2551,8 @@ class Home {
}
}
} catch (error) {
console.error("Error al cargar versiones: ", error);
console.error("Error al cargar versiones");
console.error(error);
}
}

Expand Down Expand Up @@ -3246,6 +3248,7 @@ class Home {
.getElementById("startStartVersion")
.addEventListener("click", async () => {
let version = document.getElementById("listaDeVersiones").value;
let requiredJavaVersion = document.getElementById("listaDeVersiones").selectedOptions[0].getAttribute("requiredJavaVersion");
console.log(version);
let versionType;
let progressBar1 = document.getElementById("progressBar1_");
Expand Down Expand Up @@ -3439,7 +3442,62 @@ class Home {

console.log(`✅ Versión detectada: ${version}`);

const javapath = localStorage.getItem("java-path");
async function CheckAndDownloadJava() {
let folders = fs.readdirSync(`${dataDirectory}/.battly/runtime`);
let found = false;
let realJavaVersion;
folders.forEach((folder) => {
if (folder.startsWith(requiredJavaVersion)) {
found = true;
realJavaVersion = folder;
}
});

if (!found) {
console.log(document.getElementById("listaDeVersiones").value);
if (version.includes("OptiFine")) {
new Alert().ShowAlert({
icon: "error",
title: langs.download_the_version_in_vanilla,
text: langs.download_the_version_in_vanilla_text,
});
}

return false;
} else {
const inputRutaJava =
document.getElementById("ruta-java-input");
if (process.platform === "win32") {
let javaPath = `${dataDirectory}/.battly/runtime/${realJavaVersion}/bin/java.exe`;
if (fs.existsSync(javaPath)) {
inputRutaJava.value = javaPath;
localStorage.setItem("java-path", javaPath);
console.log(`Java reconfigurado a ${javaPath}`);
} else {
inputRutaJava.value =
"Java no encontrado. Haz click aquí para buscarlo.";
}
} else {
let javaPath = `${dataDirectory}/.battly/runtime/${realJavaVersion}/bin/java`;
if (fs.existsSync(javaPath)) {
inputRutaJava.value = javaPath;
localStorage.setItem("java-path", javaPath);
} else {
inputRutaJava.value =
"Java no encontrado. Haz click aquí para buscarlo.";
}
}
}

return true;
}


let javapath;
if (await CheckAndDownloadJava()) {
javapath = localStorage.getItem("java-path");
}

const isExtra = version.endsWith("-extra");
const gameUrl = this.config.game_url || `${urlpkg}/files`;
const rootPath = `${dataDirectory}/.battly`;
Expand Down Expand Up @@ -3944,7 +4002,7 @@ class Home {

launch_core.on("error", (err) => {
consoleOutput_ += `[ERROR] ${JSON.stringify(err, null, 2)}\n`;
console.error(error.message);
console.error(err.message);
progressBar1.style.display = "none";
info.style.display = "none";
playBtn.style.display = "";
Expand Down
8 changes: 4 additions & 4 deletions src/assets/js/panels/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ class Login {
meta: account_connect.meta
}

this.database.addAccount(account)
this.database.addAccount(account);
this.database.update({ uuid: "1234", selected: account.uuid }, 'accounts-selected');

addAccount(account)
addAccount(account, false, true);
accountSelect(account.uuid)

let news_shown = localStorage.getItem("news_shown_v2.0");
Expand Down Expand Up @@ -268,7 +268,7 @@ class Login {
let isPremium;
if (!premiums) isPremium = false;
else isPremium = premiums.includes(account.name);
addAccount(account, isPremium);
addAccount(account, isPremium, false);

document.getElementById("code-login-panel").classList.remove("is-active");
document.getElementById("code-text").value = "";
Expand Down Expand Up @@ -484,7 +484,7 @@ class Login {
let isPremium;
if (!premiums) isPremium = false;
else isPremium = premiums.includes(account.name);
addAccount(account, isPremium);
addAccount(account, isPremium, false);

if (isPremium) {
document.getElementById("header-text-to-add").innerHTML = "Premium Edition";
Expand Down
Loading

0 comments on commit 2f00047

Please sign in to comment.