Skip to content

Commit

Permalink
Update 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
1ly4s0 committed Aug 4, 2024
1 parent 61739fe commit 871b760
Show file tree
Hide file tree
Showing 64 changed files with 5,517 additions and 83 deletions.
191 changes: 135 additions & 56 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 7 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.0.2",
"buildVersion": "1003",
"description": "El mejor Launcher Personalizado para Minecraft Premium y No premium",
"main": "src/app.js",
"author": "TECNO BROS <contacto@tecnobros.es>",
Expand All @@ -25,11 +25,14 @@
"ext": "js,html,css"
},
"dependencies": {
"@distube/ytdl-core": "^4.13.5",
"@distube/ytdl-core": "^4.13.7",
"7zip-bin": "^5.2.0",
"adm-zip": "^0.5.14",
"axios": "^1.7.2",
"BattlyLauncher": "file:",
"electron-updater": "^6.2.1",
"got": "^11.8.6",
"got-cjs": "^12.5.4",
"javascript-obfuscator": "^4.1.1",
"marked": "^13.0.2",
"minecraft-launcher-core": "^3.18.1",
Expand All @@ -48,7 +51,7 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"electron": "^31.2.1",
"electron": "^31.3.1",
"electron-builder": "^24.13.3",
"nodemon": "^3.1.4"
},
Expand Down
Binary file added src/1002.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ ipcMain.handle("update-app", () => {

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

ipcMain.handle("update-new-app", async () => {
Expand All @@ -623,7 +623,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
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;
}
}
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.
203 changes: 203 additions & 0 deletions src/assets/js/libs/distube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# @distube/ytdl-core

DisTube fork of `ytdl-core`. This fork is dedicated to fixing bugs and adding features that are not merged into the original repo as soon as possible.

<a href='https://ko-fi.com/skick' target='_blank'><img height='48' src='https://storage.ko-fi.com/cdn/kofi3.png' alt='Buy Me a Coffee at ko-fi.com' /></a>

## Installation

```bash
npm install @distube/ytdl-core@latest
```

Make sure you're installing the latest version of `@distube/ytdl-core` to keep up with the latest fixes.

## Usage

```js
const ytdl = require("@distube/ytdl-core");
// TypeScript: import ytdl from '@distube/ytdl-core'; with --esModuleInterop
// TypeScript: import * as ytdl from '@distube/ytdl-core'; with --allowSyntheticDefaultImports
// TypeScript: import ytdl = require('@distube/ytdl-core'); with neither of the above

// Download a video
ytdl("http://www.youtube.com/watch?v=aqz-KE-bpKQ").pipe(require("fs").createWriteStream("video.mp4"));

// Get video info
ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ").then(info => {
console.log(info.title);
});

// Get video info with download formats
ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ").then(info => {
console.log(info.formats);
});
```

### Cookies Support

```js
const ytdl = require("@distube/ytdl-core");

// (Optional) Below are examples, NOT the recommended options
const cookies = [
{ name: "cookie1", value: "COOKIE1_HERE" },
{ name: "cookie2", value: "COOKIE2_HERE" },
];

// (Optional) http-cookie-agent / undici agent options
// Below are examples, NOT the recommended options
const agentOptions = {
pipelining: 5,
maxRedirections: 0,
localAddress: "127.0.0.1",
};

// agent should be created once if you don't want to change your cookie
const agent = ytdl.createAgent(cookies, agentOptions);

ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
```

#### How to get cookies

- Install [EditThisCookie](http://www.editthiscookie.com/) extension for your browser.
- Go to [YouTube](https://www.youtube.com/).
- Log in to your account. (You should use a new account for this purpose)
- Click on the extension icon and click "Export" icon.
- Your cookie will be added to your clipboard and paste it into your code.

```js
const ytdl = require("@distube/ytdl-core");
const agent = ytdl.createAgent([
{
domain: ".youtube.com",
expirationDate: 1234567890,
hostOnly: false,
httpOnly: true,
name: "LOGIN_INFO",
path: "/",
sameSite: "no_restriction",
secure: true,
session: false,
value: "---xxx---",
},
"...",
]);
```

- Or you can paste it into a file and use `fs.readFileSync` to read it.

```js
const ytdl = require("@distube/ytdl-core");
const fs = require("fs");
const agent = ytdl.createAgent(JSON.parse(fs.readFileSync("cookies.json")));
```

### Proxy Support

```js
const ytdl = require("@distube/ytdl-core");

const agent = ytdl.createProxyAgent({ uri: "my.proxy.server" });

ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
```

Use both proxy and cookies:

```js
const ytdl = require("@distube/ytdl-core");

const agent = ytdl.createProxyAgent({ uri: "my.proxy.server" }, [{ name: "cookie", value: "COOKIE_HERE" }]);

ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
```

### IP Rotation

_Built-in ip rotation (`getRandomIPv6`) won't be updated and will be removed in the future, create your own ip rotation instead._

To implement IP rotation, you need to assign the desired IP address to the `localAddress` property within `undici.Agent.Options`.
Therefore, you'll need to use a different `ytdl.Agent` for each IP address you want to use.

```js
const ytdl = require("@distube/ytdl-core");
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");

const agentForARandomIP = ytdl.createAgent(undefined, {
localAddress: getRandomIPv6("2001:2::/48"),
});

ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent: agentForARandomIP });

const agentForAnotherRandomIP = ytdl.createAgent(undefined, {
localAddress: getRandomIPv6("2001:2::/48"),
});

ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent: agentForAnotherRandomIP });
```

## API

You can find the API documentation in the [original repo](https://github.com/fent/node-ytdl-core#api). Except a few changes:

### `ytdl.getInfoOptions`

- `requestOptions` is now `undici`'s [`RequestOptions`](https://github.com/nodejs/undici#undicirequesturl-options-promise).
- `agent`: [`ytdl.Agent`](https://github.com/distubejs/ytdl-core/blob/master/typings/index.d.ts#L10-L14)

### `ytdl.createAgent([cookies]): ytdl.Agent`

`cookies`: an array of json cookies exported with [EditThisCookie](http://www.editthiscookie.com/).

### `ytdl.createProxyAgent(proxy[, cookies]): ytdl.Agent`

`proxy`: [`ProxyAgentOptions`](https://github.com/nodejs/undici/blob/main/docs/api/ProxyAgent.md#parameter-proxyagentoptions) contains your proxy server information.

#### How to implement `ytdl.Agent` with your own Dispatcher

You can find the example [here](https://github.com/distubejs/ytdl-core/blob/master/lib/cookie.js#L73-L86)

## Limitations

ytdl cannot download videos that fall into the following

- Regionally restricted (requires a [proxy](#proxy-support))
- Private (if you have access, requires [cookies](#cookies-support))
- Rentals (if you have access, requires [cookies](#cookies-support))
- YouTube Premium content (if you have access, requires [cookies](#cookies-support))
- Only [HLS Livestreams](https://en.wikipedia.org/wiki/HTTP_Live_Streaming) are currently supported. Other formats will get filtered out in ytdl.chooseFormats

Generated download links are valid for 6 hours, and may only be downloadable from the same IP address.

## Rate Limiting

When doing too many requests YouTube might block. This will result in your requests getting denied with HTTP-StatusCode 429. The following steps might help you:

- Update `@distube/ytdl-core` to the latest version
- Use proxies (you can find an example [here](#proxy-support))
- Extend the Proxy Idea by rotating (IPv6-)Addresses
- read [this](https://github.com/fent/node-ytdl-core#how-does-using-an-ipv6-block-help) for more information about this
- Use cookies (you can find an example [here](#cookies-support))
- for this to take effect you have to FIRST wait for the current rate limit to expire
- Wait it out (it usually goes away within a few days)

## Update Checks

The issue of using an outdated version of ytdl-core became so prevalent, that ytdl-core now checks for updates at run time, and every 12 hours. If it finds an update, it will print a warning to the console advising you to update. Due to the nature of this library, it is important to always use the latest version as YouTube continues to update.

If you'd like to disable this update check, you can do so by providing the `YTDL_NO_UPDATE` env variable.

```
env YTDL_NO_UPDATE=1 node myapp.js
```

## Related Projects

- [DisTube](https://github.com/skick1234/DisTube) - A Discord.js module to simplify your music commands and play songs with audio filters on Discord without any API key.
- [@distube/ytsr](https://github.com/distubejs/ytsr) - DisTube fork of [ytsr](https://github.com/TimeForANinja/node-ytsr).
- [@distube/ytpl](https://github.com/distubejs/ytpl) - DisTube fork of [ytpl](https://github.com/TimeForANinja/node-ytpl).
Loading

0 comments on commit 871b760

Please sign in to comment.