parent
							
								
									e563521416
								
							
						
					
					
						commit
						74c3930e0a
					
				
					 41 changed files with 141 additions and 87 deletions
				
			
		
							
								
								
									
										28
									
								
								.eslintrc.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.eslintrc.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| { | ||||
|     "root": true, | ||||
|     "parser": "@typescript-eslint/parser", | ||||
|     "ignorePatterns": ["dist"], | ||||
|     "rules": { | ||||
|         "quotes": [ | ||||
|             "error", | ||||
|             "double", | ||||
|             { | ||||
|                 "avoidEscape": true | ||||
|             } | ||||
|         ], | ||||
|         "jsx-quotes": ["error", "prefer-double"], | ||||
|         "no-mixed-spaces-and-tabs": "error", | ||||
|         "indent": ["error", 4, { "SwitchCase": 1 }], | ||||
|         "arrow-parens": ["error", "as-needed"], | ||||
|         "eol-last": ["error", "always"], | ||||
|         "func-call-spacing": ["error", "never"], | ||||
|         "no-multi-spaces": "error", | ||||
|         "no-trailing-spaces": "error", | ||||
|         "no-whitespace-before-property": "error", | ||||
|         "semi": ["error", "always"], | ||||
|         "semi-style": ["error", "last"], | ||||
|         "space-in-parens": ["error", "never"], | ||||
|         "block-spacing": ["error", "always"], | ||||
|         "object-curly-spacing": ["error", "always"] | ||||
|     } | ||||
| } | ||||
							
								
								
									
										22
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| name: lint | ||||
| on: | ||||
|     push: | ||||
|         branches: | ||||
|             - main | ||||
|     pull_request: | ||||
|         branches: | ||||
|             - main | ||||
| jobs: | ||||
|     build: | ||||
|         runs-on: ubuntu-latest | ||||
|         steps: | ||||
|             - uses: actions/checkout@v2 | ||||
| 
 | ||||
|             - name: Install pnpm | ||||
|               run: npm i -g pnpm | ||||
| 
 | ||||
|             - name: Install deps | ||||
|               run: pnpm i | ||||
| 
 | ||||
|             - name: Run ESLint | ||||
|               run: pnpm run lint | ||||
|  | @ -13,7 +13,7 @@ const watch = process.argv.includes("--watch"); | |||
|  * @type {esbuild.Plugin} | ||||
|  */ | ||||
| const makeAllPackagesExternalPlugin = { | ||||
|     name: 'make-all-packages-external', | ||||
|     name: "make-all-packages-external", | ||||
|     setup(build) { | ||||
|         let filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/; // Must not start with "/" or "./" or "../"
 | ||||
|         build.onResolve({ filter }, args => ({ path: args.path, external: true })); | ||||
|  |  | |||
|  | @ -3,8 +3,11 @@ | |||
|         "@types/node": "^18.7.13", | ||||
|         "@types/react": "^18.0.17", | ||||
|         "@types/yazl": "^2.4.2", | ||||
|         "@typescript-eslint/parser": "^5.39.0", | ||||
|         "electron": "^20.1.0", | ||||
|         "esbuild": "^0.15.5", | ||||
|         "eslint": "^8.24.0", | ||||
|         "typescript": "^4.8.4", | ||||
|         "yazl": "^2.5.1" | ||||
|     }, | ||||
|     "dependencies": { | ||||
|  | @ -17,6 +20,8 @@ | |||
|         "build": "node build.mjs", | ||||
|         "watch": "node build.mjs --watch", | ||||
|         "inject": "node scripts/patcher/install.js", | ||||
|         "uninject": "node scripts/patcher/uninstall.js" | ||||
|         "uninject": "node scripts/patcher/uninstall.js", | ||||
|         "lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||||
|         "lint:fix": "pnpm lint --fix" | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -63,8 +63,8 @@ function question(question) { | |||
|         terminal: false, | ||||
|     }); | ||||
| 
 | ||||
|     return new Promise((resolve) => { | ||||
|         rl.question(question, (answer) => { | ||||
|     return new Promise(resolve => { | ||||
|         rl.question(question, answer => { | ||||
|             rl.close(); | ||||
|             resolve(answer); | ||||
|         }); | ||||
|  | @ -72,7 +72,7 @@ function question(question) { | |||
| } | ||||
| 
 | ||||
| async function getMenuItem(installations) { | ||||
|     let menuItems = installations.map((info) => ({ | ||||
|     let menuItems = installations.map(info => ({ | ||||
|         title: info.patched ? "[MODIFIED] " + info.location : info.location, | ||||
|         info, | ||||
|     })); | ||||
|  | @ -122,9 +122,9 @@ function getWindowsDirs() { | |||
| 
 | ||||
|         const appDirs = fs | ||||
|             .readdirSync(location, { withFileTypes: true }) | ||||
|             .filter((file) => file.isDirectory()) | ||||
|             .filter((file) => file.name.startsWith("app-")) | ||||
|             .map((file) => path.join(location, file.name)); | ||||
|             .filter(file => file.isDirectory()) | ||||
|             .filter(file => file.name.startsWith("app-")) | ||||
|             .map(file => path.join(location, file.name)); | ||||
| 
 | ||||
|         let versions = []; | ||||
|         let patched = false; | ||||
|  | @ -169,9 +169,9 @@ function getDarwinDirs() { | |||
| 
 | ||||
|         const appDirs = fs | ||||
|             .readdirSync(location, { withFileTypes: true }) | ||||
|             .filter((file) => file.isDirectory()) | ||||
|             .filter((file) => file.name.startsWith("Resources")) | ||||
|             .map((file) => path.join(location, file.name)); | ||||
|             .filter(file => file.isDirectory()) | ||||
|             .filter(file => file.name.startsWith("Resources")) | ||||
|             .map(file => path.join(location, file.name)); | ||||
| 
 | ||||
|         let versions = []; | ||||
|         let patched = false; | ||||
|  | @ -239,13 +239,13 @@ function getLinuxDirs() { | |||
|             } else { | ||||
|                 appDirs = fs | ||||
|                     .readdirSync(location, { withFileTypes: true }) | ||||
|                     .filter((file) => file.isDirectory()) | ||||
|                     .filter(file => file.isDirectory()) | ||||
|                     .filter( | ||||
|                         (file) => | ||||
|                         file => | ||||
|                             file.name.startsWith("app-") || | ||||
|                             file.name === "resources" | ||||
|                     ) | ||||
|                     .map((file) => path.join(location, file.name)); | ||||
|                     .map(file => path.join(location, file.name)); | ||||
|             } | ||||
| 
 | ||||
|             let versions = []; | ||||
|  |  | |||
|  | @ -96,7 +96,7 @@ async function install(installations) { | |||
| 
 | ||||
|         const requiredFiles = ["index.js", "package.json"]; | ||||
| 
 | ||||
|         if (requiredFiles.every((f) => fs.existsSync(path.join(dir, f)))) { | ||||
|         if (requiredFiles.every(f => fs.existsSync(path.join(dir, f)))) { | ||||
|             console.log( | ||||
|                 "Successfully patched", | ||||
|                 version.name | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ export { Settings }; | |||
| 
 | ||||
| import "./webpack/patchWebpack"; | ||||
| import "./utils/quickCss"; | ||||
| import { checkForUpdates, UpdateLogger } from './utils/updater'; | ||||
| import { checkForUpdates, UpdateLogger } from "./utils/updater"; | ||||
| import { onceReady } from "./webpack"; | ||||
| import { Router } from "./webpack/common"; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import IPC_EVENTS from './utils/IpcEvents'; | ||||
| import { IpcRenderer, ipcRenderer } from 'electron'; | ||||
| import IPC_EVENTS from "./utils/IpcEvents"; | ||||
| import { IpcRenderer, ipcRenderer } from "electron"; | ||||
| 
 | ||||
| function assertEventAllowed(event: string) { | ||||
|     if (!(event in IPC_EVENTS)) throw new Error(`Event ${event} not allowed.`); | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import { Channel, Guild } from "discord-types/general"; | ||||
| import { waitFor } from '../webpack'; | ||||
| import { waitFor } from "../webpack"; | ||||
| 
 | ||||
| export function _init(cmds: Command[]) { | ||||
|     try { | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import type { Message, Channel } from 'discord-types/general'; | ||||
| import Logger from '../utils/logger'; | ||||
| import type { Message, Channel } from "discord-types/general"; | ||||
| import Logger from "../utils/logger"; | ||||
| 
 | ||||
| const MessageEventsLogger = new Logger("MessageEvents", "#e5c890"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import plugins from "plugins"; | ||||
| import IpcEvents from "../utils/IpcEvents"; | ||||
| import { React } from "../webpack/common"; | ||||
| import { mergeDefaults } from '../utils/misc'; | ||||
| import { mergeDefaults } from "../utils/misc"; | ||||
| 
 | ||||
| interface Settings { | ||||
|     notifyAboutUpdates: boolean; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ const NO_ERROR = {}; | |||
| 
 | ||||
| export default class ErrorBoundary extends React.Component<React.PropsWithChildren<Props>> { | ||||
|     static wrap<T = any>(Component: React.ComponentType<T>): (props: T) => React.ReactElement { | ||||
|         return (props) => ( | ||||
|         return props => ( | ||||
|             <ErrorBoundary> | ||||
|                 <Component {...props as any/* I hate react typings ??? */} /> | ||||
|             </ErrorBoundary> | ||||
|  |  | |||
|  | @ -1,5 +1,4 @@ | |||
| import { PropsWithChildren } from "react"; | ||||
| import type { React } from '../webpack/common'; | ||||
| import type { React } from "../webpack/common"; | ||||
| 
 | ||||
| export function Flex(props: React.PropsWithChildren<{ | ||||
|     flexDirection?: React.CSSProperties["flexDirection"]; | ||||
|  |  | |||
|  | @ -1,14 +1,14 @@ | |||
| import { classes, humanFriendlyJoin, useAwaiter } from "../utils/misc"; | ||||
| import Plugins from 'plugins'; | ||||
| import Plugins from "plugins"; | ||||
| import { useSettings } from "../api/settings"; | ||||
| import IpcEvents from "../utils/IpcEvents"; | ||||
| 
 | ||||
| import { Button, Switch, Forms, React, Margins, Toasts, Alerts, Parser } from "../webpack/common"; | ||||
| import ErrorBoundary from "./ErrorBoundary"; | ||||
| import { startPlugin } from "../plugins"; | ||||
| import { stopPlugin } from '../plugins/index'; | ||||
| import { Flex } from './Flex'; | ||||
| import { ChangeList } from '../utils/ChangeList'; | ||||
| import { stopPlugin } from "../plugins/index"; | ||||
| import { Flex } from "./Flex"; | ||||
| import { ChangeList } from "../utils/ChangeList"; | ||||
| 
 | ||||
| function showErrorToast(message: string) { | ||||
|     Toasts.show({ | ||||
|  | @ -35,7 +35,7 @@ export default ErrorBoundary.wrap(function Settings() { | |||
|                     <div>{changes.map((s, i) => ( | ||||
|                         <> | ||||
|                             {i > 0 && ", "} | ||||
|                             {Parser.parse('`' + s + '`')} | ||||
|                             {Parser.parse("`" + s + "`")} | ||||
|                         </> | ||||
|                     ))}</div> | ||||
|                 </> | ||||
|  | @ -69,7 +69,7 @@ export default ErrorBoundary.wrap(function Settings() { | |||
|             </Forms.FormTitle> | ||||
| 
 | ||||
|             <Forms.FormText> | ||||
|                 SettingsDir: <code style={{ userSelect: 'text', cursor: 'text' }}>{settingsDir}</code> | ||||
|                 SettingsDir: <code style={{ userSelect: "text", cursor: "text" }}>{settingsDir}</code> | ||||
|             </Forms.FormText> | ||||
| 
 | ||||
|             {!IS_WEB && <Flex className={classes(Margins.marginBottom20)}> | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import gitHash from "git-hash"; | ||||
| import { changes, checkForUpdates, getRepo, rebuild, update, UpdateLogger, updateError, isOutdated, isNewer } from '../utils/updater'; | ||||
| import { React, Forms, Button, Margins, Alerts, Card, Parser, Toasts } from '../webpack/common'; | ||||
| import { changes, checkForUpdates, getRepo, rebuild, update, UpdateLogger, updateError, isOutdated, isNewer } from "../utils/updater"; | ||||
| import { React, Forms, Button, Margins, Alerts, Card, Parser, Toasts } from "../webpack/common"; | ||||
| import { Flex } from "./Flex"; | ||||
| import { classes, useAwaiter } from '../utils/misc'; | ||||
| import { classes, useAwaiter } from "../utils/misc"; | ||||
| import { Link } from "./Link"; | ||||
| import ErrorBoundary from "./ErrorBoundary"; | ||||
| import { ErrorCard } from "./ErrorCard"; | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| import { app, BrowserWindow, desktopCapturer, ipcMain, shell } from "electron"; | ||||
| import { mkdirSync, readFileSync, watch } from "fs"; | ||||
| import { open, readFile, writeFile } from "fs/promises"; | ||||
| import { join } from 'path'; | ||||
| import { join } from "path"; | ||||
| import { debounce } from "../utils/debounce"; | ||||
| import IpcEvents from '../utils/IpcEvents'; | ||||
| import IpcEvents from "../utils/IpcEvents"; | ||||
| 
 | ||||
| import "./updater"; | ||||
| 
 | ||||
|  | @ -47,7 +47,7 @@ ipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => { | |||
| ipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss()); | ||||
| 
 | ||||
| ipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR); | ||||
| ipcMain.on(IpcEvents.GET_SETTINGS, (e) => e.returnValue = readSettings()); | ||||
| ipcMain.on(IpcEvents.GET_SETTINGS, e => e.returnValue = readSettings()); | ||||
| 
 | ||||
| let settingsWriteQueue = Promise.resolve(); | ||||
| ipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => { | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| import { ipcMain } from 'electron'; | ||||
| import { ipcMain } from "electron"; | ||||
| import { promisify } from "util"; | ||||
| import IpcEvents from "../utils/IpcEvents"; | ||||
| import { execFile as cpExecFile } from 'child_process'; | ||||
| import { join } from 'path'; | ||||
| import { createReadStream } from 'fs'; | ||||
| import { createHash } from 'crypto'; | ||||
| import { execFile as cpExecFile } from "child_process"; | ||||
| import { join } from "path"; | ||||
| import { createReadStream } from "fs"; | ||||
| import { createHash } from "crypto"; | ||||
| 
 | ||||
| const VENCORD_SRC_DIR = join(__dirname, ".."); | ||||
| 
 | ||||
|  | @ -64,7 +64,7 @@ async function getRepo() { | |||
| async function calculateGitChanges() { | ||||
|     await git("fetch"); | ||||
| 
 | ||||
|     const res = await git("log", `HEAD...origin/main`, "--pretty=format:%an/%h/%s"); | ||||
|     const res = await git("log", "HEAD...origin/main", "--pretty=format:%an/%h/%s"); | ||||
| 
 | ||||
|     const commits = res.stdout.trim(); | ||||
|     return commits ? commits.split("\n").map(line => { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import electron, { app, BrowserWindowConstructorOptions } from "electron"; | ||||
| import installExt, { REACT_DEVELOPER_TOOLS } from "electron-devtools-installer"; | ||||
| import { join } from "path"; | ||||
| import { initIpc } from './ipcMain'; | ||||
| import { initIpc } from "./ipcMain"; | ||||
| 
 | ||||
| console.log("[Vencord] Starting up..."); | ||||
| 
 | ||||
|  | @ -49,7 +49,7 @@ process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); | |||
| electron.app.whenReady().then(() => { | ||||
|     installExt(REACT_DEVELOPER_TOOLS) | ||||
|         .then(() => console.info("Installed React DevTools")) | ||||
|         .catch((err) => console.error("Failed to install React DevTools", err)); | ||||
|         .catch(err => console.error("Failed to install React DevTools", err)); | ||||
| 
 | ||||
|     // Remove CSP
 | ||||
|     electron.session.defaultSession.webRequest.onHeadersReceived(({ responseHeaders, url }, cb) => { | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import definePlugin from "../utils/types"; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "STFU", | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ export default definePlugin({ | |||
|     description: "Api required by anything that uses commands", | ||||
|     patches: [ | ||||
|         { | ||||
|             find: `"giphy","tenor"`, | ||||
|             find: '"giphy","tenor"', | ||||
|             replacement: [ | ||||
|                 { | ||||
|                     // Matches BUILT_IN_COMMANDS. This is not exported so this is
 | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ export default definePlugin({ | |||
|                 { | ||||
|                     match: /;(.{1,2}=null;)(?=.{0,50}updateNotice)/g, | ||||
|                     replace: | ||||
|                         ';if(Vencord.Api.Notices.currentNotice)return !1;$1' | ||||
|                         ";if(Vencord.Api.Notices.currentNotice)return !1;$1" | ||||
|                 }, | ||||
|                 { | ||||
|                     match: /(?<=NOTICE_DISMISS:function.+?){(?=if\(null==(.+?)\))/, | ||||
|  |  | |||
|  | @ -90,7 +90,7 @@ export default definePlugin({ | |||
|         } | ||||
| 
 | ||||
|         // Check all universal rules
 | ||||
|         this.universalRules.forEach((rule) => { | ||||
|         this.universalRules.forEach(rule => { | ||||
|             url.searchParams.forEach((_value, param, parent) => { | ||||
|                 this.removeParam(rule, param, parent); | ||||
|             }); | ||||
|  | @ -99,7 +99,7 @@ export default definePlugin({ | |||
|         // Check rules for each hosts that match
 | ||||
|         this.hostRules.forEach((regex, hostRuleName) => { | ||||
|             if (!regex.test(url.hostname)) return; | ||||
|             this.rulesByHost.get(hostRuleName).forEach((rule) => { | ||||
|             this.rulesByHost.get(hostRuleName).forEach(rule => { | ||||
|                 url.searchParams.forEach((_value, param, parent) => { | ||||
|                     this.removeParam(rule, param, parent); | ||||
|                 }); | ||||
|  | @ -114,7 +114,7 @@ export default definePlugin({ | |||
|         if (msg.content.match(/http(s)?:\/\//)) { | ||||
|             msg.content = msg.content.replace( | ||||
|                 /(https?:\/\/[^\s<]+[^<.,:;"'>)|\]\s])/g, | ||||
|                 (match) => this.replacer(match) | ||||
|                 match => this.replacer(match) | ||||
|             ); | ||||
|         } | ||||
|     }, | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Devs } from "../utils/constants"; | ||||
| import definePlugin from "../utils/types"; | ||||
| import { Toasts } from '../webpack/common'; | ||||
| import { Toasts } from "../webpack/common"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "ClickableRoleDot", | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import { Devs } from "../utils/constants"; | ||||
| import definePlugin from '../utils/types'; | ||||
| import definePlugin from "../utils/types"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "Experiments", | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ export default definePlugin({ | |||
|             name: "lenny", | ||||
|             description: "Sends a lenny face", | ||||
|             options: [OptionalMessageOption], | ||||
|             execute: (opts) => ({ | ||||
|             execute: opts => ({ | ||||
|                 content: findOption(opts, "message", "") + " ( ͡° ͜ʖ ͡°)" | ||||
|             }), | ||||
|         }, | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { addClickListener, removeClickListener } from '../api/MessageEvents'; | ||||
| import { addClickListener, removeClickListener } from "../api/MessageEvents"; | ||||
| import { Devs } from "../utils/constants"; | ||||
| import definePlugin from "../utils/types"; | ||||
| import { find, findByProps } from "../webpack"; | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import definePlugin from "../utils/types"; | ||||
| import {Devs} from "../utils/constants"; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "MuteNewGuild", | ||||
|  | @ -14,4 +14,4 @@ export default definePlugin({ | |||
|             } | ||||
|         } | ||||
|     ], | ||||
| }) | ||||
| }); | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { addPreSendListener, addPreEditListener, SendListener, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | ||||
| import { addPreSendListener, addPreEditListener, removePreSendListener, removePreEditListener } from "../api/MessageEvents"; | ||||
| import { findByProps } from "../webpack"; | ||||
| import definePlugin from "../utils/types"; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import { UserStore } from '../webpack/common'; | ||||
| import { Devs } from "../utils/constants"; | ||||
| import { UserStore } from "../webpack/common"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "NitroBypass", | ||||
|  | @ -11,7 +11,7 @@ export default definePlugin({ | |||
|     dependencies: ["MessageEventsAPI"], | ||||
|     patches: [ | ||||
|         { | ||||
|             find: `canUseAnimatedEmojis:function`, | ||||
|             find: "canUseAnimatedEmojis:function", | ||||
|             replacement: [ | ||||
|                 "canUseAnimatedEmojis", | ||||
|                 "canUseEmojisEverywhere", | ||||
|  | @ -58,8 +58,8 @@ export default definePlugin({ | |||
|                 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`); | ||||
|                 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, (match, offset, origStr) => { | ||||
|                     return `${getWordBoundary(origStr, offset - 1)}${url}${getWordBoundary(origStr, offset + match.length)}`; | ||||
|                 }); | ||||
|  | @ -74,7 +74,7 @@ export default definePlugin({ | |||
|                 if (emoji == null || (emoji.guildId === guildId && !emoji.animated)) continue; | ||||
|                 if (!emoji.require_colons) continue; | ||||
| 
 | ||||
|                 const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`); | ||||
|                 const url = emoji.url.replace(/\?size=[0-9]+/, "?size=48"); | ||||
|                 messageObj.content = messageObj.content.replace(emojiStr, (match, offset, origStr) => { | ||||
|                     return `${getWordBoundary(origStr, offset - 1)}${url}${getWordBoundary(origStr, offset + match.length)}`; | ||||
|                 }); | ||||
|  |  | |||
|  | @ -16,4 +16,4 @@ export default definePlugin({ | |||
|             } | ||||
|         } | ||||
|     ] | ||||
| }) | ||||
| }); | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import definePlugin from "../utils/types"; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "NoTrack", | ||||
|  |  | |||
|  | @ -23,6 +23,6 @@ export default definePlugin({ | |||
|             { length: 7 }, | ||||
|             () => chars[Math.floor(Math.random() * chars.length)] | ||||
|         ).join(""); | ||||
|         return rand + (file.lastIndexOf(".") > -1 ? file.slice(file.lastIndexOf(".")) : "") | ||||
|         return rand + (file.lastIndexOf(".") > -1 ? file.slice(file.lastIndexOf(".")) : ""); | ||||
|     }, | ||||
| }); | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import definePlugin from "../utils/types"; | ||||
| import gitHash from "git-hash"; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "Settings", | ||||
|  | @ -30,8 +30,8 @@ export default definePlugin({ | |||
|             match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/, | ||||
|             replace: (m, mod) => | ||||
|                 `{section:${mod}.ID.HEADER,label:"Vencord"},` + | ||||
|                 `{section:"VencordSetting",label:"Vencord",element:Vencord.Components.Settings},` + | ||||
|                 `{section:"VencordUpdater",label:"Updater",element:Vencord.Components.Updater,predicate:()=>!IS_WEB},` + | ||||
|                 '{section:"VencordSetting",label:"Vencord",element:Vencord.Components.Settings},' + | ||||
|                 '{section:"VencordUpdater",label:"Updater",element:Vencord.Components.Updater,predicate:()=>!IS_WEB},' + | ||||
|                 `{section:${mod}.ID.DIVIDER},${m}` | ||||
| 
 | ||||
|         } | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import definePlugin from '../utils/types'; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import definePlugin from "../utils/types"; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "SilentTyping", | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import definePlugin from "../utils/types"; | ||||
| import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | ||||
| import { Devs } from '../utils/constants'; | ||||
| import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from "../api/MessageEvents"; | ||||
| import { Devs } from "../utils/constants"; | ||||
| 
 | ||||
| export default definePlugin({ | ||||
|     name: "Unindent", | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Devs } from "../utils/constants"; | ||||
| import IpcEvents from "../utils/IpcEvents"; | ||||
| import definePlugin from '../utils/types'; | ||||
| import definePlugin from "../utils/types"; | ||||
| 
 | ||||
| const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; | ||||
| export default definePlugin({ | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import electron, { contextBridge, webFrame } from "electron"; | |||
| import { readFileSync } from "fs"; | ||||
| import { join } from "path"; | ||||
| import VencordNative from "./VencordNative"; | ||||
| import { ipcRenderer } from 'electron'; | ||||
| import { ipcRenderer } from "electron"; | ||||
| import IpcEvents from "./utils/IpcEvents"; | ||||
| 
 | ||||
| if (electron.desktopCapturer === void 0) { | ||||
|  | @ -15,7 +15,7 @@ if (electron.desktopCapturer === void 0) { | |||
|     require.cache[electronPath]!.exports = { | ||||
|         ...electron, | ||||
|         desktopCapturer: { | ||||
|             getSources: (opts) => ipcRenderer.invoke(IpcEvents.GET_DESKTOP_CAPTURE_SOURCES, opts) | ||||
|             getSources: opts => ipcRenderer.invoke(IpcEvents.GET_DESKTOP_CAPTURE_SOURCES, opts) | ||||
|         } | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -18,11 +18,11 @@ let modalId = 1337; | |||
|  */ | ||||
| export function openModal(Component: React.ComponentType, modalProps: Record<string, any>) { | ||||
|     let key = `Vencord${modalId++}`; | ||||
|     modals.openModal(props => | ||||
|     modals.openModal(props => ( | ||||
|         <Modal.ModalRoot {...props} {...modalProps}> | ||||
|             <Component /> | ||||
|         </Modal.ModalRoot> | ||||
|         , { modalKey: key }); | ||||
|     ), { modalKey: key }); | ||||
| 
 | ||||
|     return key; | ||||
| }; | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import IpcEvents from "./IpcEvents"; | ||||
| import Logger from "./logger"; | ||||
| import { IpcRes } from './types'; | ||||
| import gitHash from 'git-hash'; | ||||
| import { IpcRes } from "./types"; | ||||
| import gitHash from "git-hash"; | ||||
| 
 | ||||
| export const UpdateLogger = new Logger("Updater", "white"); | ||||
| export let isOutdated = false; | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { waitFor, filters, _resolveReady } from './webpack'; | ||||
| import { waitFor, filters, _resolveReady } from "./webpack"; | ||||
| import type Components from "discord-types/components"; | ||||
| import type Stores from "discord-types/stores"; | ||||
| import type Other from "discord-types/other"; | ||||
| import { lazyWebpack } from '../utils/misc'; | ||||
| import { lazyWebpack } from "../utils/misc"; | ||||
| 
 | ||||
| export const Margins = lazyWebpack(filters.byProps(["marginTop20"])); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { WEBPACK_CHUNK } from '../utils/constants'; | ||||
| import { WEBPACK_CHUNK } from "../utils/constants"; | ||||
| import Logger from "../utils/logger"; | ||||
| import { _initWebpack } from "."; | ||||
| 
 | ||||
|  | @ -8,7 +8,7 @@ const logger = new Logger("WebpackInterceptor", "#8caaee"); | |||
| 
 | ||||
| Object.defineProperty(window, WEBPACK_CHUNK, { | ||||
|     get: () => webpackChunk, | ||||
|     set: (v) => { | ||||
|     set: v => { | ||||
|         if (v?.push !== Array.prototype.push) { | ||||
|             logger.info(`Patching ${WEBPACK_CHUNK}.push`); | ||||
|             _initWebpack(v); | ||||
|  | @ -141,7 +141,7 @@ function patchPush() { | |||
|     handlePush.original = window[WEBPACK_CHUNK].push; | ||||
|     Object.defineProperty(window[WEBPACK_CHUNK], "push", { | ||||
|         get: () => handlePush, | ||||
|         set: (v) => (handlePush.original = v), | ||||
|         set: v => (handlePush.original = v), | ||||
|         configurable: true | ||||
|     }); | ||||
| } | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ export type CallbackFn = (mod: any) => void; | |||
| export function _initWebpack(instance: typeof window.webpackChunkdiscord_app) { | ||||
|     if (cache !== void 0) throw "no."; | ||||
| 
 | ||||
|     wreq = instance.push([[Symbol()], {}, (r) => r]); | ||||
|     wreq = instance.push([[Symbol()], {}, r => r]); | ||||
|     cache = wreq.c; | ||||
|     instance.pop(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue