Add nitro bypass (#4)
This commit is contained in:
parent
a7ccbcfca4
commit
c3ff092162
1
.vscode/settings.json
vendored
Normal file
1
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -7,6 +7,7 @@
|
|||
"esbuild": "^0.15.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"discord-types": "^1.3.26",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"jsposed": "^1.0.2",
|
||||
"prettier": "^2.7.1"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
lockfileVersion: 5.3
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@types/flux': ^3.1.11
|
||||
'@types/node': ^18.7.13
|
||||
'@types/react': ^18.0.17
|
||||
discord-types: ^1.3.26
|
||||
electron: ^20.1.0
|
||||
electron-devtools-installer: ^3.2.0
|
||||
esbuild: ^0.15.5
|
||||
|
@ -11,6 +12,7 @@ specifiers:
|
|||
prettier: ^2.7.1
|
||||
|
||||
dependencies:
|
||||
discord-types: 1.3.26
|
||||
electron-devtools-installer: 3.2.0
|
||||
jsposed: 1.0.2
|
||||
prettier: 2.7.1
|
||||
|
@ -74,6 +76,12 @@ packages:
|
|||
'@types/react': 18.0.17
|
||||
dev: true
|
||||
|
||||
/@types/keyv/3.1.4:
|
||||
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
|
||||
dependencies:
|
||||
'@types/node': 18.7.13
|
||||
dev: true
|
||||
|
||||
/@types/node/16.11.56:
|
||||
resolution: {integrity: sha512-aFcUkv7EddxxOa/9f74DINReQ/celqH8DiB3fRYgVDM2Xm5QJL8sl80QKuAnGvwAsMn+H3IFA6WCrQh1CY7m1A==}
|
||||
dev: true
|
||||
|
@ -84,7 +92,13 @@ packages:
|
|||
|
||||
/@types/prop-types/15.7.5:
|
||||
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
|
||||
dev: true
|
||||
|
||||
/@types/react/17.0.2:
|
||||
resolution: {integrity: sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==}
|
||||
dependencies:
|
||||
'@types/prop-types': 15.7.5
|
||||
csstype: 3.1.0
|
||||
dev: false
|
||||
|
||||
/@types/react/18.0.17:
|
||||
resolution: {integrity: sha512-38ETy4tL+rn4uQQi7mB81G7V1g0u2ryquNmsVIOKUAEIDK+3CUjZ6rSRpdvS99dNBnkLFL83qfmtLacGOTIhwQ==}
|
||||
|
@ -94,6 +108,12 @@ packages:
|
|||
csstype: 3.1.0
|
||||
dev: true
|
||||
|
||||
/@types/responselike/1.0.0:
|
||||
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
|
||||
dependencies:
|
||||
'@types/node': 18.7.13
|
||||
dev: true
|
||||
|
||||
/@types/scheduler/0.16.2:
|
||||
resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==}
|
||||
dev: true
|
||||
|
@ -163,7 +183,6 @@ packages:
|
|||
|
||||
/csstype/3.1.0:
|
||||
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
|
||||
dev: true
|
||||
|
||||
/debug/4.3.4:
|
||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||
|
@ -202,6 +221,13 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/discord-types/1.3.26:
|
||||
resolution: {integrity: sha512-ToG51AOCH+JTQf7b+8vuYQe5Iqwz7nZ7StpECAZ/VZcI1ZhQk13pvt9KkRTfRv1xNvwJ2qib4e3+RifQlo8VPQ==}
|
||||
dependencies:
|
||||
'@types/react': 17.0.2
|
||||
moment: 2.29.4
|
||||
dev: false
|
||||
|
||||
/duplexer3/0.1.5:
|
||||
resolution: {integrity: sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==}
|
||||
dev: true
|
||||
|
@ -577,6 +603,8 @@ packages:
|
|||
dependencies:
|
||||
'@sindresorhus/is': 0.14.0
|
||||
'@szmarczak/http-timer': 1.1.2
|
||||
'@types/keyv': 3.1.4
|
||||
'@types/responselike': 1.0.0
|
||||
cacheable-request: 6.1.0
|
||||
decompress-response: 3.3.0
|
||||
duplexer3: 0.1.5
|
||||
|
@ -732,6 +760,10 @@ packages:
|
|||
minimist: 1.2.6
|
||||
dev: false
|
||||
|
||||
/moment/2.29.4:
|
||||
resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
|
||||
dev: false
|
||||
|
||||
/ms/2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: true
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
type Listener = (message, channel, event) => void;
|
||||
|
||||
const listeners = new Set<Listener>();
|
||||
|
||||
export function _handleClick(message, channel, event) {
|
||||
for (const listener of listeners) {
|
||||
listener(message, channel, event);
|
||||
}
|
||||
}
|
||||
|
||||
export function addListener(listener: Listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
export function removeListener(listener: Listener) {
|
||||
return listeners.delete(listener);
|
||||
}
|
73
src/api/MessageEvents.ts
Normal file
73
src/api/MessageEvents.ts
Normal file
|
@ -0,0 +1,73 @@
|
|||
import type { Message, Channel } from 'discord-types/general';
|
||||
import Logger from '../utils/logger';
|
||||
|
||||
const MessageEventsLogger = new Logger("MessageEvents", "#e5c890");
|
||||
|
||||
interface Emoji {
|
||||
require_colons: boolean,
|
||||
originalName: string,
|
||||
animated: boolean
|
||||
guildId: string,
|
||||
name: string,
|
||||
url: string,
|
||||
id: string,
|
||||
}
|
||||
|
||||
interface MessageObject {
|
||||
content: string,
|
||||
validNonShortcutEmojis: Emoji[]
|
||||
}
|
||||
|
||||
type SendListener = (channelId: string, messageObj: MessageObject, extra: any) => void;
|
||||
type EditListener = (channelId: string, messageId: string, messageObj: MessageObject) => void;
|
||||
|
||||
const sendListeners = new Set<SendListener>();
|
||||
const editListeners = new Set<EditListener>();
|
||||
|
||||
export function _handlePreSend(channelId: string, messageObj: MessageObject, extra: any) {
|
||||
for (const listener of sendListeners) {
|
||||
try {
|
||||
listener(channelId, messageObj, extra);
|
||||
} catch (e) { MessageEventsLogger.error(`MessageSendHandler: Listener encoutered an unknown error. (${e})`) }
|
||||
}
|
||||
}
|
||||
|
||||
export function _handlePreEdit(channeld: string, messageId: string, messageObj: MessageObject) {
|
||||
for (const listener of editListeners) {
|
||||
try {
|
||||
listener(channeld, messageId, messageObj);
|
||||
} catch (e) { MessageEventsLogger.error(`MessageEditHandler: Listener encoutered an unknown error. (${e})`) }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This event fires off before a message is sent, allowing you to edit the message.
|
||||
*/
|
||||
export function addPreSendListener(listener: SendListener) { sendListeners.add(listener) }
|
||||
/**
|
||||
* Note: This event fires off before a message's edit is applied, allowing you to further edit the message.
|
||||
*/
|
||||
export function addPreEditListener(listener: EditListener) { editListeners.add(listener) }
|
||||
export function removePreSendListener(listener: SendListener) { sendListeners.delete(listener) }
|
||||
export function removePreEditListener(listener: EditListener) { editListeners.delete(listener) }
|
||||
|
||||
// Message clicks
|
||||
type ClickListener = (message: Message, channel: Channel, event: MouseEvent) => void;
|
||||
|
||||
const listeners = new Set<ClickListener>();
|
||||
|
||||
export function _handleClick(message, channel, event) {
|
||||
for (const listener of listeners) {
|
||||
try {
|
||||
listener(message, channel, event);
|
||||
} catch (e) { MessageEventsLogger.error(`MessageClickHandler: Listener encoutered an unknown error. (${e})`) }
|
||||
}
|
||||
}
|
||||
|
||||
export function addClickListener(listener: ClickListener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
export function removeClickListener(listener: ClickListener) {
|
||||
return listeners.delete(listener);
|
||||
}
|
|
@ -1 +1 @@
|
|||
export * as MessageClicks from "./MessageClicks";
|
||||
export * as MessageEvents from "./MessageEvents";
|
|
@ -3,8 +3,10 @@ import electron, { app, BrowserWindowConstructorOptions } from "electron";
|
|||
import installExt, { REACT_DEVELOPER_TOOLS } from "electron-devtools-installer";
|
||||
import { join } from "path";
|
||||
import { initIpc } from './ipcMain';
|
||||
import Logger from "./utils/logger";
|
||||
|
||||
console.log("[Vencord] Starting up...");
|
||||
const logger = new Logger("Patcher", "#700b90")
|
||||
logger.log("[Vencord] Starting up...");
|
||||
|
||||
class BrowserWindow extends electron.BrowserWindow {
|
||||
constructor(options: BrowserWindowConstructorOptions) {
|
||||
|
@ -48,8 +50,8 @@ process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord");
|
|||
|
||||
electron.app.whenReady().then(() => {
|
||||
installExt(REACT_DEVELOPER_TOOLS)
|
||||
.then(() => console.log("Installed React DevTools"))
|
||||
.catch((err) => console.error("Failed to install React DevTools", err));
|
||||
.then(() => logger.log("Installed React DevTools"))
|
||||
.catch((err) => logger.error("Failed to install React DevTools", err));
|
||||
|
||||
// Remove CSP
|
||||
electron.session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, url }, cb) => {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import definePlugin from "../utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "MessageClicksApi",
|
||||
description: "Api required by anything using message click actions",
|
||||
author: "Vendicated",
|
||||
patches: [{
|
||||
find: "if(e.altKey){",
|
||||
replacement: {
|
||||
match: /\.useClickMessage=function\((.{1,2}),(.{1,2})\).+?function\((.{1,2})\){/,
|
||||
replace: (m, message, channel, event) =>
|
||||
// the message param is shadowed by the event param, so need to alias them
|
||||
`${m.replace("{", `{var _msg=${message};var _chan=${channel};`)}Vencord.Api.MessageClicks._handleClick(_msg, _chan, ${event});`
|
||||
}
|
||||
}]
|
||||
});
|
28
src/plugins/apiMessageEvents.ts
Normal file
28
src/plugins/apiMessageEvents.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import definePlugin from "../utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "MessageEventsAPI",
|
||||
description: "Api required by anything using message events.",
|
||||
author: "ArjixWasTaken",
|
||||
patches: [
|
||||
{
|
||||
find: "sendMessage:function",
|
||||
replacement: [{
|
||||
match: /(?<=sendMessage:function\(.{1,2},.{1,2},.{1,2},.{1,2}\)){/,
|
||||
replace: "{Vencord.Api.MessageEvents._handlePreSend(...arguments);"
|
||||
}, {
|
||||
match: /(?<=editMessage:function\(.{1,2},.{1,2},.{1,2}\)){/,
|
||||
replace: "{Vencord.Api.MessageEvents._handlePreEdit(...arguments);"
|
||||
}]
|
||||
},
|
||||
{
|
||||
find: "if(e.altKey){",
|
||||
replacement: {
|
||||
match: /\.useClickMessage=function\((.{1,2}),(.{1,2})\).+?function\((.{1,2})\){/,
|
||||
replace: (m, message, channel, event) =>
|
||||
// the message param is shadowed by the event param, so need to alias them
|
||||
`${m.replace("{", `{var _msg=${message};var _chan=${channel};`)}Vencord.Api.MessageEvents._handleClick(_msg, _chan, ${event});`
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
import { MessageClicks } from "../api";
|
||||
import { addClickListener } from "../api/MessageEvents";
|
||||
import definePlugin from "../utils/types";
|
||||
import { find, findByProps } from "../webpack";
|
||||
|
||||
|
@ -21,7 +21,7 @@ export default definePlugin({
|
|||
if (e.key === "Backspace") isDeletePressed = false;
|
||||
});
|
||||
|
||||
MessageClicks.addListener((msg, chan, event) => {
|
||||
addClickListener((msg, chan, event) => {
|
||||
const isMe = msg.author.id === getCurrentUser().id;
|
||||
if (!isDeletePressed) {
|
||||
if (isMe && event.detail >= 2) {
|
||||
|
|
58
src/plugins/nitroBypass.ts
Normal file
58
src/plugins/nitroBypass.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { addPreSendListener, addPreEditListener } from "../api/MessageEvents";
|
||||
import { findByProps } from "../utils/webpack";
|
||||
import definePlugin from "../utils/types"
|
||||
|
||||
export default definePlugin({
|
||||
name: "Nitro Bypass",
|
||||
author: "ArjixWasTaken",
|
||||
description: "Allows you to stream in nitro quality and send fake emojis.",
|
||||
patches: [
|
||||
{
|
||||
find: `canUseAnimatedEmojis:function`,
|
||||
replacement: [
|
||||
"canUseAnimatedEmojis",
|
||||
"canUseEmojisEverywhere",
|
||||
"canUseHigherFramerate"
|
||||
].map(func => {
|
||||
return {
|
||||
match: new RegExp(`${func}:function\\(.+?}`),
|
||||
replace: `${func}:function (e) { return true; }`
|
||||
}
|
||||
})
|
||||
},
|
||||
],
|
||||
start() {
|
||||
const { getCustomEmojiById } = findByProps("getCustomEmojiById");
|
||||
|
||||
// Remove any nitro requirements for any of the streaming settings.
|
||||
findByProps("ApplicationStreamPresets")
|
||||
.ApplicationStreamSettingRequirements
|
||||
.forEach(x => {
|
||||
delete x.userPremiumType;
|
||||
delete x.guildPremiumTier
|
||||
});
|
||||
|
||||
addPreSendListener((_, messageObj) => {
|
||||
const guildId = window.location.href.split("channels/")[1].split("/")[0];
|
||||
for (const emoji of messageObj.validNonShortcutEmojis) {
|
||||
if (!emoji.require_colons) continue;
|
||||
if (emoji.guildId === guildId && !emoji.animated) continue;
|
||||
|
||||
const emojiString = `<${emoji.animated ? 'a' : ''}:${emoji.originalName || emoji.name}:${emoji.id}>`;
|
||||
const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`);
|
||||
messageObj.content = messageObj.content.replace(emojiString, ` ${url} `);
|
||||
}
|
||||
})
|
||||
addPreEditListener((_, __, messageObj) => {
|
||||
const guildId = window.location.href.split("channels/")[1].split("/")[0];
|
||||
|
||||
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
||||
const emoji = getCustomEmojiById(emojiId);
|
||||
if (emoji == null || (emoji.guildId === guildId && !emoji.animated)) continue;
|
||||
|
||||
const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`);
|
||||
messageObj.content = messageObj.content.replace(emojiStr, ` ${url} `);
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
Loading…
Reference in a new issue