Skip to content

Commit

Permalink
Update 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
1ly4s0 committed Aug 25, 2024
1 parent 7f92de4 commit 701019a
Show file tree
Hide file tree
Showing 76 changed files with 7,782 additions and 1,868 deletions.
3,179 changes: 1,760 additions & 1,419 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "BattlyLauncher",
"productname": "Battly Launcher",
"version": "2.0.1",
"buildVersion": "1000",
"version": "2.1.0",
"buildVersion": "1003",
"description": "El mejor Launcher Personalizado para Minecraft Premium y No premium",
"main": "src/app.js",
"author": "TECNO BROS <[email protected]>",
Expand All @@ -25,11 +25,13 @@
"ext": "js,html,css"
},
"dependencies": {
"@distube/ytdl-core": "^4.13.5",
"@distube/ytdl-core": "^4.14.4",
"7zip-bin": "^5.2.0",
"adm-zip": "^0.5.14",
"axios": "^1.7.2",
"electron-updater": "^6.2.1",
"fs-extra": "^11.2.0",
"got": "^11.8.6",
"javascript-obfuscator": "^4.1.1",
"marked": "^13.0.2",
"minecraft-launcher-core": "^3.18.1",
Expand All @@ -48,7 +50,7 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"electron": "^22.3.27",
"electron": "^32.0.1",
"electron-builder": "^24.13.3",
"nodemon": "^3.1.4"
},
Expand Down
24 changes: 19 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,21 @@ if (!gotTheLock) {
app.quit();
} else {
app.whenReady().then(() => {
UpdateWindow.createWindow();
if (fs.existsSync(path.join(dataDirectory, ".battly/launchboost"))) {
fetch("https://api.battlylauncher.com/launcher/config-launcher/config.json").then(async res => {
let data = await res.json();
let version = data.latestVersion;
let actualVersion = (require("../package.json")).version;

if (actualVersion != version) {
const updateWindow = UpdateWindow.createWindow();
} else {
MainWindow.createWindow();
}
});
} else {
UpdateWindow.createWindow();
}
});
}

Expand Down Expand Up @@ -609,10 +623,10 @@ ipcMain.handle("update-app", () => {

const pkgVersion = async () => {
const pkg = {
version: "2.0.1",
buildVersion: 1001
version: "2.1.0",
buildVersion: 1004
};
return JSON.parse(pkg);
return pkg;
};

ipcMain.handle("update-new-app", async () => {
Expand All @@ -623,7 +637,7 @@ ipcMain.handle("update-new-app", async () => {
let data = await res.json();
let version = data.battly.release;

let actualBuild = (await pkgVersion()).buildVersion;
let actualBuild = (pkgVersion()).buildVersion;

if (actualBuild != version.latest_build) {
resolve();
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
html,
body {
height: 100%;
overflow: hidden;
overflow: hidden !important;
}

body {
Expand Down
84 changes: 84 additions & 0 deletions src/assets/css/panels/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,87 @@ div {
font-weight: bold !important;
}
}

/* Hide the default checkbox */
.container-optifine input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}

.container-optifine {
display: flex;
position: relative;
cursor: pointer;
font-size: 1.2rem;
user-select: none;
align-content: center;
flex-wrap: wrap;
gap: 5px;
margin-left: 5px;
}

/* Create a custom checkbox */
.checkmark {
--clr: #3e8ed0;
position: relative;
top: 0;
left: 0;
height: 1.1em;
width: 1.1em;
background-color: #ccc;
border-radius: 50%;
transition: 300ms;
}

/* When the checkbox is checked, add a blue background */
.container-optifine input:checked ~ .checkmark {
background-color: var(--clr);
border-radius: 0.5rem;
animation: pulse1 500ms ease-in-out;
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}

/* Show the checkmark when checked */
.container-optifine input:checked ~ .checkmark:after {
display: block;
}

/* Style the checkmark/indicator */
.container-optifine .checkmark:after {
left: 0.45em;
top: 0.25em;
width: 0.25em;
height: 0.5em;
border: solid #e0e0e2;
border-width: 0 0.15em 0.15em 0;
transform: rotate(45deg);
}

@keyframes pulse1 {
0% {
box-shadow: 0 0 0 #3e8ed0;
rotate: 20deg;
}

50% {
rotate: -20deg;
}

75% {
box-shadow: 0 0 0 10px #227cc5;
}

100% {
box-shadow: 0 0 0 13px #3e8ed0;
rotate: 0;
}
}
46 changes: 32 additions & 14 deletions src/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ let dev = process.env.NODE_ENV === 'dev';
const fs = require('fs');
const fetch = require('node-fetch');
const axios = require("axios");
import { Lang } from './utils/lang.js';
let lang;
const { Lang } = require('./assets/js/utils/lang.js');
let lang;;
new Lang().GetLang().then(lang_ => {
lang = lang_;
}).catch(error => {
console.error("Error:", error);
});

let message;

class Splash {

Expand All @@ -31,8 +38,6 @@ class Splash {
}

async LoadLang() {
lang = await new Lang().GetLang();
this.message.innerHTML = lang.salutate;
}

async start() {
Expand All @@ -41,7 +46,20 @@ class Splash {
"author": "TECNO BROS"
},]

console.log(document.getElementById("version_id"));

let strings = {
"es": "¡Hola!",
"en": "Hello!",
"fr": "Bonjour!",
"de": "Hallo!",
"it": "Ciao!",
"pt": "Olá!",
"ru": "Привет!",
"ja": "こんにちは!",
"ar": "مرحبا!",
}

this.message.innerHTML = strings[localStorage.getItem("lang")];

let sonidoDB = localStorage.getItem("sonido-inicio") ? localStorage.getItem("sonido-inicio") : "start";
let sonido_inicio = new Audio('./assets/audios/' + sonidoDB + '.mp3');
Expand Down Expand Up @@ -101,15 +119,15 @@ class Splash {
}
})

ipcRenderer.invoke('update-new-app').then(err => {
if (err) {
if (err.error) {
let error = err.message;
error = error.toString().slice(0, 50);
this.shutdown(`${lang.update_error}<br>${error}`);
}
}
})
// ipcRenderer.invoke('update-new-app').then(err => {
// if (err) {
// if (err.error) {
// let error = err.message;
// error = error.toString().slice(0, 50);
// this.shutdown(`${lang.update_error}<br>${error}`);
// }
// }
// })

ipcRenderer.on('updateAvailable', () => {
this.setStatus(lang.update_available);
Expand Down
48 changes: 30 additions & 18 deletions src/assets/js/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const fs = require("fs");
const { Microsoft, Mojang } = require("./assets/js/libs/mc/Index");
const { ipcRenderer } = require("electron");

const { Lang } = require("./assets/js/utils/lang.js");


import {
config,
logger,
Expand All @@ -18,6 +21,7 @@ import {
addAccount,
accountSelect,
} from "./utils.js";

import Login from "./panels/login.js";
import Home from "./panels/home.js";
import Settings from "./panels/settings.js";
Expand All @@ -29,29 +33,37 @@ import Friends from "./panels/friends.js";
import Chat from "./panels/chat.js";
import Servers from "./panels/servers.js";


class Launcher {
async init() {
const loadingText = document.getElementById("loading-text");
loadingText.innerHTML = "Cargando Panel de Inicio";
this.initLog();
console.log("🔄 Iniciando Launcher...");
if (process.platform == "win32") this.initFrame();
this.config = await config.GetConfig().then((res) => res);
this.news = await config.GetNews().then((res) => res);
this.database = await new database().init();
this.createPanels(
Login,
Home,
Settings,
Welcome,
Mods,
Music,
NewsPanel,
Friends,
Chat,
Servers
);
this.getaccounts();
new Lang().GetLang().then(async (lang) => {
console.log("🔄 Iniciando Lang...");
console.log(lang)
if (process.platform == "win32") this.initFrame();
this.config = await config.GetConfig().then((res) => res);
this.news = await config.GetNews().then((res) => res);
this.database = await new database().init();
this.createPanels(
Login,
Home,
Settings,
Welcome,
Mods,
Music,
NewsPanel,
Friends,
Chat,
Servers
);
this.getaccounts();
}).catch(error => {
console.error("Error:", error);
});

}

initLog() {
Expand Down Expand Up @@ -170,7 +182,7 @@ class Launcher {
)
.then((response) => response.json())
.then((data) => data)
.catch((err) => {});
.catch((err) => { });
} catch (error) {
premiums = [];
}
Expand Down
21 changes: 21 additions & 0 deletions src/assets/js/libs/distube/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (C) 2012-present by fent

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 701019a

Please sign in to comment.