Skip to content

Commit

Permalink
Migrate to Vite bundler
Browse files Browse the repository at this point in the history
Periodic setting of nitro status
  • Loading branch information
D4n13l3k00 committed Mar 6, 2024
1 parent 5e62a90 commit ba35f4f
Show file tree
Hide file tree
Showing 10 changed files with 1,937 additions and 128 deletions.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 21

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Upload files to a GitHub release
uses: svenstaro/upload-release-action@2.9.0
with:
file: dist/NitroStreams.plugin.js
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
NitroStreams.plugin.js
yarn.lock
dist/
yarn-error.log
9 changes: 0 additions & 9 deletions NitroStreams.min.plugin.js

This file was deleted.

20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
# NitroStreams
<div align="center">

# 🍭 NitroStreams

![GitHub License](https://img.shields.io/github/license/D4n13l3k00/NitroStreams)

![GitHub Last Commit](https://img.shields.io/github/last-commit/D4n13l3k00/NitroStreams)
![GitHub package.json version](https://img.shields.io/github/package-json/v/D4n13l3k00/NitroStreams)


</div>

Плагин для [BetterDiscord](https://betterdiscord.app), позволяющий стримить с качеством `Истотчник | 60fps`

По сути он активирует возможности Nitro, но работают только стримы (серверные ограничения)

### Сборка
## 📩 Установка

1. Скачайте последний релиз `NitroStreams.plugin.js` [отсюда](https://github.com/D4n13l3k00/nitrostreams/releases)
2. Переместите файл в папку с плагинами BetterDiscord
3. ...Profit!

## 📦 Сборка

```shell
yarn # or npm i
Expand Down
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"scripts": {
"build": "babel NitroStreams.jsx -o NitroStreams.plugin.js && terser NitroStreams.plugin.js -o NitroStreams.min.plugin.js"
"name": "nitrostreams",
"version": "1.1.0",
"description": "Enables Nitro streams in Discord",
"author": {
"name": "Daniel",
"email": "D4n13l3k00@yandex.ru"
},
"type": "module",
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9",
"@babel/plugin-transform-react-jsx": "^7.17.3",
"babel-loader": "^8.2.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"terser": "^5.12.1"
"terser": "^5.12.1",
"vite": "^5.1.5",
"vite-plugin-singlefile": "^2.0.1"
},
"scripts": {
"build": "vite build --mode production",
"dev-watch": "vite build --mode development --watch",
"dev": "vite build --mode development"
}
}
}
8 changes: 8 additions & 0 deletions plugin.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "NitroStreams",
"version": "1.1.0",
"description": "Acticvation of Nitro Streams",

"author": "D4n13l3k00",
"website": "https://t.me/D4n13l3k00"
}
199 changes: 104 additions & 95 deletions NitroStreams.jsx → src/NitroStreams.jsx
Original file line number Diff line number Diff line change
@@ -1,95 +1,104 @@
/**!
* @name NitroStreams
* @version 1.0.0
* @description Acticvation of Nitro Streams
* @author D4n13l3k00
*
* @website https://t.me/D4n13l3k00
*/

module.exports = class NitroStreams {
showInfo() {
BdApi.alert(
"NitroStreams",
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
fontSize: "14px",
fontWeight: "500",
color: "var(--interactive-normal)",
lineHeight: "16px",
textTransform: "uppercase",
marginTop: "10px",
marginBottom: "5px",
}}
>
<img
src="https://discord.com/assets/ff5b4f3466b1e217ba845ce0540da563.png"
alt=""
style={{ width: "100%" }}
/>
<h6
style={{
marginTop: "10px",
marginBottom: "5px",
}}
>
Made with ❤ by D4n13l3k00
</h6>
</div>
);
}

load() {
if (BdApi.loadData("NitroStreams", "loaded") !== true) {
this.showInfo();
BdApi.saveData("NitroStreams", "loaded", true);
}
}

caption() {
let qualitySettingsContainer = document.querySelector(
"div[class^='qualitySettingsContainer']"
);
let caption = document.getElementsByClassName("NitroStreams-caption");
if (qualitySettingsContainer !== null && caption.length === 0) {
let _h6 = (
<h6
style={{
marginTop: "10px",
marginBottom: "5px",
fontSize: "14px",
fontWeight: "500",
color: "var(--interactive-normal)",
lineHeight: "16px",
textTransform: "uppercase",
textAlign: "center",
}}
className="NitroStreams-caption"
>
Made with ❤ by D4n13l3k00
</h6>
);
const output = document.createElement("div");
BdApi.ReactDOM.render(_h6, output);
qualitySettingsContainer.appendChild(output);
}
}

start() {
this.old_account_type =
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType;
this.interval = setInterval(this.caption, 10);
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType = 2;
}

stop() {
clearInterval(this.interval);
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType =
this.old_account_type;
}
};
/**!
* @name NitroStreams
* @version 1.0.0
* @description Acticvation of Nitro Streams
* @author D4n13l3k00
*
* @website https://t.me/D4n13l3k00
*/

module.exports = class NitroStreams {
uiInjectInterval = null;
nitroInterval = null;

showInfo() {
BdApi.alert(
"NitroStreams",
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
fontSize: "14px",
fontWeight: "500",
color: "var(--interactive-normal)",
lineHeight: "16px",
textTransform: "uppercase",
marginTop: "10px",
marginBottom: "5px",
}}
>
<img
src="https://discord.com/assets/ff5b4f3466b1e217ba845ce0540da563.png"
alt=""
style={{ width: "100%" }}
/>
<h6
style={{
marginTop: "10px",
marginBottom: "5px",
}}
>
Made with ❤ by D4n13l3k00
</h6>
</div>
);
}

load() {
if (BdApi.loadData("NitroStreams", "loaded") !== true) {
this.showInfo();
BdApi.saveData("NitroStreams", "loaded", true);
}
}

caption() {
let qualitySettingsContainer = document.querySelector(
"div[class^='qualitySettingsContainer']"
);
let caption = document.getElementsByClassName("NitroStreams-caption");
if (qualitySettingsContainer !== null && caption.length === 0) {
let _h6 = (
<h6
style={{
marginTop: "10px",
marginBottom: "5px",
fontSize: "14px",
fontWeight: "500",
color: "var(--interactive-normal)",
lineHeight: "16px",
textTransform: "uppercase",
textAlign: "center",
}}
className="NitroStreams-caption"
>
Made with ❤ by D4n13l3k00
</h6>
);
const output = document.createElement("div");
BdApi.ReactDOM.render(_h6, output);
qualitySettingsContainer.appendChild(output);
}
}

setNitro() {
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType = 2;
}

start() {
this.old_account_type =
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType;
this.uiInjectInterval = setInterval(this.caption, 500);
this.setNitro();
this.nitroInterval = setInterval(this.setNitro, 5000);
}

stop() {
clearInterval(this.uiInjectInterval);
clearInterval(this.nitroInterval);
BdApi.findModuleByProps("getCurrentUser").getCurrentUser().premiumType =
this.old_account_type;
}
};
Loading

0 comments on commit ba35f4f

Please sign in to comment.