Merge branch 'dev'

This commit is contained in:
thororen1234 2024-08-03 00:27:12 -04:00
commit b6fe44ce5b
37 changed files with 1359 additions and 1381 deletions

View file

@ -1,195 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"ignorePatterns": [
"dist",
"browser",
"packages/vencord-types"
],
"plugins": [
"@typescript-eslint",
"simple-header",
"simple-import-sort",
"unused-imports"
],
"settings": {
"import/resolver": {
"alias": {
"map": [
[
"@webpack",
"./src/webpack"
],
[
"@webpack/common",
"./src/webpack/common"
],
[
"@utils",
"./src/utils"
],
[
"@api",
"./src/api"
],
[
"@components",
"./src/components"
]
]
}
}
},
"rules": {
// Since it's only been a month and Vencord has already been stolen
// by random skids who rebranded it to "AlphaCord" and erased all license
// information
"simple-header/header": [
"error",
{
"files": [
"scripts/header-new.txt",
"scripts/header-old.txt"
],
"templates": {
"author": [
".*",
"Vendicated and contributors"
]
}
}
],
"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"
],
"@typescript-eslint/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"
],
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"spaced-comment": [
"error",
"always",
{
"markers": [
"!"
]
}
],
"yoda": "error",
"prefer-destructuring": [
"error",
{
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": false,
"object": false
}
}
],
"operator-assignment": [
"error",
"always"
],
"no-useless-computed-key": "error",
"no-unneeded-ternary": [
"error",
{
"defaultAssignment": false
}
],
"no-invalid-regexp": "error",
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"no-duplicate-imports": "error",
"no-extra-semi": "error",
"dot-notation": "error",
"no-useless-escape": [
"error",
{
"extra": "i"
}
],
"no-fallthrough": "error",
"for-direction": "error",
"no-async-promise-executor": "error",
"no-cond-assign": "error",
"no-dupe-else-if": "error",
"no-duplicate-case": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-shadow-restricted-names": "error",
"no-unexpected-multiline": "error",
"no-unsafe-optional-chaining": "error",
"no-useless-backreference": "error",
"use-isnan": "error",
"prefer-const": "error",
"prefer-spread": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error"
}
}

View file

@ -1,7 +1,6 @@
{ {
"extends": "stylelint-config-standard", "extends": "stylelint-config-standard",
"rules": { "rules": {
"indentation": 4,
"selector-class-pattern": [ "selector-class-pattern": [
"^[a-z][a-zA-Z0-9]*(-[a-z0-9][a-zA-Z0-9]*)*$", "^[a-z][a-zA-Z0-9]*(-[a-z0-9][a-zA-Z0-9]*)*$",
{ {

View file

@ -13,11 +13,10 @@
"typescript.format.semicolons": "insert", "typescript.format.semicolons": "insert",
"typescript.preferences.quoteStyle": "double", "typescript.preferences.quoteStyle": "double",
"javascript.preferences.quoteStyle": "double", "javascript.preferences.quoteStyle": "double",
"eslint.experimental.useFlatConfig": false,
"gitlens.remotes": [ "gitlens.remotes": [
{ {
"domain": "codeberg.org", "domain": "codeberg.org",
"type": "Gitea" "type": "Gitea"
} }
] ]
} }

123
eslint.config.mjs Normal file
View file

@ -0,0 +1,123 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
// @ts-check
import stylistic from "@stylistic/eslint-plugin";
import header from "eslint-plugin-simple-header";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
export default tseslint.config(
{ ignores: ["dist", "browser", "packages/vencord-types"] },
{
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}", "eslint.config.mjs"],
plugins: {
"simple-header": header,
"@stylistic": stylistic,
"@typescript-eslint": tseslint.plugin,
"simple-import-sort": simpleImportSort,
"unused-imports": unusedImports,
},
settings: {
"import/resolver": {
map: [
["@webpack", "./src/webpack"],
["@webpack/common", "./src/webpack/common"],
["@utils", "./src/utils"],
["@api", "./src/api"],
["@components", "./src/components"]
]
}
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: ["./tsconfig.json"],
tsconfigRootDir: import.meta.dirname
}
},
rules: {
/*
* Since it's only been a month and Vencord has already been stolen
* by random skids who rebranded it to "AlphaCord" and erased all license
* information
*/
"simple-header/header": [
"error",
{
"files": ["scripts/header-new.txt", "scripts/header-old.txt"],
"templates": { "author": [".*", "Vendicated and contributors"] }
}
],
// Style Rules
"@stylistic/jsx-quotes": ["error", "prefer-double"],
"@stylistic/quotes": ["error", "double", { "avoidEscape": true }],
"@stylistic/no-mixed-spaces-and-tabs": "error",
"@stylistic/arrow-parens": ["error", "as-needed"],
"@stylistic/eol-last": ["error", "always"],
"@stylistic/no-multi-spaces": "error",
"@stylistic/no-trailing-spaces": "error",
"@stylistic/no-whitespace-before-property": "error",
"@stylistic/semi": ["error", "always"],
"@stylistic/semi-style": ["error", "last"],
"@stylistic/space-in-parens": ["error", "never"],
"@stylistic/block-spacing": ["error", "always"],
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/spaced-comment": ["error", "always", { "markers": ["!"] }],
"@stylistic/no-extra-semi": "error",
// TS Rules
"@stylistic/func-call-spacing": ["error", "never"],
// ESLint Rules
"yoda": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"prefer-destructuring": ["error", {
"VariableDeclarator": { "array": false, "object": true },
"AssignmentExpression": { "array": false, "object": false }
}],
"operator-assignment": ["error", "always"],
"no-useless-computed-key": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
"no-invalid-regexp": "error",
"no-constant-condition": ["error", { "checkLoops": false }],
"no-duplicate-imports": "error",
"dot-notation": "error",
"no-useless-escape": [
"error",
{
"extra": "i"
}
],
"no-fallthrough": "error",
"for-direction": "error",
"no-async-promise-executor": "error",
"no-cond-assign": "error",
"no-dupe-else-if": "error",
"no-duplicate-case": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-shadow-restricted-names": "error",
"no-unexpected-multiline": "error",
"no-unsafe-optional-chaining": "error",
"no-useless-backreference": "error",
"use-isnan": "error",
"prefer-const": "error",
"prefer-spread": "error",
// Plugin Rules
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
}
}
);

View file

@ -28,7 +28,7 @@
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types", "generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
"inject": "node scripts/runInstaller.mjs", "inject": "node scripts/runInstaller.mjs",
"uninject": "node scripts/runInstaller.mjs", "uninject": "node scripts/runInstaller.mjs",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-pattern src/userplugins", "lint": "eslint",
"lint-styles": "stylelint \"src/**/*.css\" --ignore-pattern src/userplugins", "lint-styles": "stylelint \"src/**/*.css\" --ignore-pattern src/userplugins",
"lint:fix": "pnpm lint --fix", "lint:fix": "pnpm lint --fix",
"test": "pnpm buildStandalone && pnpm lint:fix && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson", "test": "pnpm buildStandalone && pnpm lint:fix && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson",
@ -36,53 +36,52 @@
"testTsc": "tsc --noEmit" "testTsc": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@sapphi-red/web-noise-suppressor": "0.3.3", "@sapphi-red/web-noise-suppressor": "0.3.5",
"@types/less": "^3.0.6", "@types/less": "^3.0.6",
"@types/stylus": "^0.48.42", "@types/stylus": "^0.48.42",
"@types/tinycolor2": "^1.4.6", "@types/tinycolor2": "^1.4.6",
"@vap/core": "0.0.12", "@vap/core": "0.0.12",
"@vap/shiki": "0.10.5", "@vap/shiki": "0.10.5",
"fflate": "^0.7.4", "fflate": "^0.8.2",
"gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3", "gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3",
"jsqr": "1.4.0", "jsqr": "1.4.0",
"monaco-editor": "^0.50.0", "monaco-editor": "^0.50.0",
"nanoid": "^4.0.2", "nanoid": "^5.0.7",
"usercss-meta": "^0.12.0", "usercss-meta": "^0.12.0",
"openai": "^4.30.0", "openai": "^4.30.0",
"virtual-merge": "^1.0.1" "virtual-merge": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
"@react-spring/web": "^9.7.3", "@stylistic/eslint-plugin": "^2.6.1",
"@electron/asar": "^3.2.10", "@electron/asar": "^3.2.10",
"@types/chrome": "^0.0.246", "@types/chrome": "^0.0.269",
"@types/diff": "^5.0.3", "@types/diff": "^5.2.1",
"@types/lodash": "^4.14.194", "@types/lodash": "^4.17.7",
"@types/node": "^18.16.3", "@types/node": "^22.0.3",
"@types/react": "^18.2.0", "@types/react": "^18.3.3",
"@types/react-dom": "^18.2.1", "@types/react-dom": "^18.3.0",
"@types/yazl": "^2.4.2", "@types/yazl": "^2.4.5",
"@typescript-eslint/eslint-plugin": "^5.59.1", "diff": "^5.2.0",
"@typescript-eslint/parser": "^5.59.1",
"diff": "^5.1.0",
"discord-types": "^1.3.26", "discord-types": "^1.3.26",
"esbuild": "^0.23.0", "esbuild": "^0.23.0",
"eslint": "^8.46.0", "eslint": "^9.8.0",
"eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-simple-header": "^1.0.2", "eslint-plugin-simple-header": "^1.1.1",
"eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^4.0.1",
"highlight.js": "10.6.0", "highlight.js": "10.7.3",
"html-minifier-terser": "^7.2.0", "html-minifier-terser": "^7.2.0",
"moment": "^2.29.4", "moment": "^2.30.1",
"puppeteer-core": "^19.11.1", "puppeteer-core": "^22.15.0",
"standalone-electron-types": "^1.0.0", "standalone-electron-types": "^1.0.0",
"stylelint": "^15.6.0", "stylelint": "^16.8.1",
"stylelint-config-standard": "^33.0.0", "stylelint-config-standard": "^36.0.1",
"ts-patch": "^3.1.2", "ts-patch": "^3.2.1",
"tsx": "^4.16.2", "tsx": "^4.16.5",
"type-fest": "^3.9.0", "type-fest": "^4.23.0",
"typed-emitter": "^2.1.0", "typed-emitter": "^2.1.0",
"typescript": "^5.4.5", "typescript": "^5.5.4",
"typescript-eslint": "^8.0.0",
"typescript-transform-paths": "^3.4.7", "typescript-transform-paths": "^3.4.7",
"zip-local": "^0.3.5", "zip-local": "^0.3.5",
"zustand": "^3.7.2" "zustand": "^3.7.2"
@ -90,7 +89,7 @@
"packageManager": "pnpm@9.1.0", "packageManager": "pnpm@9.1.0",
"pnpm": { "pnpm": {
"patchedDependencies": { "patchedDependencies": {
"eslint@8.46.0": "patches/eslint@8.46.0.patch", "eslint@9.8.0": "patches/eslint@9.8.0.patch",
"@types/less@3.0.6": "patches/@types__less@3.0.6.patch" "@types/less@3.0.6": "patches/@types__less@3.0.6.patch"
}, },
"peerDependencyRules": { "peerDependencyRules": {

View file

@ -0,0 +1,14 @@
diff --git a/dist/index.js b/dist/index.js
index 67de6fb139070fd0e49beca65e3b63c531202e16..aa2883c8126e4952a42872ee920f59547a066430 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1 +1 @@
-var C=Object.create;var f=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},y=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!F.call(e,s)&&s!==r&&f(e,s,{get:()=>t[s],enumerable:!(i=I(t,s))||i.enumerable});return e};var b=(e,t,r)=>(r=e!=null?C(S(e)):{},y(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>y(f({},"__esModule",{value:!0}),e);var N={};$(N,{default:()=>J});module.exports=D(N);var h="eslint-plugin-path-alias",v="2.0.0";var l=require("path"),M=b(require("nanomatch"));function j(e){return`https://github/com/msfragala/eslint-plugin-path-alias/blob/master/docs/rules/${e}.md`}var R=require("get-tsconfig"),a=require("path"),w=b(require("find-pkg")),O=require("fs");function P(e){if(e.options[0]?.paths)return z(e);let t=e.getFilename?.()??e.filename,r=(0,R.getTsconfig)(t);if(r?.config?.compilerOptions?.paths)return q(r);let i=w.default.sync((0,a.dirname)(t));if(!i)return;let s=JSON.parse((0,O.readFileSync)(i).toString());if(s?.imports)return L(s,i)}function L(e,t){let r=new Map,i=e.imports??{},s=(0,a.dirname)(t);return Object.entries(i).forEach(([o,n])=>{if(!n||typeof n!="string")return;let p=(0,a.resolve)(s,n);r.set(o,[p])}),r}function q(e){let t=new Map,r=e?.config?.compilerOptions?.paths??{},i=(0,a.dirname)(e.path);return e.config.compilerOptions?.baseUrl&&(i=(0,a.resolve)((0,a.dirname)(e.path),e.config.compilerOptions.baseUrl)),Object.entries(r).forEach(([s,o])=>{s=s.replace(/\/\*$/,""),o=o.map(n=>(0,a.resolve)(i,n.replace(/\/\*$/,""))),t.set(s,o)}),t}function z(e){let t=new Map,r=e.options[0]?.paths??{};return Object.entries(r).forEach(([i,s])=>{if(!s||typeof s!="string")return;if(s.startsWith("/")){t.set(i,[s]);return}let o=e.getCwd?.()??e.cwd,n=(0,a.resolve)(o,s);t.set(i,[n])}),t}var T={meta:{type:"suggestion",docs:{description:"Ensure imports use path aliases whenever possible vs. relative paths",url:j("no-relative")},fixable:"code",schema:[{type:"object",properties:{exceptions:{type:"array",items:{type:"string"}},paths:{type:"object"}},additionalProperties:!1}],messages:{shouldUseAlias:"Import should use path alias instead of relative path"}},create(e){let t=e.options[0]?.exceptions,r=e.getFilename?.()??e.filename,i=P(e);return i?.size?{ImportExpression(s){if(s.source.type!=="Literal"||typeof s.source.value!="string")return;let o=s.source.raw,n=s.source.value;if(!/^(\.?\.\/)/.test(n))return;let p=(0,l.resolve)((0,l.dirname)(r),n);if(A(p,t))return;let c=k(p,i);c&&e.report({node:s,messageId:"shouldUseAlias",data:{alias:c},fix(m){let g=E(p,c,i.get(c)),d=o.replace(n,g);return m.replaceText(s.source,d)}})},ImportDeclaration(s){if(typeof s.source.value!="string")return;let o=s.source.value;if(!/^(\.?\.\/)/.test(o))return;let n=(0,l.resolve)((0,l.dirname)(r),o),p=A(n,t),u=k(n,i);p||u&&e.report({node:s,messageId:"shouldUseAlias",data:{alias:u},fix(c){let m=s.source.raw,g=E(n,u,i.get(u)),d=m.replace(o,g);return c.replaceText(s.source,d)}})}}:{}}};function k(e,t){return Array.from(t.keys()).find(r=>t.get(r).some(s=>e.indexOf(s)===0))}function A(e,t){if(!t)return!1;let r=(0,l.basename)(e);return(0,M.default)(r,t).includes(r)}function E(e,t,r){for(let i of r)if(e.indexOf(i)===0)return e.replace(i,t)}var J={name:h,version:v,meta:{name:h,version:v},rules:{"no-relative":T}};
+var C=Object.create;var f=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},y=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!F.call(e,s)&&s!==r&&f(e,s,{get:()=>t[s],enumerable:!(i=I(t,s))||i.enumerable});return e};var b=(e,t,r)=>(r=e!=null?C(S(e)):{},y(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>y(f({},"__esModule",{value:!0}),e);var N={};$(N,{default:()=>J});module.exports=D(N);var h="eslint-plugin-path-alias",v="2.0.0";var l=require("path"),M=b(require("nanomatch"));function j(e){return`https://github/com/msfragala/eslint-plugin-path-alias/blob/master/docs/rules/${e}.md`}var R=require("get-tsconfig"),a=require("path"),w=b(require("find-pkg")),O=require("fs");function P(e){if(e.options[0]?.paths)return z(e);let t=e.getFilename?.()??e.filename,r=(0,R.getTsconfig)(t);if(r?.config?.compilerOptions?.paths)return q(r);let i=w.default.sync((0,a.dirname)(t));if(!i)return;let s=JSON.parse((0,O.readFileSync)(i).toString());if(s?.imports)return L(s,i)}function L(e,t){let r=new Map,i=e.imports??{},s=(0,a.dirname)(t);return Object.entries(i).forEach(([o,n])=>{if(!n||typeof n!="string")return;let p=(0,a.resolve)(s,n);r.set(o,[p])}),r}function q(e){let t=new Map,r=e?.config?.compilerOptions?.paths??{},i=(0,a.dirname)(e.path);return e.config.compilerOptions?.baseUrl&&(i=(0,a.resolve)((0,a.dirname)(e.path),e.config.compilerOptions.baseUrl)),Object.entries(r).forEach(([s,o])=>{s=s.replace(/\/\*$/,""),o=o.map(n=>(0,a.resolve)(i,n.replace(/\/\*$/,""))),t.set(s,o)}),t}function z(e){let t=new Map,r=e.options[0]?.paths??{};return Object.entries(r).forEach(([i,s])=>{if(!s||typeof s!="string")return;if(s.startsWith("/")){t.set(i,[s]);return}let o=e.getCwd?.()??e.cwd,n=(0,a.resolve)(o,s);t.set(i,[n])}),t}var T={meta:{type:"suggestion",docs:{description:"Ensure imports use path aliases whenever possible vs. relative paths",url:j("no-relative")},fixable:"code",schema:[{type:"object",properties:{exceptions:{type:"array",items:{type:"string"}},paths:{type:"object"}},additionalProperties:!1}],messages:{shouldUseAlias:"Import should use path alias instead of relative path"}},create(e){let t=e.options[0]?.exceptions,r=e.getFilename?.()??e.filename,i=P(e);return i?.size?{ImportExpression(s){if(s.source.type!=="Literal"||typeof s.source.value!="string")return;let o=s.source.raw,n=s.source.value;if(!/^(\.\.\/)/.test(n))return;let p=(0,l.resolve)((0,l.dirname)(r),n);if(A(p,t))return;let c=k(p,i);c&&e.report({node:s,messageId:"shouldUseAlias",data:{alias:c},fix(m){let g=E(p,c,i.get(c)),d=o.replace(n,g);return m.replaceText(s.source,d)}})},ImportDeclaration(s){if(typeof s.source.value!="string")return;let o=s.source.value;if(!/^(\.\.\/)/.test(o))return;let n=(0,l.resolve)((0,l.dirname)(r),o),p=A(n,t),u=k(n,i);p||u&&e.report({node:s,messageId:"shouldUseAlias",data:{alias:u},fix(c){let m=s.source.raw,g=E(n,u,i.get(u)),d=m.replace(o,g);return c.replaceText(s.source,d)}})}}:{}}};function k(e,t){return Array.from(t.keys()).find(r=>t.get(r).some(s=>e.indexOf(s)===0))}function A(e,t){if(!t)return!1;let r=(0,l.basename)(e);return(0,M.default)(r,t).includes(r)}function E(e,t,r){for(let i of r)if(e.indexOf(i)===0)return e.replace(i,t)}var J={name:h,version:v,meta:{name:h,version:v},rules:{"no-relative":T}};
diff --git a/dist/index.mjs b/dist/index.mjs
index 96de18e06d4cc413e11af038cd760e4804c32e59..27e8c4e3e2c942400cc3982e52159904ca6eedfa 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1 +1 @@
-var d="eslint-plugin-path-alias",h="2.0.0";import{dirname as x,resolve as j,basename as I}from"path";import U from"nanomatch";function y(e){return`https://github/com/msfragala/eslint-plugin-path-alias/blob/master/docs/rules/${e}.md`}import{getTsconfig as k}from"get-tsconfig";import{resolve as c,dirname as u}from"path";import A from"find-pkg";import{readFileSync as E}from"fs";function b(e){if(e.options[0]?.paths)return C(e);let s=e.getFilename?.()??e.filename,i=k(s);if(i?.config?.compilerOptions?.paths)return T(i);let r=A.sync(u(s));if(!r)return;let t=JSON.parse(E(r).toString());if(t?.imports)return M(t,r)}function M(e,s){let i=new Map,r=e.imports??{},t=u(s);return Object.entries(r).forEach(([o,n])=>{if(!n||typeof n!="string")return;let a=c(t,n);i.set(o,[a])}),i}function T(e){let s=new Map,i=e?.config?.compilerOptions?.paths??{},r=u(e.path);return e.config.compilerOptions?.baseUrl&&(r=c(u(e.path),e.config.compilerOptions.baseUrl)),Object.entries(i).forEach(([t,o])=>{t=t.replace(/\/\*$/,""),o=o.map(n=>c(r,n.replace(/\/\*$/,""))),s.set(t,o)}),s}function C(e){let s=new Map,i=e.options[0]?.paths??{};return Object.entries(i).forEach(([r,t])=>{if(!t||typeof t!="string")return;if(t.startsWith("/")){s.set(r,[t]);return}let o=e.getCwd?.()??e.cwd,n=c(o,t);s.set(r,[n])}),s}var P={meta:{type:"suggestion",docs:{description:"Ensure imports use path aliases whenever possible vs. relative paths",url:y("no-relative")},fixable:"code",schema:[{type:"object",properties:{exceptions:{type:"array",items:{type:"string"}},paths:{type:"object"}},additionalProperties:!1}],messages:{shouldUseAlias:"Import should use path alias instead of relative path"}},create(e){let s=e.options[0]?.exceptions,i=e.getFilename?.()??e.filename,r=b(e);return r?.size?{ImportExpression(t){if(t.source.type!=="Literal"||typeof t.source.value!="string")return;let o=t.source.raw,n=t.source.value;if(!/^(\.?\.\/)/.test(n))return;let a=j(x(i),n);if(w(a,s))return;let l=R(a,r);l&&e.report({node:t,messageId:"shouldUseAlias",data:{alias:l},fix(f){let m=O(a,l,r.get(l)),g=o.replace(n,m);return f.replaceText(t.source,g)}})},ImportDeclaration(t){if(typeof t.source.value!="string")return;let o=t.source.value;if(!/^(\.?\.\/)/.test(o))return;let n=j(x(i),o),a=w(n,s),p=R(n,r);a||p&&e.report({node:t,messageId:"shouldUseAlias",data:{alias:p},fix(l){let f=t.source.raw,m=O(n,p,r.get(p)),g=f.replace(o,m);return l.replaceText(t.source,g)}})}}:{}}};function R(e,s){return Array.from(s.keys()).find(i=>s.get(i).some(t=>e.indexOf(t)===0))}function w(e,s){if(!s)return!1;let i=I(e);return U(i,s).includes(i)}function O(e,s,i){for(let r of i)if(e.indexOf(r)===0)return e.replace(r,s)}var Q={name:d,version:h,meta:{name:d,version:h},rules:{"no-relative":P}};export{Q as default};
+var d="eslint-plugin-path-alias",h="2.0.0";import{dirname as x,resolve as j,basename as I}from"path";import U from"nanomatch";function y(e){return`https://github/com/msfragala/eslint-plugin-path-alias/blob/master/docs/rules/${e}.md`}import{getTsconfig as k}from"get-tsconfig";import{resolve as c,dirname as u}from"path";import A from"find-pkg";import{readFileSync as E}from"fs";function b(e){if(e.options[0]?.paths)return C(e);let s=e.getFilename?.()??e.filename,i=k(s);if(i?.config?.compilerOptions?.paths)return T(i);let r=A.sync(u(s));if(!r)return;let t=JSON.parse(E(r).toString());if(t?.imports)return M(t,r)}function M(e,s){let i=new Map,r=e.imports??{},t=u(s);return Object.entries(r).forEach(([o,n])=>{if(!n||typeof n!="string")return;let a=c(t,n);i.set(o,[a])}),i}function T(e){let s=new Map,i=e?.config?.compilerOptions?.paths??{},r=u(e.path);return e.config.compilerOptions?.baseUrl&&(r=c(u(e.path),e.config.compilerOptions.baseUrl)),Object.entries(i).forEach(([t,o])=>{t=t.replace(/\/\*$/,""),o=o.map(n=>c(r,n.replace(/\/\*$/,""))),s.set(t,o)}),s}function C(e){let s=new Map,i=e.options[0]?.paths??{};return Object.entries(i).forEach(([r,t])=>{if(!t||typeof t!="string")return;if(t.startsWith("/")){s.set(r,[t]);return}let o=e.getCwd?.()??e.cwd,n=c(o,t);s.set(r,[n])}),s}var P={meta:{type:"suggestion",docs:{description:"Ensure imports use path aliases whenever possible vs. relative paths",url:y("no-relative")},fixable:"code",schema:[{type:"object",properties:{exceptions:{type:"array",items:{type:"string"}},paths:{type:"object"}},additionalProperties:!1}],messages:{shouldUseAlias:"Import should use path alias instead of relative path"}},create(e){let s=e.options[0]?.exceptions,i=e.getFilename?.()??e.filename,r=b(e);return r?.size?{ImportExpression(t){if(t.source.type!=="Literal"||typeof t.source.value!="string")return;let o=t.source.raw,n=t.source.value;if(!/^(\.\.\/)/.test(n))return;let a=j(x(i),n);if(w(a,s))return;let l=R(a,r);l&&e.report({node:t,messageId:"shouldUseAlias",data:{alias:l},fix(f){let m=O(a,l,r.get(l)),g=o.replace(n,m);return f.replaceText(t.source,g)}})},ImportDeclaration(t){if(typeof t.source.value!="string")return;let o=t.source.value;if(!/^(\.\.\/)/.test(o))return;let n=j(x(i),o),a=w(n,s),p=R(n,r);a||p&&e.report({node:t,messageId:"shouldUseAlias",data:{alias:p},fix(l){let f=t.source.raw,m=O(n,p,r.get(p)),g=f.replace(o,m);return l.replaceText(t.source,g)}})}}:{}}};function R(e,s){return Array.from(s.keys()).find(i=>s.get(i).some(t=>e.indexOf(t)===0))}function w(e,s){if(!s)return!1;let i=I(e);return U(i,s).includes(i)}function O(e,s,i){for(let r of i)if(e.indexOf(r)===0)return e.replace(r,s)}var Q={name:d,version:h,meta:{name:d,version:h},rules:{"no-relative":P}};export{Q as default};

2205
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@ import "../suppressExperimentalWarnings.js";
import "../checkNodeVersion.js"; import "../checkNodeVersion.js";
import { exec, execSync } from "child_process"; import { exec, execSync } from "child_process";
import esbuild, { build, BuildOptions, context, Plugin } from "esbuild"; import esbuild, { build, BuildOptions, Plugin } from "esbuild";
import { constants as FsConstants, readFileSync } from "fs"; import { constants as FsConstants, readFileSync } from "fs";
import { access, readdir, readFile } from "fs/promises"; import { access, readdir, readFile } from "fs/promises";
import { minify as minifyHtml } from "html-minifier-terser"; import { minify as minifyHtml } from "html-minifier-terser";

View file

@ -36,7 +36,7 @@ for (const variable of ["DISCORD_TOKEN", "CHROMIUM_BIN"]) {
const CANARY = process.env.USE_CANARY === "true"; const CANARY = process.env.USE_CANARY === "true";
const browser = await pup.launch({ const browser = await pup.launch({
headless: "new", headless: true,
executablePath: process.env.CHROMIUM_BIN executablePath: process.env.CHROMIUM_BIN
}); });

View file

@ -18,14 +18,14 @@
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { Channel, Message } from "discord-types/general"; import { Channel, Message } from "discord-types/general";
import type { MouseEventHandler } from "react"; import type { ComponentType, MouseEventHandler, ReactElement } from "react";
const logger = new Logger("MessagePopover"); const logger = new Logger("MessagePopover");
export interface ButtonItem { export interface ButtonItem {
key?: string, key?: string,
label: string, label: string,
icon: React.ComponentType<any>, icon: ComponentType<any>,
message: Message, message: Message,
channel: Channel, channel: Channel,
onClick?: MouseEventHandler<HTMLButtonElement>, onClick?: MouseEventHandler<HTMLButtonElement>,
@ -49,16 +49,16 @@ export function removeButton(identifier: string) {
export function _buildPopoverElements( export function _buildPopoverElements(
msg: Message, msg: Message,
makeButton: (item: ButtonItem) => React.ComponentType PopoverButton: ComponentType<ButtonItem>,
) { ) {
const items = [] as React.ComponentType[]; const items = [] as ReactElement[];
for (const [identifier, getItem] of buttons.entries()) { for (const [identifier, getItem] of buttons.entries()) {
try { try {
const item = getItem(msg); const item = getItem(msg);
if (item) { if (item) {
item.key ??= identifier; item.key ??= identifier;
items.push(makeButton(item)); items.push(<PopoverButton {...item} />);
} }
} catch (err) { } catch (err) {
logger.error(`[${identifier}]`, err); logger.error(`[${identifier}]`, err);

View file

@ -1,6 +1,6 @@
.vc-expandableheader-center-flex { .vc-expandableheader-center-flex {
display: flex; display: flex;
place-content: center; place-items: center;
} }
.vc-expandableheader-btn { .vc-expandableheader-btn {
@ -8,4 +8,4 @@
cursor: pointer; cursor: pointer;
width: 24px; width: 24px;
height: 24px; height: 24px;
} }

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { findComponentByCodeLazy } from "@webpack"; import { findComponentByCodeLazy } from "@webpack";
import { moment, React, useMemo } from "@webpack/common"; import { moment, React, useMemo } from "@webpack/common";

View file

@ -4,8 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
/* eslint-disable arrow-parens */
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { Flex } from "@components/Flex"; import { Flex } from "@components/Flex";
import { DeleteIcon, PlusIcon } from "@components/Icons"; import { DeleteIcon, PlusIcon } from "@components/Icons";
@ -107,12 +105,12 @@ export default function ({
id: "all", id: "all",
sources: [...colorwayData, ...customColorwayData] sources: [...colorwayData, ...customColorwayData]
}, },
...colorwayData.map((source) => ({ ...colorwayData.map(source => ({
name: source.source, name: source.source,
id: source.source.toLowerCase().replaceAll(" ", "-"), id: source.source.toLowerCase().replaceAll(" ", "-"),
sources: [source] sources: [source]
})), })),
...customColorwayData.map((source) => ({ ...customColorwayData.map(source => ({
name: source.source, name: source.source,
id: source.source.toLowerCase().replaceAll(" ", "-"), id: source.source.toLowerCase().replaceAll(" ", "-"),
sources: [source] sources: [source]
@ -147,7 +145,7 @@ export default function ({
const onlineSources: { name: string, url: string; }[] = await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]; const onlineSources: { name: string, url: string; }[] = await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[];
const responses: Response[] = await Promise.all( const responses: Response[] = await Promise.all(
onlineSources.map((source) => onlineSources.map(source =>
fetch(source.url, force ? { cache: "no-store" } : {}) fetch(source.url, force ? { cache: "no-store" } : {})
) )
); );
@ -309,7 +307,7 @@ export default function ({
style={{ marginLeft: "8px" }} style={{ marginLeft: "8px" }}
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
onClick={() => openModal((props) => <CreatorModal onClick={() => openModal(props => <CreatorModal
modalProps={props} modalProps={props}
loadUIProps={loadUI} loadUIProps={loadUI}
/>)} />)}
@ -350,7 +348,7 @@ export default function ({
id="colorway-opencolorstealer" id="colorway-opencolorstealer"
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
onClick={() => openModal((props) => <ColorPickerModal modalProps={props} />)} onClick={() => openModal(props => <ColorPickerModal modalProps={props} />)}
> >
<PalleteIcon width={20} height={20} style={{ padding: "6px", boxSizing: "content-box" }} /> <PalleteIcon width={20} height={20} style={{ padding: "6px", boxSizing: "content-box" }} />
</Button>} </Button>}
@ -469,7 +467,7 @@ export default function ({
{(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>Auto</Text>} {(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>Auto</Text>}
<div <div
className="colorwayInfoIconContainer" className="colorwayInfoIconContainer"
onClick={async (e) => { onClick={async e => {
e.stopPropagation(); e.stopPropagation();
const activeAutoPreset = await DataStore.get("activeAutoPreset"); const activeAutoPreset = await DataStore.get("activeAutoPreset");
openModal((props: ModalProps) => <AutoColorwaySelector autoColorwayId={activeAutoPreset} modalProps={props} onChange={autoPresetId => { openModal((props: ModalProps) => <AutoColorwaySelector autoColorwayId={activeAutoPreset} modalProps={props} onChange={autoPresetId => {
@ -591,7 +589,7 @@ export default function ({
{activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />} {activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />}
</svg>} </svg>}
<div className="discordColorwayPreviewColorContainer"> <div className="discordColorwayPreviewColorContainer">
{!color.isGradient ? colors.map((colorItm) => <div {!color.isGradient ? colors.map(colorItm => <div
className="discordColorwayPreviewColor" className="discordColorwayPreviewColor"
style={{ style={{
backgroundColor: color[colorItm], backgroundColor: color[colorItm],
@ -609,9 +607,9 @@ export default function ({
{(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>{color.name}</Text>} {(showLabelsInSelectorGridView || viewMode === "list") && <Text className={"colorwayLabel" + ((showLabelsInSelectorGridView && viewMode === "grid") ? " labelInGrid" : "")}>{color.name}</Text>}
{settings.selectorType === "normal" && <div {settings.selectorType === "normal" && <div
className="colorwayInfoIconContainer" className="colorwayInfoIconContainer"
onClick={(e) => { onClick={e => {
e.stopPropagation(); e.stopPropagation();
openModal((props) => <ColorwayInfoModal openModal(props => <ColorwayInfoModal
modalProps={props} modalProps={props}
colorway={color} colorway={color}
loadUIProps={loadUI} loadUIProps={loadUI}
@ -733,7 +731,7 @@ export default function ({
{activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />} {activeColorwayObject.id === color.name && activeColorwayObject.source === color.source && <circle cx="12" cy="12" r="5" className="radioIconForeground-3wH3aU" fill="currentColor" />}
</svg>} </svg>}
<div className="discordColorwayPreviewColorContainer"> <div className="discordColorwayPreviewColorContainer">
{!color.isGradient ? colors.map((colorItm) => <div {!color.isGradient ? colors.map(colorItm => <div
className="discordColorwayPreviewColor" className="discordColorwayPreviewColor"
style={{ style={{
backgroundColor: color[colorItm], backgroundColor: color[colorItm],

View file

@ -26,8 +26,8 @@ const badVerbsReplacements = ["love", "eat", "deconstruct", "marry", "fart", "te
const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "Anime", "Anime girl", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "bath", "virus", "bathroom", "mom", "owner", "airport", "Avast Antivirus Free"]; const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "Anime", "Anime girl", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "bath", "virus", "bathroom", "mom", "owner", "airport", "Avast Antivirus Free"];
function replaceBadNouns(content) { function replaceBadNouns(content) {
// eslint-disable-next-line quotes
const regex = new RegExp('\\b(' + badNouns.join('|') + ')\\b', 'gi'); const regex = new RegExp("\\b(" + badNouns.join("|") + ")\\b", "gi");
return content.replace(regex, function (match) { return content.replace(regex, function (match) {
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length); const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
@ -36,8 +36,8 @@ function replaceBadNouns(content) {
} }
function replaceBadVerbs(content) { function replaceBadVerbs(content) {
// eslint-disable-next-line quotes
const regex = new RegExp('\\b(' + badVerbs.join('|') + ')\\b', 'gi'); const regex = new RegExp("\\b(" + badVerbs.join("|") + ")\\b", "gi");
return content.replace(regex, function (match) { return content.replace(regex, function (match) {
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length); const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);

View file

@ -28,7 +28,7 @@ export default new (class NoteHandler {
}, },
flags: message.flags, flags: message.flags,
// Moment has a toString() function, this doesn't convert to '[object Object]'. // Moment has a toString() function, this doesn't convert to '[object Object]'.
// eslint-disable-next-line @typescript-eslint/no-base-to-string
timestamp: message.timestamp.toString(), timestamp: message.timestamp.toString(),
attachments: message.attachments as Discord.Attachment[], attachments: message.attachments as Discord.Attachment[],
embeds: message.embeds, embeds: message.embeds,

View file

@ -1,5 +1,5 @@
/* eslint-disable simple-header/header */ /* eslint-disable simple-header/header */
/* eslint-disable indent */
/* /*
* Vencord, a modification for Discord's desktop app * Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 your mom lol * Copyright (c) 2023 your mom lol

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
/* eslint-disable indent */
import "./styles.css"; import "./styles.css";
import { generateId } from "@api/Commands"; import { generateId } from "@api/Commands";

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { get } from "@main/utils/simpleGet";
import { IpcEvents } from "@shared/IpcEvents"; import { IpcEvents } from "@shared/IpcEvents";
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent"; import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
import { app, dialog, ipcMain } from "electron"; import { app, dialog, ipcMain } from "electron";
@ -25,7 +26,6 @@ import { join } from "path";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import gitRemote from "~git-remote"; import gitRemote from "~git-remote";
import { get } from "../utils/simpleGet";
import { ASAR_FILE, serializeErrors } from "./common"; import { ASAR_FILE, serializeErrors } from "./common";
const API_BASE = `https://api.github.com/repos/${gitRemote}`; const API_BASE = `https://api.github.com/repos/${gitRemote}`;

1
src/modules.d.ts vendored
View file

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// eslint-disable-next-line spaced-comment
/// <reference types="standalone-electron-types"/> /// <reference types="standalone-electron-types"/>
declare module "~plugins" { declare module "~plugins" {

View file

@ -26,9 +26,8 @@ export default definePlugin({
patches: [{ patches: [{
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL", find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
replacement: { replacement: {
// foo && !bar ? createElement(reactionStuffs)... createElement(blah,...makeElement(reply-other)) match: /"reply-self".+?Fragment,{children:\[(?=.+?\((\i\.\i),{label:)(?<=message:(\i).+?)/,
match: /\i&&!\i\?\(0,\i\.jsxs?\)\(.{0,200}renderEmojiPicker:.{0,500}\?(\i)\(\{key:"reply-other"(?<=message:(\i).+?)/, replace: (m, PopoverButton, msg) => `${m}...Vencord.Api.MessagePopover._buildPopoverElements(${msg},${PopoverButton}),`
replace: (m, makeElement, msg) => `...Vencord.Api.MessagePopover._buildPopoverElements(${msg},${makeElement}),${m}`
} }
}], }],
}); });

View file

@ -27,7 +27,7 @@ export default definePlugin({
authors: [Devs.D3SOX, Devs.Nickyux], authors: [Devs.D3SOX, Devs.Nickyux],
patches: [ patches: [
{ {
find: ".PREMIUM_GUILD_SUBSCRIPTION_TOOLTIP", find: ".Messages.GUILD_OWNER,",
replacement: { replacement: {
match: /,isOwner:(\i),/, match: /,isOwner:(\i),/,
replace: ",_isOwner:$1=$self.isGuildOwner(e)," replace: ",_isOwner:$1=$self.isGuildOwner(e),"

View file

@ -26,7 +26,7 @@
} }
.vc-st-modal-header { .vc-st-modal-header {
place-content: space-between center; place-content: center space-between;
} }
.vc-st-modal-header h1 { .vc-st-modal-header h1 {
@ -43,4 +43,4 @@
.vc-st-button svg { .vc-st-button svg {
transform: scale(1.1) translateY(1px); transform: scale(1.1) translateY(1px);
} }

View file

@ -311,7 +311,7 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// Create a variable for the channel prop // Create a variable for the channel prop
match: /maxUsers:\i,users:\i.+?}=(\i).*?;/, match: /users:\i,maxUsers:\i.+?}=(\i).*?;/,
replace: (m, props) => `${m}let{shcChannel}=${props};` replace: (m, props) => `${m}let{shcChannel}=${props};`
}, },
{ {

View file

@ -165,7 +165,6 @@ function SeekBar() {
const [position, setPosition] = useState(storePosition); const [position, setPosition] = useState(storePosition);
// eslint-disable-next-line consistent-return
useEffect(() => { useEffect(() => {
if (isPlaying && !isSettingPosition) { if (isPlaying && !isSettingPosition) {
setPosition(SpotifyStore.position); setPosition(SpotifyStore.position);
@ -358,7 +357,7 @@ export function Player() {
const [shouldHide, setShouldHide] = useState(false); const [shouldHide, setShouldHide] = useState(false);
// Hide player after 5 minutes of inactivity // Hide player after 5 minutes of inactivity
// eslint-disable-next-line consistent-return
React.useEffect(() => { React.useEffect(() => {
setShouldHide(false); setShouldHide(false);
if (!isPlaying) { if (!isPlaying) {

View file

@ -102,9 +102,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0.2rem; padding: 0.2rem;
justify-content: center;
align-items: flex-start; align-items: flex-start;
align-content: flex-start; place-content: flex-start center;
overflow: hidden; overflow: hidden;
} }

View file

@ -3,7 +3,7 @@
} }
.vc-trans-modal-header { .vc-trans-modal-header {
place-content: space-between center; place-content: center space-between;
} }
.vc-trans-modal-header h1 { .vc-trans-modal-header h1 {
@ -37,4 +37,4 @@
.vc-trans-chat-button { .vc-trans-chat-button {
scale: 1.085; scale: 1.085;
} }

View file

@ -8,7 +8,7 @@ import { definePluginSettings } from "@api/Settings";
import { makeRange } from "@components/PluginSettings/components"; import { makeRange } from "@components/PluginSettings/components";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import definePlugin, { OptionType, ReporterTestable } from "@utils/types"; import definePlugin, { OptionType, PluginNative, ReporterTestable } from "@utils/types";
import { findByCodeLazy, findLazy } from "@webpack"; import { findByCodeLazy, findLazy } from "@webpack";
import { Button, ChannelStore, GuildStore, UserStore } from "@webpack/common"; import { Button, ChannelStore, GuildStore, UserStore } from "@webpack/common";
import type { Channel, Embed, GuildMember, MessageAttachment, User } from "discord-types/general"; import type { Channel, Embed, GuildMember, MessageAttachment, User } from "discord-types/general";
@ -102,6 +102,12 @@ const settings = definePluginSettings({
await start(); await start();
} }
}, },
preferUDP: {
type: OptionType.BOOLEAN,
description: "Enable if you use an older build of XSOverlay unable to connect through websockets. This setting is ignored on web.",
default: false,
disabled: () => IS_WEB
},
botNotifications: { botNotifications: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Allow bot notifications", description: "Allow bot notifications",
@ -178,6 +184,8 @@ async function start() {
}); });
} }
const Native = VencordNative.pluginHelpers.XSOverlay as PluginNative<typeof import("./native")>;
export default definePlugin({ export default definePlugin({
name: "XSOverlay", name: "XSOverlay",
description: "Forwards discord notifications to XSOverlay, for easy viewing in VR", description: "Forwards discord notifications to XSOverlay, for easy viewing in VR",
@ -349,6 +357,10 @@ function sendOtherNotif(content: string, titleString: string) {
} }
async function sendToOverlay(notif: NotificationObject) { async function sendToOverlay(notif: NotificationObject) {
if (!IS_WEB && settings.store.preferUDP) {
Native.sendToOverlay(notif);
return;
}
const apiObject: ApiObject = { const apiObject: ApiObject = {
sender: "Vencord", sender: "Vencord",
target: "xsoverlay", target: "xsoverlay",

View file

@ -0,0 +1,16 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { createSocket, Socket } from "dgram";
let xsoSocket: Socket;
export function sendToOverlay(_, data: any) {
data.messageType = data.type;
const json = JSON.stringify(data);
xsoSocket ??= createSocket("udp4");
xsoSocket.send(json, 42069, "127.0.0.1");
}

View file

@ -165,11 +165,11 @@ const overrideObject = (obj, propertyName, overrideValue) => {
} }
let overriden = false; let overriden = false;
for (const key in obj) { for (const key in obj) {
// eslint-disable-next-line no-prototype-builtins
if (obj.hasOwnProperty(key) && key === propertyName) { if (obj.hasOwnProperty(key) && key === propertyName) {
obj[key] = overrideValue; obj[key] = overrideValue;
overriden = true; overriden = true;
// eslint-disable-next-line no-prototype-builtins
} else if (obj.hasOwnProperty(key) && typeof obj[key] === "object") { } else if (obj.hasOwnProperty(key) && typeof obj[key] === "object") {
if (overrideObject(obj[key], propertyName, overrideValue)) { if (overrideObject(obj[key], propertyName, overrideValue)) {
overriden = true; overriden = true;

View file

@ -17,8 +17,7 @@
*/ */
import { LazyComponent } from "@utils/react"; import { LazyComponent } from "@utils/react";
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "@webpack";
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "../webpack";
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]): T { export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]): T {
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]); if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);

View file

@ -16,7 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { filters, mapMangledModuleLazy, waitFor } from "../webpack"; import { filters, mapMangledModuleLazy, waitFor } from "@webpack";
import type * as t from "./types/menu"; import type * as t from "./types/menu";
export let Menu = {} as t.Menu; export let Menu = {} as t.Menu;

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { findByPropsLazy, waitFor } from "../webpack"; import { findByPropsLazy, waitFor } from "@webpack";
export let React: typeof import("react"); export let React: typeof import("react");
export let useState: typeof React.useState; export let useState: typeof React.useState;

View file

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import type * as Stores from "discord-types/stores"; import type * as Stores from "discord-types/stores";
import { findByCodeLazy, findByPropsLazy } from "../webpack";
import { waitForStore } from "./internal"; import { waitForStore } from "./internal";
import * as t from "./types/stores"; import * as t from "./types/stores";
@ -66,7 +66,6 @@ export let DraftStore: t.DraftStore;
* *
* @example const user = useStateFromStores([UserStore], () => UserStore.getCurrentUser(), null, (old, current) => old.id === current.id); * @example const user = useStateFromStores([UserStore], () => UserStore.getCurrentUser(), null, (old, current) => old.id === current.id);
*/ */
// eslint-disable-next-line prefer-destructuring
export const useStateFromStores: t.useStateFromStores = findByCodeLazy("useStateFromStores"); export const useStateFromStores: t.useStateFromStores = findByCodeLazy("useStateFromStores");
waitForStore("DraftStore", s => DraftStore = s); waitForStore("DraftStore", s => DraftStore = s);

View file

@ -17,9 +17,9 @@
*/ */
import { canonicalizeMatch } from "@utils/patches"; import { canonicalizeMatch } from "@utils/patches";
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "@webpack";
import type { Channel } from "discord-types/general"; import type { Channel } from "discord-types/general";
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
import type * as t from "./types/utils"; import type * as t from "./types/utils";
export let FluxDispatcher: t.FluxDispatcher; export let FluxDispatcher: t.FluxDispatcher;

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { patches } from "@plugins";
import { WEBPACK_CHUNK } from "@utils/constants"; import { WEBPACK_CHUNK } from "@utils/constants";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { canonicalizeReplacement } from "@utils/patches"; import { canonicalizeReplacement } from "@utils/patches";
@ -23,7 +24,6 @@ import { PatchReplacement } from "@utils/types";
import { WebpackInstance } from "discord-types/other"; import { WebpackInstance } from "discord-types/other";
import { traceFunction } from "../debug/Tracer"; import { traceFunction } from "../debug/Tracer";
import { patches } from "../plugins";
import { _initWebpack, beforeInitListeners, factoryListeners, moduleListeners, subscriptions, wreq } from "."; import { _initWebpack, beforeInitListeners, factoryListeners, moduleListeners, subscriptions, wreq } from ".";
const logger = new Logger("WebpackInterceptor", "#8caaee"); const logger = new Logger("WebpackInterceptor", "#8caaee");

View file

@ -4,6 +4,7 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"allowJs": true,
"lib": [ "lib": [
"DOM", "DOM",
"DOM.Iterable", "DOM.Iterable",
@ -54,9 +55,13 @@
"transform": "typescript-transform-paths", "transform": "typescript-transform-paths",
"afterDeclarations": true "afterDeclarations": true
} }
] ],
"outDir": "who-fucking-cares-dude"
}, },
"include": [ "include": [
"src/**/*" "src/**/*",
] "browser/**/*",
} "scripts/**/*",
"eslint.config.mjs"
],
}