Compare commits
173 commits
asar-bundl
...
main
Author | SHA1 | Date | |
---|---|---|---|
Ulysia | 1d5709763a | ||
9d4e859a0a | |||
439a4f8eb6 | |||
00f82e96bd | |||
5216bcca1e | |||
e7e298d2e7 | |||
d897dab054 | |||
88e8fa7e90 | |||
f5f59be1b6 | |||
534ab3eb5f | |||
a6ea03bacc | |||
Ulysia | c3bdc71512 | ||
e620431210 | |||
5afc24b41a | |||
7f8e241b9c | |||
553293ceee | |||
0af820c874 | |||
a11ccde40f | |||
58c3032bb2 | |||
4e89352758 | |||
e818905520 | |||
aa1b446c07 | |||
2dce060cf9 | |||
89bb3ee30a | |||
47db61d00e | |||
Ulysia | a592586af7 | ||
Ulysia | 0567320fc6 | ||
416d85dcf0 | |||
013c8d061d | |||
b5f626d1ff | |||
1e01f85217 | |||
91a32e22de | |||
43b3c137ce | |||
18f7b74210 | |||
eab0cf9966 | |||
e7956413e2 | |||
832e874c35 | |||
55146db760 | |||
bc59fc41b3 | |||
1abfb5f0cf | |||
cb2848f186 | |||
c3f2e76b9c | |||
eb63a54fa6 | |||
5881716c57 | |||
d7cbe270e5 | |||
c29362ca89 | |||
fd0fbace2e | |||
409f47bf24 | |||
b0e2f310bc | |||
65069c673c | |||
b1db18c319 | |||
db5fe2a394 | |||
e4318a887a | |||
eaf62d8c1c | |||
22a5b18bfa | |||
1dc2d92493 | |||
492b0cff08 | |||
2d675b4b2e | |||
49b0a38c37 | |||
467157539c | |||
e8242f22c9 | |||
f7587d9b2e | |||
755e869db7 | |||
a015cf96f6 | |||
c7e5295da0 | |||
8afd79dd50 | |||
65c5897dc3 | |||
6cce8a8bc4 | |||
1848b16536 | |||
c572116b97 | |||
e26986f66a | |||
f12335a371 | |||
640d99dcda | |||
bcfef05a8a | |||
f17b92c2fd | |||
292f7d71d3 | |||
9d67421b34 | |||
b822542352 | |||
f27361f017 | |||
a765212cfe | |||
c07d78fa96 | |||
56459bdcad | |||
868b2ea9f0 | |||
9e7f8829f2 | |||
e5a4db6460 | |||
8890c8c6b4 | |||
61d3c08f1f | |||
e6994e1946 | |||
40512d7294 | |||
be02baffaa | |||
99cd423efb | |||
7333f40db6 | |||
244cb26c32 | |||
df8aec8e3c | |||
d10e649b63 | |||
7f784befc2 | |||
30e4e83158 | |||
4c4f2894fb | |||
c51d7b8fb4 | |||
accfc15125 | |||
27e81b20db | |||
d0ad4e6c1d | |||
0c71d6c3fa | |||
74fd85bd3d | |||
968e688c10 | |||
b595a3e33c | |||
e07a4e19e6 | |||
273981deb7 | |||
81eabc7ee2 | |||
d5eaae9d51 | |||
00276cad7c | |||
ee9fbc4d25 | |||
0cea347264 | |||
eb0d91fd8e | |||
07e629d8d4 | |||
e473a57c3d | |||
ad3d936dfd | |||
db2f5c9292 | |||
5bfc608f7d | |||
7d8214fc37 | |||
cdf72cf4be | |||
4b16fbcaa9 | |||
7ec842d4b0 | |||
6659f2c413 | |||
1fb5e8df99 | |||
1e8f59f13d | |||
f0e6986835 | |||
8afcb8e4dd | |||
2569c39ddf | |||
ed9b28febf | |||
2e81b9aeba | |||
44c8463496 | |||
2bdc2f4e82 | |||
66b247b2d3 | |||
3d80cb2d55 | |||
904022a2f7 | |||
9cada9ad13 | |||
051bce89f8 | |||
eaca14bb5a | |||
d388aa4347 | |||
4301ed889d | |||
1a712e75a6 | |||
87e6fa8647 | |||
003e4a08d5 | |||
4e3c178043 | |||
5160f906f4 | |||
021d9bf179 | |||
d1996034b7 | |||
8274b67597 | |||
e437498c8f | |||
09c6c16cf9 | |||
e99eec50bc | |||
d919cd6bf1 | |||
c185f47f4d | |||
83d90f03ee | |||
0f8d21a846 | |||
2658459a98 | |||
f8b01c1a31 | |||
2382294e8b | |||
d47be6c017 | |||
6c12a33aa6 | |||
9cc42bf457 | |||
1bfdcf2697 | |||
3013c669c0 | |||
e460b5efb6 | |||
902a86c3b2 | |||
51ae019cd5 | |||
0f5cf37ef9 | |||
5c88284ed3 | |||
5e9a9fe836 | |||
bc801853e2 | |||
2044264729 | |||
3704c71ae1 |
|
@ -1,98 +0,0 @@
|
||||||
{
|
|
||||||
"root": true,
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"ignorePatterns": ["dist", "browser", "packages/vencord-types"],
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"simple-header",
|
|
||||||
"simple-import-sort",
|
|
||||||
"unused-imports",
|
|
||||||
"path-alias"
|
|
||||||
],
|
|
||||||
"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",
|
|
||||||
|
|
||||||
"path-alias/no-relative": "error"
|
|
||||||
}
|
|
||||||
}
|
|
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
|
@ -40,28 +40,9 @@ jobs:
|
||||||
- name: Generate plugin list
|
- name: Generate plugin list
|
||||||
run: pnpm generatePluginJson dist/plugins.json dist/plugin-readmes.json
|
run: pnpm generatePluginJson dist/plugins.json dist/plugin-readmes.json
|
||||||
|
|
||||||
- name: Collect files to be released
|
- name: Clean up obsolete files
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
rm -rf dist/*-unpacked dist/monaco Vencord.user.css vencordDesktopRenderer.css vencordDesktopRenderer.css.map
|
||||||
mkdir release
|
|
||||||
|
|
||||||
cp browser/browser.* release
|
|
||||||
cp Vencord.user.{js,js.LEGAL.txt} release
|
|
||||||
|
|
||||||
# copy the plugin data jsons, the extension zips and the desktop/vesktop asars
|
|
||||||
cp *.{json,zip,asar} release
|
|
||||||
|
|
||||||
# legacy un-asared files
|
|
||||||
# FIXME: remove at some point
|
|
||||||
cp desktop/* release
|
|
||||||
for file in vesktop/*; do
|
|
||||||
filename=$(basename "$file")
|
|
||||||
cp "$file" "release/vencordDesktop${filename^}"
|
|
||||||
done
|
|
||||||
|
|
||||||
find release -size 0 -delete
|
|
||||||
rm release/package.json
|
|
||||||
rm release/*.map
|
|
||||||
|
|
||||||
- name: Get some values needed for the release
|
- name: Get some values needed for the release
|
||||||
id: release_values
|
id: release_values
|
||||||
|
@ -69,14 +50,16 @@ jobs:
|
||||||
echo "release_tag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
echo "release_tag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload DevBuild as release
|
- name: Upload DevBuild as release
|
||||||
|
if: github.repository == 'Vendicated/Vencord'
|
||||||
run: |
|
run: |
|
||||||
gh release upload devbuild --clobber dist/release/*
|
gh release upload devbuild --clobber dist/*
|
||||||
gh release edit devbuild --title "DevBuild $RELEASE_TAG"
|
gh release edit devbuild --title "DevBuild $RELEASE_TAG"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RELEASE_TAG: ${{ env.release_tag }}
|
RELEASE_TAG: ${{ env.release_tag }}
|
||||||
|
|
||||||
- name: Upload DevBuild to builds repo
|
- name: Upload DevBuild to builds repo
|
||||||
|
if: github.repository == 'Vendicated/Vencord'
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "$USERNAME"
|
git config --global user.name "$USERNAME"
|
||||||
git config --global user.email actions@github.com
|
git config --global user.email actions@github.com
|
||||||
|
@ -86,7 +69,7 @@ jobs:
|
||||||
|
|
||||||
GLOBIGNORE=.git:.gitignore:README.md:LICENSE
|
GLOBIGNORE=.git:.gitignore:README.md:LICENSE
|
||||||
rm -rf *
|
rm -rf *
|
||||||
cp -r ../dist/release/* .
|
cp -r ../dist/* .
|
||||||
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Builds for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
git commit -m "Builds for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
||||||
|
|
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
|
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
|
||||||
|
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 19
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
@ -36,7 +36,7 @@ jobs:
|
||||||
|
|
||||||
- name: Publish extension
|
- name: Publish extension
|
||||||
run: |
|
run: |
|
||||||
cd dist/browser/chromium-unpacked
|
cd dist/chromium-unpacked
|
||||||
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish
|
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish
|
||||||
env:
|
env:
|
||||||
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -18,7 +18,5 @@ lerna-debug.log*
|
||||||
.pnpm-debug.log*
|
.pnpm-debug.log*
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
src/userplugins
|
|
||||||
|
|
||||||
ExtensionCache/
|
ExtensionCache/
|
||||||
settings/
|
settings/
|
||||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "src/userplugins/vc-message-logger-enhanced"]
|
||||||
|
path = src/userplugins/vc-message-logger-enhanced
|
||||||
|
url = https://github.com/Syncxv/vc-message-logger-enhanced.git
|
|
@ -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]*)*$",
|
||||||
{
|
{
|
||||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -14,8 +14,6 @@
|
||||||
"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",
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// @author Vendicated (https://github.com/Vendicated)
|
// @author Vendicated (https://github.com/Vendicated)
|
||||||
// @namespace https://github.com/Vendicated/Vencord
|
// @namespace https://github.com/Vendicated/Vencord
|
||||||
// @supportURL https://github.com/Vendicated/Vencord
|
// @supportURL https://github.com/Vendicated/Vencord
|
||||||
|
// @icon https://raw.githubusercontent.com/Vendicated/Vencord/refs/heads/main/browser/icon.png
|
||||||
// @license GPL-3.0
|
// @license GPL-3.0
|
||||||
// @match *://*.discord.com/*
|
// @match *://*.discord.com/*
|
||||||
// @grant GM_xmlhttpRequest
|
// @grant GM_xmlhttpRequest
|
||||||
|
|
126
eslint.config.mjs
Normal file
126
eslint.config.mjs
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* 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 pathAlias from "eslint-plugin-path-alias";
|
||||||
|
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,
|
||||||
|
"path-alias": pathAlias,
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
"path-alias/no-relative": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
73
package.json
73
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.5",
|
"version": "1.10.6",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"author": "Vendicated",
|
"author": "Vendicated",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsx scripts/build/build.mts",
|
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
||||||
"buildStandalone": "pnpm build --standalone",
|
"buildStandalone": "pnpm build --standalone",
|
||||||
"buildWeb": "tsx scripts/build/buildWeb.mts",
|
"buildWeb": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/buildWeb.mjs",
|
||||||
"buildWebStandalone": "pnpm buildWeb --standalone",
|
"buildWebStandalone": "pnpm buildWeb --standalone",
|
||||||
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
||||||
"buildReporterDesktop": "pnpm build --reporter",
|
"buildReporterDesktop": "pnpm build --reporter",
|
||||||
|
@ -27,7 +27,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 && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson",
|
"test": "pnpm buildStandalone && pnpm lint && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson",
|
||||||
|
@ -35,54 +35,55 @@
|
||||||
"testTsc": "tsc --noEmit"
|
"testTsc": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sapphi-red/web-noise-suppressor": "0.3.3",
|
"@intrnl/xxhash64": "^0.1.2",
|
||||||
|
"@sapphi-red/web-noise-suppressor": "0.3.5",
|
||||||
"@vap/core": "0.0.12",
|
"@vap/core": "0.0.12",
|
||||||
"@vap/shiki": "0.10.5",
|
"@vap/shiki": "0.10.5",
|
||||||
"eslint-plugin-simple-header": "^1.0.2",
|
"fflate": "^0.8.2",
|
||||||
"fflate": "^0.7.4",
|
|
||||||
"gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3",
|
"gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3",
|
||||||
"monaco-editor": "^0.50.0",
|
"monaco-editor": "^0.50.0",
|
||||||
"nanoid": "^4.0.2",
|
"nanoid": "^5.0.7",
|
||||||
"virtual-merge": "^1.0.1"
|
"virtual-merge": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron/asar": "^3.2.10",
|
"@stylistic/eslint-plugin": "^2.6.1",
|
||||||
"@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.15.18",
|
||||||
"eslint": "^8.46.0",
|
"eslint": "^9.8.0",
|
||||||
"eslint-import-resolver-alias": "^1.1.2",
|
"eslint-import-resolver-alias": "^1.1.2",
|
||||||
"eslint-plugin-path-alias": "^1.0.0",
|
"eslint-plugin-path-alias": "2.1.0",
|
||||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
"eslint-plugin-simple-header": "^1.1.1",
|
||||||
"eslint-plugin-unused-imports": "^2.0.0",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"highlight.js": "10.6.0",
|
"eslint-plugin-unused-imports": "^4.0.1",
|
||||||
|
"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",
|
"ts-pattern": "^5.3.1",
|
||||||
"type-fest": "^3.9.0",
|
"tsx": "^4.16.5",
|
||||||
"typescript": "^5.4.5",
|
"type-fest": "^4.23.0",
|
||||||
|
"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"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.1.0",
|
"packageManager": "pnpm@9.1.0",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"eslint-plugin-path-alias@1.0.0": "patches/eslint-plugin-path-alias@1.0.0.patch",
|
"eslint@9.8.0": "patches/eslint@9.8.0.patch",
|
||||||
"eslint@8.46.0": "patches/eslint@8.46.0.patch"
|
"eslint-plugin-path-alias@2.1.0": "patches/eslint-plugin-path-alias@2.1.0.patch"
|
||||||
},
|
},
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
"ignoreMissing": [
|
"ignoreMissing": [
|
||||||
|
@ -105,7 +106,7 @@
|
||||||
"sourceDir": "./dist/firefox-unpacked"
|
"sourceDir": "./dist/firefox-unpacked"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20",
|
"node": ">=18",
|
||||||
"pnpm": ">=9"
|
"pnpm": ">=9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/lib/rules/no-relative.js b/lib/rules/no-relative.js
|
|
||||||
index 71594c83f1f4f733ffcc6047d7f7084348335dbe..d8623d87c89499c442171db3272cba07c9efabbe 100644
|
|
||||||
--- a/lib/rules/no-relative.js
|
|
||||||
+++ b/lib/rules/no-relative.js
|
|
||||||
@@ -41,7 +41,7 @@ module.exports = {
|
|
||||||
ImportDeclaration(node) {
|
|
||||||
const importPath = node.source.value;
|
|
||||||
|
|
||||||
- if (!/^(\.?\.\/)/.test(importPath)) {
|
|
||||||
+ if (!/^(\.\.\/)/.test(importPath)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
14
patches/eslint-plugin-path-alias@2.1.0.patch
Normal file
14
patches/eslint-plugin-path-alias@2.1.0.patch
Normal 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};
|
2818
pnpm-lock.yaml
2818
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -17,30 +17,31 @@
|
||||||
* 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 { createPackage } from "@electron/asar";
|
import esbuild from "esbuild";
|
||||||
import { BuildOptions, Plugin } from "esbuild";
|
import { readdir } from "fs/promises";
|
||||||
import { existsSync, readdirSync } from "fs";
|
|
||||||
import { readdir, rm, writeFile } from "fs/promises";
|
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, watch } from "./common.mjs";
|
import { BUILD_TIMESTAMP, commonOpts, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, commonRendererPlugins, watch } from "./common.mjs";
|
||||||
|
|
||||||
const defines = {
|
const defines = {
|
||||||
IS_STANDALONE: String(IS_STANDALONE),
|
IS_STANDALONE,
|
||||||
IS_DEV: String(IS_DEV),
|
IS_DEV,
|
||||||
IS_REPORTER: String(IS_REPORTER),
|
IS_REPORTER,
|
||||||
IS_UPDATER_DISABLED: String(IS_UPDATER_DISABLED),
|
IS_UPDATER_DISABLED,
|
||||||
IS_WEB: "false",
|
IS_WEB: false,
|
||||||
IS_EXTENSION: "false",
|
IS_EXTENSION: false,
|
||||||
VERSION: JSON.stringify(VERSION),
|
VERSION: JSON.stringify(VERSION),
|
||||||
BUILD_TIMESTAMP: String(BUILD_TIMESTAMP)
|
BUILD_TIMESTAMP
|
||||||
};
|
};
|
||||||
|
|
||||||
if (defines.IS_STANDALONE === "false")
|
if (defines.IS_STANDALONE === false)
|
||||||
// If this is a local build (not standalone), optimize
|
// If this is a local build (not standalone), optimize
|
||||||
// for the specific platform we're on
|
// for the specific platform we're on
|
||||||
defines["process.platform"] = JSON.stringify(process.platform);
|
defines["process.platform"] = JSON.stringify(process.platform);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {esbuild.BuildOptions}
|
||||||
|
*/
|
||||||
const nodeCommonOpts = {
|
const nodeCommonOpts = {
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
|
@ -48,12 +49,15 @@ const nodeCommonOpts = {
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
external: ["electron", "original-fs", "~pluginNatives", ...commonOpts.external],
|
external: ["electron", "original-fs", "~pluginNatives", ...commonOpts.external],
|
||||||
define: defines
|
define: defines
|
||||||
} satisfies BuildOptions;
|
};
|
||||||
|
|
||||||
const sourceMapFooter = (s: string) => watch ? "" : `//# sourceMappingURL=vencord://${s}.js.map`;
|
const sourceMapFooter = s => watch ? "" : `//# sourceMappingURL=vencord://${s}.js.map`;
|
||||||
const sourcemap = watch ? "inline" : "external";
|
const sourcemap = watch ? "inline" : "external";
|
||||||
|
|
||||||
const globNativesPlugin: Plugin = {
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
const globNativesPlugin = {
|
||||||
name: "glob-natives-plugin",
|
name: "glob-natives-plugin",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^~pluginNatives$/;
|
const filter = /^~pluginNatives$/;
|
||||||
|
@ -100,26 +104,26 @@ const globNativesPlugin: Plugin = {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
// Discord Desktop main & renderer & preload
|
// Discord Desktop main & renderer & preload
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/main/index.ts"],
|
entryPoints: ["src/main/index.ts"],
|
||||||
outfile: "dist/desktop/patcher.js",
|
outfile: "dist/patcher.js",
|
||||||
footer: { js: "//# sourceURL=VencordPatcher\n" + sourceMapFooter("patcher") },
|
footer: { js: "//# sourceURL=VencordPatcher\n" + sourceMapFooter("patcher") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "true",
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: "false"
|
IS_VESKTOP: false
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...nodeCommonOpts.plugins,
|
...nodeCommonOpts.plugins,
|
||||||
globNativesPlugin
|
globNativesPlugin
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
entryPoints: ["src/Vencord.ts"],
|
entryPoints: ["src/Vencord.ts"],
|
||||||
outfile: "dist/desktop/renderer.js",
|
outfile: "dist/renderer.js",
|
||||||
format: "iife",
|
format: "iife",
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
||||||
|
@ -127,111 +131,79 @@ await Promise.all([
|
||||||
sourcemap,
|
sourcemap,
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins("discordDesktop"),
|
globPlugins("discordDesktop"),
|
||||||
...commonOpts.plugins
|
...commonRendererPlugins
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "true",
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: "false"
|
IS_VESKTOP: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/preload.ts"],
|
entryPoints: ["src/preload.ts"],
|
||||||
outfile: "dist/desktop/preload.js",
|
outfile: "dist/preload.js",
|
||||||
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "true",
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: "false"
|
IS_VESKTOP: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Vencord Desktop main & renderer & preload
|
// Vencord Desktop main & renderer & preload
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/main/index.ts"],
|
entryPoints: ["src/main/index.ts"],
|
||||||
outfile: "dist/vesktop/main.js",
|
outfile: "dist/vencordDesktopMain.js",
|
||||||
footer: { js: "//# sourceURL=VencordMain\n" + sourceMapFooter("main") },
|
footer: { js: "//# sourceURL=VencordDesktopMain\n" + sourceMapFooter("vencordDesktopMain") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "false",
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: "true"
|
IS_VESKTOP: true
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...nodeCommonOpts.plugins,
|
...nodeCommonOpts.plugins,
|
||||||
globNativesPlugin
|
globNativesPlugin
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
entryPoints: ["src/Vencord.ts"],
|
entryPoints: ["src/Vencord.ts"],
|
||||||
outfile: "dist/vesktop/renderer.js",
|
outfile: "dist/vencordDesktopRenderer.js",
|
||||||
format: "iife",
|
format: "iife",
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
footer: { js: "//# sourceURL=VencordDesktopRenderer\n" + sourceMapFooter("vencordDesktopRenderer") },
|
||||||
globalName: "Vencord",
|
globalName: "Vencord",
|
||||||
sourcemap,
|
sourcemap,
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins("vencordDesktop"),
|
globPlugins("vencordDesktop"),
|
||||||
...commonOpts.plugins
|
...commonRendererPlugins
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "false",
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: "true"
|
IS_VESKTOP: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/preload.ts"],
|
entryPoints: ["src/preload.ts"],
|
||||||
outfile: "dist/vesktop/preload.js",
|
outfile: "dist/vencordDesktopPreload.js",
|
||||||
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("vencordDesktopPreload") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: "false",
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: "true"
|
IS_VESKTOP: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]);
|
]).catch(err => {
|
||||||
|
console.error("Build failed");
|
||||||
await buildOrWatchAll();
|
console.error(err.message);
|
||||||
|
// make ci fail
|
||||||
await Promise.all([
|
if (!commonOpts.watch)
|
||||||
writeFile("dist/desktop/package.json", JSON.stringify({
|
process.exitCode = 1;
|
||||||
name: "vencord",
|
});
|
||||||
main: "patcher.js"
|
|
||||||
})),
|
|
||||||
writeFile("dist/vesktop/package.json", JSON.stringify({
|
|
||||||
name: "vencord",
|
|
||||||
main: "main.js"
|
|
||||||
}))
|
|
||||||
]);
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
createPackage("dist/desktop", "dist/desktop.asar"),
|
|
||||||
createPackage("dist/vesktop", "dist/vesktop.asar")
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
if (existsSync("dist/renderer.js")) {
|
|
||||||
console.warn("Legacy dist folder. Cleaning up and adding shims.");
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
readdirSync("dist")
|
|
||||||
.filter(f =>
|
|
||||||
f.endsWith(".map") ||
|
|
||||||
f.endsWith(".LEGAL.txt") ||
|
|
||||||
["patcher", "preload", "renderer"].some(name => f.startsWith(name))
|
|
||||||
)
|
|
||||||
.map(file => rm(join("dist", file)))
|
|
||||||
);
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
writeFile("dist/patcher.js", 'require("./desktop")'),
|
|
||||||
writeFile("dist/vencordDesktopMain.js", 'require("./vesktop")')
|
|
||||||
]);
|
|
||||||
}
|
|
|
@ -23,12 +23,12 @@ import { appendFile, mkdir, readdir, readFile, rm, writeFile } from "fs/promises
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import Zip from "zip-local";
|
import Zip from "zip-local";
|
||||||
|
|
||||||
import { addBuild, BUILD_TIMESTAMP, buildOrWatchAll, commonOpts, globPlugins, IS_DEV, IS_REPORTER, VERSION } from "./common.mjs";
|
import { BUILD_TIMESTAMP, commonOpts, globPlugins, IS_DEV, IS_REPORTER, VERSION, commonRendererPlugins } from "./common.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {esbuild.BuildOptions}
|
* @type {esbuild.BuildOptions}
|
||||||
*/
|
*/
|
||||||
const commonOptions: esbuild.BuildOptions = {
|
const commonOptions = {
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
entryPoints: ["browser/Vencord.ts"],
|
entryPoints: ["browser/Vencord.ts"],
|
||||||
globalName: "Vencord",
|
globalName: "Vencord",
|
||||||
|
@ -36,20 +36,20 @@ const commonOptions: esbuild.BuildOptions = {
|
||||||
external: ["~plugins", "~git-hash", "/assets/*"],
|
external: ["~plugins", "~git-hash", "/assets/*"],
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins("web"),
|
globPlugins("web"),
|
||||||
...commonOpts.plugins,
|
...commonRendererPlugins
|
||||||
],
|
],
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
define: {
|
define: {
|
||||||
IS_WEB: "true",
|
IS_WEB: true,
|
||||||
IS_EXTENSION: "false",
|
IS_EXTENSION: false,
|
||||||
IS_STANDALONE: "true",
|
IS_STANDALONE: true,
|
||||||
IS_DEV: String(IS_DEV),
|
IS_DEV,
|
||||||
IS_REPORTER: String(IS_REPORTER),
|
IS_REPORTER,
|
||||||
IS_DISCORD_DESKTOP: "false",
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: "false",
|
IS_VESKTOP: false,
|
||||||
IS_UPDATER_DISABLED: "true",
|
IS_UPDATER_DISABLED: true,
|
||||||
VERSION: JSON.stringify(VERSION),
|
VERSION: JSON.stringify(VERSION),
|
||||||
BUILD_TIMESTAMP: String(BUILD_TIMESTAMP)
|
BUILD_TIMESTAMP
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,39 +67,39 @@ const RnNoiseFiles = [
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[
|
[
|
||||||
addBuild({
|
esbuild.build({
|
||||||
entryPoints: MonacoWorkerEntryPoints.map(entry => `node_modules/monaco-editor/esm/${entry}`),
|
entryPoints: MonacoWorkerEntryPoints.map(entry => `node_modules/monaco-editor/esm/${entry}`),
|
||||||
bundle: true,
|
bundle: true,
|
||||||
minify: true,
|
minify: true,
|
||||||
format: "iife",
|
format: "iife",
|
||||||
outbase: "node_modules/monaco-editor/esm/",
|
outbase: "node_modules/monaco-editor/esm/",
|
||||||
outdir: "dist/browser/monaco"
|
outdir: "dist/monaco"
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
entryPoints: ["browser/monaco.ts"],
|
entryPoints: ["browser/monaco.ts"],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
minify: true,
|
minify: true,
|
||||||
format: "iife",
|
format: "iife",
|
||||||
outfile: "dist/browser/monaco/index.js",
|
outfile: "dist/monaco/index.js",
|
||||||
loader: {
|
loader: {
|
||||||
".ttf": "file"
|
".ttf": "file"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
outfile: "dist/browser/browser.js",
|
outfile: "dist/browser.js",
|
||||||
footer: { js: "//# sourceURL=VencordWeb" }
|
footer: { js: "//# sourceURL=VencordWeb" }
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
outfile: "dist/browser/extension.js",
|
outfile: "dist/extension.js",
|
||||||
define: {
|
define: {
|
||||||
...commonOptions?.define,
|
...commonOptions?.define,
|
||||||
IS_EXTENSION: "true",
|
IS_EXTENSION: true,
|
||||||
},
|
},
|
||||||
footer: { js: "//# sourceURL=VencordWeb" }
|
footer: { js: "//# sourceURL=VencordWeb" }
|
||||||
}),
|
}),
|
||||||
addBuild({
|
esbuild.build({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
inject: ["browser/GMPolyfill.js", ...(commonOptions?.inject || [])],
|
inject: ["browser/GMPolyfill.js", ...(commonOptions?.inject || [])],
|
||||||
define: {
|
define: {
|
||||||
|
@ -116,12 +116,18 @@ await Promise.all(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
);
|
).catch(err => {
|
||||||
|
console.error("Build failed");
|
||||||
|
console.error(err.message);
|
||||||
|
if (!commonOpts.watch)
|
||||||
|
process.exit(1);
|
||||||
|
});;
|
||||||
|
|
||||||
await buildOrWatchAll();
|
/**
|
||||||
|
* @type {(dir: string) => Promise<string[]>}
|
||||||
async function globDir(dir: string): Promise<string[]> {
|
*/
|
||||||
const files = [] as string[];
|
async function globDir(dir) {
|
||||||
|
const files = [];
|
||||||
|
|
||||||
for (const child of await readdir(dir, { withFileTypes: true })) {
|
for (const child of await readdir(dir, { withFileTypes: true })) {
|
||||||
const p = join(dir, child.name);
|
const p = join(dir, child.name);
|
||||||
|
@ -134,23 +140,27 @@ async function globDir(dir: string): Promise<string[]> {
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadDir(dir: string, basePath = "") {
|
/**
|
||||||
|
* @type {(dir: string, basePath?: string) => Promise<Record<string, string>>}
|
||||||
|
*/
|
||||||
|
async function loadDir(dir, basePath = "") {
|
||||||
const files = await globDir(dir);
|
const files = await globDir(dir);
|
||||||
return Object.fromEntries(await Promise.all(files.map(async f =>
|
return Object.fromEntries(await Promise.all(files.map(async f => [f.slice(basePath.length), await readFile(f)])));
|
||||||
[f.slice(basePath.length), await readFile(f)] as const
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buildExtension(target: string, files: string[]): Promise<void> {
|
/**
|
||||||
const entries: Record<string, Buffer> = {
|
* @type {(target: string, files: string[]) => Promise<void>}
|
||||||
"dist/Vencord.js": await readFile("dist/browser/extension.js"),
|
*/
|
||||||
"dist/Vencord.css": await readFile("dist/browser/extension.css"),
|
async function buildExtension(target, files) {
|
||||||
...await loadDir("dist/browser/monaco"),
|
const entries = {
|
||||||
|
"dist/Vencord.js": await readFile("dist/extension.js"),
|
||||||
|
"dist/Vencord.css": await readFile("dist/extension.css"),
|
||||||
|
...await loadDir("dist/monaco"),
|
||||||
...Object.fromEntries(await Promise.all(RnNoiseFiles.map(async file =>
|
...Object.fromEntries(await Promise.all(RnNoiseFiles.map(async file =>
|
||||||
[`third-party/rnnoise/${file.replace(/^dist\//, "")}`, await readFile(`node_modules/@sapphi-red/web-noise-suppressor/${file}`)] as const
|
[`third-party/rnnoise/${file.replace(/^dist\//, "")}`, await readFile(`node_modules/@sapphi-red/web-noise-suppressor/${file}`)]
|
||||||
))),
|
))),
|
||||||
...Object.fromEntries(await Promise.all(files.map(async f => {
|
...Object.fromEntries(await Promise.all(files.map(async f => {
|
||||||
let content: Uint8Array | Buffer = await readFile(join("browser", f));
|
let content = await readFile(join("browser", f));
|
||||||
if (f.startsWith("manifest")) {
|
if (f.startsWith("manifest")) {
|
||||||
const json = JSON.parse(content.toString("utf-8"));
|
const json = JSON.parse(content.toString("utf-8"));
|
||||||
json.version = VERSION;
|
json.version = VERSION;
|
||||||
|
@ -160,19 +170,19 @@ async function buildExtension(target: string, files: string[]): Promise<void> {
|
||||||
return [
|
return [
|
||||||
f.startsWith("manifest") ? "manifest.json" : f,
|
f.startsWith("manifest") ? "manifest.json" : f,
|
||||||
content
|
content
|
||||||
] as const;
|
];
|
||||||
})))
|
})))
|
||||||
};
|
};
|
||||||
|
|
||||||
await rm(target, { recursive: true, force: true });
|
await rm(target, { recursive: true, force: true });
|
||||||
await Promise.all(Object.entries(entries).map(async ([file, content]) => {
|
await Promise.all(Object.entries(entries).map(async ([file, content]) => {
|
||||||
const dest = join("dist/browser", target, file);
|
const dest = join("dist", target, file);
|
||||||
const parentDirectory = join(dest, "..");
|
const parentDirectory = join(dest, "..");
|
||||||
await mkdir(parentDirectory, { recursive: true });
|
await mkdir(parentDirectory, { recursive: true });
|
||||||
await writeFile(dest, content);
|
await writeFile(dest, content);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
console.info("Unpacked Extension written to dist/browser/" + target);
|
console.info("Unpacked Extension written to dist/" + target);
|
||||||
}
|
}
|
||||||
|
|
||||||
const appendCssRuntime = readFile("dist/Vencord.user.css", "utf-8").then(content => {
|
const appendCssRuntime = readFile("dist/Vencord.user.css", "utf-8").then(content => {
|
||||||
|
@ -195,14 +205,12 @@ if (!process.argv.includes("--skip-extension")) {
|
||||||
buildExtension("firefox-unpacked", ["background.js", "content.js", "manifestv2.json", "icon.png"]),
|
buildExtension("firefox-unpacked", ["background.js", "content.js", "manifestv2.json", "icon.png"]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Zip.zip("dist/browser/chromium-unpacked", (_err, zip) => {
|
Zip.sync.zip("dist/chromium-unpacked").compress().save("dist/extension-chrome.zip");
|
||||||
zip.compress().save("dist/extension-chrome.zip");
|
|
||||||
console.info("Packed Chromium Extension written to dist/extension-chrome.zip");
|
console.info("Packed Chromium Extension written to dist/extension-chrome.zip");
|
||||||
});
|
|
||||||
Zip.zip("dist/browser/firefox-unpacked", (_err, zip) => {
|
Zip.sync.zip("dist/firefox-unpacked").compress().save("dist/extension-firefox.zip");
|
||||||
zip.compress().save("dist/extension-firefox.zip");
|
|
||||||
console.info("Packed Firefox Extension written to dist/extension-firefox.zip");
|
console.info("Packed Firefox Extension written to dist/extension-firefox.zip");
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
await appendCssRuntime;
|
await appendCssRuntime;
|
||||||
}
|
}
|
|
@ -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 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";
|
||||||
|
@ -28,8 +28,10 @@ import { join, relative } from "path";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
|
|
||||||
import { getPluginTarget } from "../utils.mjs";
|
import { getPluginTarget } from "../utils.mjs";
|
||||||
|
import { builtinModules } from "module";
|
||||||
|
|
||||||
const PackageJSON: typeof import("../../package.json") = JSON.parse(readFileSync("package.json", "utf-8"));
|
/** @type {import("../../package.json")} */
|
||||||
|
const PackageJSON = JSON.parse(readFileSync("package.json"));
|
||||||
|
|
||||||
export const VERSION = PackageJSON.version;
|
export const VERSION = PackageJSON.version;
|
||||||
// https://reproducible-builds.org/docs/source-date-epoch/
|
// https://reproducible-builds.org/docs/source-date-epoch/
|
||||||
|
@ -53,8 +55,11 @@ export const banner = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const PluginDefinitionNameMatcher = /definePlugin\(\{\s*(["'])?name\1:\s*(["'`])(.+?)\2/;
|
const PluginDefinitionNameMatcher = /definePlugin\(\{\s*(["'])?name\1:\s*(["'`])(.+?)\2/;
|
||||||
|
/**
|
||||||
export async function resolvePluginName(base: string, dirent: import("fs").Dirent) {
|
* @param {string} base
|
||||||
|
* @param {import("fs").Dirent} dirent
|
||||||
|
*/
|
||||||
|
export async function resolvePluginName(base, dirent) {
|
||||||
const fullPath = join(base, dirent.name);
|
const fullPath = join(base, dirent.name);
|
||||||
const content = dirent.isFile()
|
const content = dirent.isFile()
|
||||||
? await readFile(fullPath, "utf-8")
|
? await readFile(fullPath, "utf-8")
|
||||||
|
@ -75,13 +80,28 @@ export async function resolvePluginName(base: string, dirent: import("fs").Diren
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function exists(path: string) {
|
export async function exists(path) {
|
||||||
return await access(path, FsConstants.F_OK)
|
return await access(path, FsConstants.F_OK)
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const globPlugins: (kind: "web" | "discordDesktop" | "vencordDesktop") => Plugin = kind => ({
|
// https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
|
||||||
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const makeAllPackagesExternalPlugin = {
|
||||||
|
name: "make-all-packages-external",
|
||||||
|
setup(build) {
|
||||||
|
const filter = /^[^./]|^\.[^./]|^\.\.[^/]/; // Must not start with "/" or "./" or "../"
|
||||||
|
build.onResolve({ filter }, args => ({ path: args.path, external: true }));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {(kind: "web" | "discordDesktop" | "vencordDesktop") => import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const globPlugins = kind => ({
|
||||||
name: "glob-plugins",
|
name: "glob-plugins",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^~plugins$/;
|
const filter = /^~plugins$/;
|
||||||
|
@ -145,7 +165,10 @@ export const globPlugins: (kind: "web" | "discordDesktop" | "vencordDesktop") =>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const gitHashPlugin: Plugin = {
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const gitHashPlugin = {
|
||||||
name: "git-hash-plugin",
|
name: "git-hash-plugin",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^~git-hash$/;
|
const filter = /^~git-hash$/;
|
||||||
|
@ -158,7 +181,10 @@ export const gitHashPlugin: Plugin = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const gitRemotePlugin: Plugin = {
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const gitRemotePlugin = {
|
||||||
name: "git-remote-plugin",
|
name: "git-remote-plugin",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^~git-remote$/;
|
const filter = /^~git-remote$/;
|
||||||
|
@ -180,7 +206,10 @@ export const gitRemotePlugin: Plugin = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fileUrlPlugin: Plugin = {
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const fileUrlPlugin = {
|
||||||
name: "file-uri-plugin",
|
name: "file-uri-plugin",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^file:\/\/.+$/;
|
const filter = /^file:\/\/.+$/;
|
||||||
|
@ -200,7 +229,7 @@ export const fileUrlPlugin: Plugin = {
|
||||||
|
|
||||||
const encoding = base64 ? "base64" : "utf-8";
|
const encoding = base64 ? "base64" : "utf-8";
|
||||||
|
|
||||||
let content: string;
|
let content;
|
||||||
if (!minify) {
|
if (!minify) {
|
||||||
content = await readFile(path, encoding);
|
content = await readFile(path, encoding);
|
||||||
if (!noTrim) content = content.trimEnd();
|
if (!noTrim) content = content.trimEnd();
|
||||||
|
@ -240,7 +269,10 @@ export const fileUrlPlugin: Plugin = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const styleModule = readFileSync("./scripts/build/module/style.js", "utf-8");
|
const styleModule = readFileSync("./scripts/build/module/style.js", "utf-8");
|
||||||
export const stylePlugin: Plugin = {
|
/**
|
||||||
|
* @type {import("esbuild").Plugin}
|
||||||
|
*/
|
||||||
|
export const stylePlugin = {
|
||||||
name: "style-plugin",
|
name: "style-plugin",
|
||||||
setup: ({ onResolve, onLoad }) => {
|
setup: ({ onResolve, onLoad }) => {
|
||||||
onResolve({ filter: /\.css\?managed$/, namespace: "file" }, ({ path, resolveDir }) => ({
|
onResolve({ filter: /\.css\?managed$/, namespace: "file" }, ({ path, resolveDir }) => ({
|
||||||
|
@ -261,59 +293,47 @@ export const stylePlugin: Plugin = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let buildsFinished = Promise.resolve();
|
/**
|
||||||
const buildsFinishedPlugin: Plugin = {
|
* @type {(filter: RegExp, message: string) => import("esbuild").Plugin}
|
||||||
name: "builds-finished-plugin",
|
*/
|
||||||
setup({ onEnd }) {
|
export const banImportPlugin = (filter, message) => ({
|
||||||
if (!watch) return;
|
name: "ban-imports",
|
||||||
|
setup: build => {
|
||||||
let resolve: () => void;
|
build.onResolve({ filter }, () => {
|
||||||
const done = new Promise<void>(r => resolve = r);
|
return { errors: [{ text: message }] };
|
||||||
buildsFinished = buildsFinished.then(() => done);
|
});
|
||||||
|
}
|
||||||
onEnd(() => resolve());
|
});
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("esbuild").BuildOptions}
|
||||||
|
*/
|
||||||
export const commonOpts = {
|
export const commonOpts = {
|
||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
bundle: true,
|
bundle: true,
|
||||||
|
watch,
|
||||||
minify: !watch,
|
minify: !watch,
|
||||||
sourcemap: watch ? "inline" : "external",
|
sourcemap: watch ? "inline" : "",
|
||||||
legalComments: "linked",
|
legalComments: "linked",
|
||||||
banner,
|
banner,
|
||||||
plugins: [fileUrlPlugin, gitHashPlugin, gitRemotePlugin, stylePlugin, buildsFinishedPlugin],
|
plugins: [fileUrlPlugin, gitHashPlugin, gitRemotePlugin, stylePlugin],
|
||||||
external: ["~plugins", "~git-hash", "~git-remote", "/assets/*"],
|
external: ["~plugins", "~git-hash", "~git-remote", "/assets/*"],
|
||||||
inject: ["./scripts/build/inject/react.mjs"],
|
inject: ["./scripts/build/inject/react.mjs"],
|
||||||
jsxFactory: "VencordCreateElement",
|
jsxFactory: "VencordCreateElement",
|
||||||
jsxFragment: "VencordFragment",
|
jsxFragment: "VencordFragment",
|
||||||
jsx: "transform"
|
// Work around https://github.com/evanw/esbuild/issues/2460
|
||||||
} satisfies BuildOptions;
|
tsconfig: "./scripts/build/tsconfig.esbuild.json"
|
||||||
|
};
|
||||||
|
|
||||||
|
const escapedBuiltinModules = builtinModules
|
||||||
|
.map(m => m.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"))
|
||||||
|
.join("|");
|
||||||
|
const builtinModuleRegex = new RegExp(`^(node:)?(${escapedBuiltinModules})$`);
|
||||||
|
|
||||||
const builds = [] as BuildOptions[];
|
export const commonRendererPlugins = [
|
||||||
export function addBuild(options: BuildOptions) {
|
banImportPlugin(builtinModuleRegex, "Cannot import node inbuilt modules in browser code. You need to use a native.ts file"),
|
||||||
builds.push(options);
|
banImportPlugin(/^react$/, "Cannot import from react. React and hooks should be imported from @webpack/common"),
|
||||||
}
|
banImportPlugin(/^electron(\/.*)?$/, "Cannot import electron in browser code. You need to use a native.ts file"),
|
||||||
|
banImportPlugin(/^ts-pattern$/, "Cannot import from ts-pattern. match and P should be imported from @webpack/common"),
|
||||||
export async function buildOrWatchAll() {
|
...commonOpts.plugins
|
||||||
if (watch) {
|
];
|
||||||
const contexts = await Promise.all(builds.map(context));
|
|
||||||
await Promise.all(contexts.map(ctx => ctx.watch()));
|
|
||||||
|
|
||||||
await buildsFinished;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
await Promise.all(builds.map(build));
|
|
||||||
} catch (err) {
|
|
||||||
const reason = err instanceof Error
|
|
||||||
? err.message
|
|
||||||
: err;
|
|
||||||
|
|
||||||
console.error("Build failed");
|
|
||||||
console.error(reason);
|
|
||||||
// make ci fail
|
|
||||||
process.exitCode = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
7
scripts/build/tsconfig.esbuild.json
Normal file
7
scripts/build/tsconfig.esbuild.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Work around https://github.com/evanw/esbuild/issues/2460
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "react"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,6 @@ try {
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
VENCORD_USER_DATA_DIR: BASE_DIR,
|
VENCORD_USER_DATA_DIR: BASE_DIR,
|
||||||
VENCORD_DIRECTORY: join(BASE_DIR, "dist/desktop"),
|
|
||||||
VENCORD_DEV_INSTALL: "1"
|
VENCORD_DEV_INSTALL: "1"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,11 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function getPluginTarget(filePath: string) {
|
/**
|
||||||
|
* @param {string} filePath
|
||||||
|
* @returns {string | null}
|
||||||
|
*/
|
||||||
|
export function getPluginTarget(filePath) {
|
||||||
const pathParts = filePath.split(/[/\\]/);
|
const pathParts = filePath.split(/[/\\]/);
|
||||||
if (/^index\.tsx?$/.test(pathParts.at(-1)!)) pathParts.pop();
|
if (/^index\.tsx?$/.test(pathParts.at(-1))) pathParts.pop();
|
||||||
|
|
||||||
const identifier = pathParts.at(-1)!.replace(/\.tsx?$/, "");
|
const identifier = pathParts.at(-1).replace(/\.tsx?$/, "");
|
||||||
const identiferBits = identifier.split(".");
|
const identiferBits = identifier.split(".");
|
||||||
return identiferBits.length === 1 ? null : identiferBits.at(-1);
|
return identiferBits.length === 1 ? null : identiferBits.at(-1);
|
||||||
}
|
}
|
2
setup-origins.sh
Executable file
2
setup-origins.sh
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
git remote add upstream https://github.com/Vendicated/Vencord.git
|
||||||
|
git remote set-url --pull upstream DISABLED
|
|
@ -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 { Logger } from "@utils/Logger";
|
||||||
import { makeCodeblock } from "@utils/text";
|
import { makeCodeblock } from "@utils/text";
|
||||||
|
|
||||||
import { sendBotMessage } from "./commandHelpers";
|
import { sendBotMessage } from "./commandHelpers";
|
||||||
|
@ -46,10 +47,10 @@ export let RequiredMessageOption: Option = ReqPlaceholder;
|
||||||
export const _init = function (cmds: Command[]) {
|
export const _init = function (cmds: Command[]) {
|
||||||
try {
|
try {
|
||||||
BUILT_IN = cmds;
|
BUILT_IN = cmds;
|
||||||
OptionalMessageOption = cmds.find(c => c.name === "shrug")!.options![0];
|
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
|
||||||
RequiredMessageOption = cmds.find(c => c.name === "me")!.options![0];
|
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to load CommandsApi");
|
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
|
||||||
}
|
}
|
||||||
return cmds;
|
return cmds;
|
||||||
} as never;
|
} as never;
|
||||||
|
@ -138,6 +139,8 @@ export function registerCommand<C extends Command>(command: C, plugin: string) {
|
||||||
throw new Error(`Command '${command.name}' already exists.`);
|
throw new Error(`Command '${command.name}' already exists.`);
|
||||||
|
|
||||||
command.isVencordCommand = true;
|
command.isVencordCommand = true;
|
||||||
|
command.untranslatedName ??= command.name;
|
||||||
|
command.untranslatedDescription ??= command.description;
|
||||||
command.id ??= `-${BUILT_IN.length + 1}`;
|
command.id ??= `-${BUILT_IN.length + 1}`;
|
||||||
command.applicationId ??= "-1"; // BUILT_IN;
|
command.applicationId ??= "-1"; // BUILT_IN;
|
||||||
command.type ??= ApplicationCommandType.CHAT_INPUT;
|
command.type ??= ApplicationCommandType.CHAT_INPUT;
|
||||||
|
|
|
@ -93,8 +93,10 @@ export interface Command {
|
||||||
isVencordCommand?: boolean;
|
isVencordCommand?: boolean;
|
||||||
|
|
||||||
name: string;
|
name: string;
|
||||||
|
untranslatedName?: string;
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
untranslatedDescription?: string;
|
||||||
displayDescription?: string;
|
displayDescription?: string;
|
||||||
|
|
||||||
options?: Option[];
|
options?: Option[];
|
||||||
|
|
|
@ -90,19 +90,20 @@ export function removeGlobalContextMenuPatch(patch: GlobalContextMenuPatchCallba
|
||||||
* A helper function for finding the children array of a group nested inside a context menu based on the id(s) of its children
|
* A helper function for finding the children array of a group nested inside a context menu based on the id(s) of its children
|
||||||
* @param id The id of the child. If an array is specified, all ids will be tried
|
* @param id The id of the child. If an array is specified, all ids will be tried
|
||||||
* @param children The context menu children
|
* @param children The context menu children
|
||||||
|
* @param matchSubstring Whether to check if the id is a substring of the child id
|
||||||
*/
|
*/
|
||||||
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null>): Array<ReactElement | null> | null {
|
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null | undefined>, matchSubstring = false): Array<ReactElement | null | undefined> | null {
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
if (child == null) continue;
|
if (child == null) continue;
|
||||||
|
|
||||||
if (Array.isArray(child)) {
|
if (Array.isArray(child)) {
|
||||||
const found = findGroupChildrenByChildId(id, child);
|
const found = findGroupChildrenByChildId(id, child, matchSubstring);
|
||||||
if (found !== null) return found;
|
if (found !== null) return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(Array.isArray(id) && id.some(id => child.props?.id === id))
|
(Array.isArray(id) && id.some(id => matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id))
|
||||||
|| child.props?.id === id
|
|| (matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id)
|
||||||
) return children;
|
) return children;
|
||||||
|
|
||||||
let nextChildren = child.props?.children;
|
let nextChildren = child.props?.children;
|
||||||
|
@ -112,7 +113,7 @@ export function findGroupChildrenByChildId(id: string | string[], children: Arra
|
||||||
child.props.children = nextChildren;
|
child.props.children = nextChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
const found = findGroupChildrenByChildId(id, nextChildren);
|
const found = findGroupChildrenByChildId(id, nextChildren, matchSubstring);
|
||||||
if (found !== null) return found;
|
if (found !== null) return found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,17 @@
|
||||||
* 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 ErrorBoundary from "@components/ErrorBoundary";
|
||||||
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 } 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>,
|
||||||
|
@ -48,22 +49,26 @@ export function removeButton(identifier: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _buildPopoverElements(
|
export function _buildPopoverElements(
|
||||||
msg: Message,
|
Component: React.ComponentType<ButtonItem>,
|
||||||
makeButton: (item: ButtonItem) => React.ComponentType
|
message: Message
|
||||||
) {
|
) {
|
||||||
const items = [] as React.ComponentType[];
|
const items: React.ReactNode[] = [];
|
||||||
|
|
||||||
for (const [identifier, getItem] of buttons.entries()) {
|
for (const [identifier, getItem] of buttons.entries()) {
|
||||||
try {
|
try {
|
||||||
const item = getItem(msg);
|
const item = getItem(message);
|
||||||
if (item) {
|
if (item) {
|
||||||
item.key ??= identifier;
|
item.key ??= identifier;
|
||||||
items.push(makeButton(item));
|
items.push(
|
||||||
|
<ErrorBoundary noop>
|
||||||
|
<Component {...item} />
|
||||||
|
</ErrorBoundary>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`[${identifier}]`, err);
|
logger.error(`[${identifier}]`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return <>{items}</>;
|
||||||
}
|
}
|
|
@ -230,6 +230,10 @@ export function definePluginSettings<
|
||||||
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
return Settings.plugins[definedSettings.pluginName] as any;
|
return Settings.plugins[definedSettings.pluginName] as any;
|
||||||
},
|
},
|
||||||
|
get plain() {
|
||||||
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
|
return PlainSettings.plugins[definedSettings.pluginName] as any;
|
||||||
|
},
|
||||||
use: settings => useSettings(
|
use: settings => useSettings(
|
||||||
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
||||||
).plugins[definedSettings.pluginName] as any,
|
).plugins[definedSettings.pluginName] as any,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
.vc-expandableheader-center-flex {
|
.vc-expandableheader-center-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-items: center;
|
place-items: center;
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-expandableheader-btn {
|
.vc-expandableheader-btn {
|
||||||
|
|
|
@ -18,9 +18,8 @@
|
||||||
|
|
||||||
import "./iconStyles.css";
|
import "./iconStyles.css";
|
||||||
|
|
||||||
import { getTheme, Theme } from "@utils/discord";
|
import { getIntlMessage, getTheme, Theme } from "@utils/discord";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import { i18n } from "@webpack/common";
|
|
||||||
import type { PropsWithChildren } from "react";
|
import type { PropsWithChildren } from "react";
|
||||||
|
|
||||||
interface BaseIconProps extends IconProps {
|
interface BaseIconProps extends IconProps {
|
||||||
|
@ -65,8 +64,7 @@ export function LinkIcon({ height = 24, width = 24, className }: IconProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discord's copy icon, as seen in the user popout right of the username when clicking
|
* Discord's copy icon, as seen in the user panel popout on the right of the username and in large code blocks
|
||||||
* your own username in the bottom left user panel
|
|
||||||
*/
|
*/
|
||||||
export function CopyIcon(props: IconProps) {
|
export function CopyIcon(props: IconProps) {
|
||||||
return (
|
return (
|
||||||
|
@ -76,8 +74,9 @@ export function CopyIcon(props: IconProps) {
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
>
|
>
|
||||||
<g fill="currentColor">
|
<g fill="currentColor">
|
||||||
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1z" />
|
<path d="M3 16a1 1 0 0 1-1-1v-5a8 8 0 0 1 8-8h5a1 1 0 0 1 1 1v.5a.5.5 0 0 1-.5.5H10a6 6 0 0 0-6 6v5.5a.5.5 0 0 1-.5.5H3Z" />
|
||||||
<path d="M15 5H8c-1.1 0-1.99.9-1.99 2L6 21c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V11l-6-6zM8 21V7h6v5h5v9H8z" />
|
<path d="M6 18a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4v-4h-3a5 5 0 0 1-5-5V6h-4a4 4 0 0 0-4 4v8Z" />
|
||||||
|
<path d="M21.73 12a3 3 0 0 0-.6-.88l-4.25-4.24a3 3 0 0 0-.88-.61V9a3 3 0 0 0 3 3h2.73Z" />
|
||||||
</g>
|
</g>
|
||||||
</Icon>
|
</Icon>
|
||||||
);
|
);
|
||||||
|
@ -133,7 +132,7 @@ export function InfoIcon(props: IconProps) {
|
||||||
export function OwnerCrownIcon(props: IconProps) {
|
export function OwnerCrownIcon(props: IconProps) {
|
||||||
return (
|
return (
|
||||||
<Icon
|
<Icon
|
||||||
aria-label={i18n.Messages.GUILD_OWNER}
|
aria-label={getIntlMessage("GUILD_OWNER")}
|
||||||
{...props}
|
{...props}
|
||||||
className={classes(props.className, "vc-owner-crown-icon")}
|
className={classes(props.className, "vc-owner-crown-icon")}
|
||||||
role="img"
|
role="img"
|
||||||
|
|
|
@ -16,6 +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 { Margins } from "@utils/margins";
|
||||||
|
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||||
import { OptionType, PluginOptionNumber } from "@utils/types";
|
import { OptionType, PluginOptionNumber } from "@utils/types";
|
||||||
import { Forms, React, TextInput } from "@webpack/common";
|
import { Forms, React, TextInput } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -54,7 +56,8 @@ export function SettingNumericComponent({ option, pluginSettings, definedSetting
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection>
|
<Forms.FormSection>
|
||||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||||
|
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||||
<TextInput
|
<TextInput
|
||||||
type="number"
|
type="number"
|
||||||
pattern="-?[0-9]+"
|
pattern="-?[0-9]+"
|
||||||
|
|
|
@ -16,6 +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 { Margins } from "@utils/margins";
|
||||||
|
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||||
import { PluginOptionSelect } from "@utils/types";
|
import { PluginOptionSelect } from "@utils/types";
|
||||||
import { Forms, React, Select } from "@webpack/common";
|
import { Forms, React, Select } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -44,7 +46,8 @@ export function SettingSelectComponent({ option, pluginSettings, definedSettings
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection>
|
<Forms.FormSection>
|
||||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||||
|
<Forms.FormText className={Margins.bottom16} type="description">{option.description}</Forms.FormText>
|
||||||
<Select
|
<Select
|
||||||
isDisabled={option.disabled?.call(definedSettings) ?? false}
|
isDisabled={option.disabled?.call(definedSettings) ?? false}
|
||||||
options={option.options}
|
options={option.options}
|
||||||
|
|
|
@ -16,6 +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 { Margins } from "@utils/margins";
|
||||||
|
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||||
import { PluginOptionSlider } from "@utils/types";
|
import { PluginOptionSlider } from "@utils/types";
|
||||||
import { Forms, React, Slider } from "@webpack/common";
|
import { Forms, React, Slider } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -50,7 +52,8 @@ export function SettingSliderComponent({ option, pluginSettings, definedSettings
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection>
|
<Forms.FormSection>
|
||||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||||
|
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||||
<Slider
|
<Slider
|
||||||
disabled={option.disabled?.call(definedSettings) ?? false}
|
disabled={option.disabled?.call(definedSettings) ?? false}
|
||||||
markers={option.markers}
|
markers={option.markers}
|
||||||
|
|
|
@ -16,6 +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 { Margins } from "@utils/margins";
|
||||||
|
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||||
import { PluginOptionString } from "@utils/types";
|
import { PluginOptionString } from "@utils/types";
|
||||||
import { Forms, React, TextInput } from "@webpack/common";
|
import { Forms, React, TextInput } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -41,7 +43,8 @@ export function SettingTextComponent({ option, pluginSettings, definedSettings,
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection>
|
<Forms.FormSection>
|
||||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||||
|
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||||
<TextInput
|
<TextInput
|
||||||
type="text"
|
type="text"
|
||||||
value={state}
|
value={state}
|
||||||
|
|
|
@ -93,7 +93,7 @@ interface PluginCardProps extends React.HTMLProps<HTMLDivElement> {
|
||||||
export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
|
export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
|
||||||
const settings = Settings.plugins[plugin.name];
|
const settings = Settings.plugins[plugin.name];
|
||||||
|
|
||||||
const isEnabled = () => settings.enabled ?? false;
|
const isEnabled = () => Vencord.Plugins.isPluginEnabled(plugin.name);
|
||||||
|
|
||||||
function toggleEnabled() {
|
function toggleEnabled() {
|
||||||
const wasEnabled = isEnabled();
|
const wasEnabled = isEnabled();
|
||||||
|
@ -292,10 +292,10 @@ export default function PluginSettings() {
|
||||||
|
|
||||||
if (!pluginFilter(p)) continue;
|
if (!pluginFilter(p)) continue;
|
||||||
|
|
||||||
const isRequired = p.required || depMap[p.name]?.some(d => settings.plugins[d].enabled);
|
const isRequired = p.required || p.isDependency || depMap[p.name]?.some(d => settings.plugins[d].enabled);
|
||||||
|
|
||||||
if (isRequired) {
|
if (isRequired) {
|
||||||
const tooltipText = p.required
|
const tooltipText = p.required || !depMap[p.name]
|
||||||
? "This plugin is required for Vencord to function."
|
? "This plugin is required for Vencord to function."
|
||||||
: makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled));
|
: makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled));
|
||||||
|
|
||||||
|
|
|
@ -382,6 +382,7 @@ function PatchHelper() {
|
||||||
<Forms.FormTitle className={Margins.top20}>Code</Forms.FormTitle>
|
<Forms.FormTitle className={Margins.top20}>Code</Forms.FormTitle>
|
||||||
<CodeBlock lang="js" content={code} />
|
<CodeBlock lang="js" content={code} />
|
||||||
<Button onClick={() => Clipboard.copy(code)}>Copy to Clipboard</Button>
|
<Button onClick={() => Clipboard.copy(code)}>Copy to Clipboard</Button>
|
||||||
|
<Button className={Margins.top8} onClick={() => Clipboard.copy("```ts\n" + code + "\n```")}>Copy as Codeblock</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</SettingsTab>
|
</SettingsTab>
|
||||||
|
|
|
@ -25,10 +25,9 @@ import { openPluginModal } from "@components/PluginSettings/PluginModal";
|
||||||
import type { UserThemeHeader } from "@main/themes";
|
import type { UserThemeHeader } from "@main/themes";
|
||||||
import { openInviteModal } from "@utils/discord";
|
import { openInviteModal } from "@utils/discord";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
|
||||||
import { showItemInFolder } from "@utils/native";
|
import { showItemInFolder } from "@utils/native";
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import { findByPropsLazy, findLazy } from "@webpack";
|
import { findLazy } from "@webpack";
|
||||||
import { Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
import { Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
||||||
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
||||||
|
|
||||||
|
@ -45,9 +44,7 @@ type FileInput = ComponentType<{
|
||||||
filters?: { name?: string; extensions: string[]; }[];
|
filters?: { name?: string; extensions: string[]; }[];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
const InviteActions = findByPropsLazy("resolveInvite");
|
|
||||||
const FileInput: FileInput = findLazy(m => m.prototype?.activateUploadDialogue && m.prototype.setRef);
|
const FileInput: FileInput = findLazy(m => m.prototype?.activateUploadDialogue && m.prototype.setRef);
|
||||||
const TextAreaProps = findLazy(m => typeof m.textarea === "string");
|
|
||||||
|
|
||||||
const cl = classNameFactory("vc-settings-theme-");
|
const cl = classNameFactory("vc-settings-theme-");
|
||||||
|
|
||||||
|
@ -80,8 +77,16 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) {
|
||||||
<Forms.FormTitle className={Margins.top20} tag="h5">Validator</Forms.FormTitle>
|
<Forms.FormTitle className={Margins.top20} tag="h5">Validator</Forms.FormTitle>
|
||||||
<Forms.FormText>This section will tell you whether your themes can successfully be loaded</Forms.FormText>
|
<Forms.FormText>This section will tell you whether your themes can successfully be loaded</Forms.FormText>
|
||||||
<div>
|
<div>
|
||||||
{themeLinks.map(link => (
|
{themeLinks.map(rawLink => {
|
||||||
<Card style={{
|
const { label, link } = (() => {
|
||||||
|
const match = /^@(light|dark) (.*)/.exec(rawLink);
|
||||||
|
if (!match) return { label: rawLink, link: rawLink };
|
||||||
|
|
||||||
|
const [, mode, link] = match;
|
||||||
|
return { label: `[${mode} mode only] ${link}`, link };
|
||||||
|
})();
|
||||||
|
|
||||||
|
return <Card style={{
|
||||||
padding: ".5em",
|
padding: ".5em",
|
||||||
marginBottom: ".5em",
|
marginBottom: ".5em",
|
||||||
marginTop: ".5em"
|
marginTop: ".5em"
|
||||||
|
@ -89,11 +94,11 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) {
|
||||||
<Forms.FormTitle tag="h5" style={{
|
<Forms.FormTitle tag="h5" style={{
|
||||||
overflowWrap: "break-word"
|
overflowWrap: "break-word"
|
||||||
}}>
|
}}>
|
||||||
{link}
|
{label}
|
||||||
</Forms.FormTitle>
|
</Forms.FormTitle>
|
||||||
<Validator link={link} />
|
<Validator link={link} />
|
||||||
</Card>
|
</Card>;
|
||||||
))}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -299,6 +304,7 @@ function ThemesTab() {
|
||||||
<Card className="vc-settings-card vc-text-selectable">
|
<Card className="vc-settings-card vc-text-selectable">
|
||||||
<Forms.FormTitle tag="h5">Paste links to css files here</Forms.FormTitle>
|
<Forms.FormTitle tag="h5">Paste links to css files here</Forms.FormTitle>
|
||||||
<Forms.FormText>One link per line</Forms.FormText>
|
<Forms.FormText>One link per line</Forms.FormText>
|
||||||
|
<Forms.FormText>You can prefix lines with @light or @dark to toggle them based on your Discord theme</Forms.FormText>
|
||||||
<Forms.FormText>Make sure to use direct links to files (raw or github.io)!</Forms.FormText>
|
<Forms.FormText>Make sure to use direct links to files (raw or github.io)!</Forms.FormText>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
@ -306,7 +312,7 @@ function ThemesTab() {
|
||||||
<TextArea
|
<TextArea
|
||||||
value={themeText}
|
value={themeText}
|
||||||
onChange={setThemeText}
|
onChange={setThemeText}
|
||||||
className={classes(TextAreaProps.textarea, "vc-settings-theme-links")}
|
className={"vc-settings-theme-links"}
|
||||||
placeholder="Theme Links"
|
placeholder="Theme Links"
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
|
|
|
@ -33,6 +33,20 @@
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
border: 1px solid var(--background-modifier-accent);
|
border: 1px solid var(--background-modifier-accent);
|
||||||
max-height: unset;
|
max-height: unset;
|
||||||
|
background-color: transparent;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 14px;
|
||||||
|
resize: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-settings-theme-links::placeholder {
|
||||||
|
color: var(--header-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-settings-theme-links:focus {
|
||||||
|
background-color: var(--background-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-cloud-settings-sync-grid {
|
.vc-cloud-settings-sync-grid {
|
||||||
|
|
|
@ -15,9 +15,9 @@ export async function loadLazyChunks() {
|
||||||
try {
|
try {
|
||||||
LazyChunkLoaderLogger.log("Loading all chunks...");
|
LazyChunkLoaderLogger.log("Loading all chunks...");
|
||||||
|
|
||||||
const validChunks = new Set<string>();
|
const validChunks = new Set<number>();
|
||||||
const invalidChunks = new Set<string>();
|
const invalidChunks = new Set<number>();
|
||||||
const deferredRequires = new Set<string>();
|
const deferredRequires = new Set<number>();
|
||||||
|
|
||||||
let chunksSearchingResolve: (value: void | PromiseLike<void>) => void;
|
let chunksSearchingResolve: (value: void | PromiseLike<void>) => void;
|
||||||
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
|
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
|
||||||
|
@ -29,14 +29,12 @@ export async function loadLazyChunks() {
|
||||||
|
|
||||||
async function searchAndLoadLazyChunks(factoryCode: string) {
|
async function searchAndLoadLazyChunks(factoryCode: string) {
|
||||||
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
|
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
|
||||||
const validChunkGroups = new Set<[chunkIds: string[], entryPoint: string]>();
|
const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>();
|
||||||
|
|
||||||
// Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before
|
const shouldForceDefer = false;
|
||||||
// the chunk containing the component
|
|
||||||
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");
|
|
||||||
|
|
||||||
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
||||||
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => m[1]) : [];
|
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : [];
|
||||||
|
|
||||||
if (chunkIds.length === 0) {
|
if (chunkIds.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -61,7 +59,7 @@ export async function loadLazyChunks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!invalidChunkGroup) {
|
if (!invalidChunkGroup) {
|
||||||
validChunkGroups.add([chunkIds, entryPoint]);
|
validChunkGroups.add([chunkIds, Number(entryPoint)]);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -131,14 +129,14 @@ export async function loadLazyChunks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// All chunks Discord has mapped to asset files, even if they are not used anymore
|
// All chunks Discord has mapped to asset files, even if they are not used anymore
|
||||||
const allChunks = [] as string[];
|
const allChunks = [] as number[];
|
||||||
|
|
||||||
// Matches "id" or id:
|
// Matches "id" or id:
|
||||||
for (const currentMatch of wreq!.u.toString().matchAll(/(?:"(\d+?)")|(?:(\d+?):)/g)) {
|
for (const currentMatch of wreq!.u.toString().matchAll(/(?:"([\deE]+?)"(?![,}]))|(?:([\deE]+?):)/g)) {
|
||||||
const id = currentMatch[1] ?? currentMatch[2];
|
const id = currentMatch[1] ?? currentMatch[2];
|
||||||
if (id == null) continue;
|
if (id == null) continue;
|
||||||
|
|
||||||
allChunks.push(id);
|
allChunks.push(Number(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allChunks.length === 0) throw new Error("Failed to get all chunks");
|
if (allChunks.length === 0) throw new Error("Failed to get all chunks");
|
||||||
|
|
|
@ -43,9 +43,11 @@ if (IS_VESKTOP || !IS_VANILLA) {
|
||||||
}
|
}
|
||||||
switch (url) {
|
switch (url) {
|
||||||
case "renderer.js.map":
|
case "renderer.js.map":
|
||||||
|
case "vencordDesktopRenderer.js.map":
|
||||||
case "preload.js.map":
|
case "preload.js.map":
|
||||||
|
case "vencordDesktopPreload.js.map":
|
||||||
case "patcher.js.map":
|
case "patcher.js.map":
|
||||||
case "main.js.map":
|
case "vencordDesktopMain.js.map":
|
||||||
cb(join(__dirname, url));
|
cb(join(__dirname, url));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -131,7 +131,7 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
darkTheme: true,
|
darkTheme: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: join(__dirname, "preload.js"),
|
preload: join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
sandbox: false
|
sandbox: false
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { onceDefined } from "@shared/onceDefined";
|
import { onceDefined } from "@shared/onceDefined";
|
||||||
import electron, { app, BrowserWindowConstructorOptions, Menu } from "electron";
|
import electron, { app, BrowserWindowConstructorOptions, Menu, nativeTheme } from "electron";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
|
|
||||||
import { initIpc } from "./ipcMain";
|
import { initIpc } from "./ipcMain";
|
||||||
|
@ -26,14 +26,14 @@ import { IS_VANILLA } from "./utils/constants";
|
||||||
|
|
||||||
console.log("[Vencord] Starting up...");
|
console.log("[Vencord] Starting up...");
|
||||||
|
|
||||||
// FIXME: remove at some point
|
|
||||||
export const isLegacyNonAsarVencord = IS_STANDALONE && !__dirname.endsWith(".asar");
|
|
||||||
|
|
||||||
// Our injector file at app/index.js
|
// Our injector file at app/index.js
|
||||||
const injectorPath = require.main!.filename;
|
const injectorPath = require.main!.filename;
|
||||||
|
|
||||||
|
// special discord_arch_electron injection method
|
||||||
|
const asarName = require.main!.path.endsWith("app.asar") ? "_app.asar" : "app.asar";
|
||||||
|
|
||||||
// The original app.asar
|
// The original app.asar
|
||||||
const asarPath = join(dirname(injectorPath), "..", "_app.asar");
|
const asarPath = join(dirname(injectorPath), "..", asarName);
|
||||||
|
|
||||||
const discordPkg = require(join(asarPath, "package.json"));
|
const discordPkg = require(join(asarPath, "package.json"));
|
||||||
require.main!.filename = join(asarPath, discordPkg.main);
|
require.main!.filename = join(asarPath, discordPkg.main);
|
||||||
|
@ -41,7 +41,7 @@ require.main!.filename = join(asarPath, discordPkg.main);
|
||||||
// @ts-ignore Untyped method? Dies from cringe
|
// @ts-ignore Untyped method? Dies from cringe
|
||||||
app.setAppPath(asarPath);
|
app.setAppPath(asarPath);
|
||||||
|
|
||||||
if (!IS_VANILLA && !isLegacyNonAsarVencord) {
|
if (!IS_VANILLA) {
|
||||||
const settings = RendererSettings.store;
|
const settings = RendererSettings.store;
|
||||||
// Repatch after host updates on Windows
|
// Repatch after host updates on Windows
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
|
@ -71,7 +71,7 @@ if (!IS_VANILLA && !isLegacyNonAsarVencord) {
|
||||||
constructor(options: BrowserWindowConstructorOptions) {
|
constructor(options: BrowserWindowConstructorOptions) {
|
||||||
if (options?.webPreferences?.preload && options.title) {
|
if (options?.webPreferences?.preload && options.title) {
|
||||||
const original = options.webPreferences.preload;
|
const original = options.webPreferences.preload;
|
||||||
options.webPreferences.preload = join(__dirname, "preload.js");
|
options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js");
|
||||||
options.webPreferences.sandbox = false;
|
options.webPreferences.sandbox = false;
|
||||||
// work around discord unloading when in background
|
// work around discord unloading when in background
|
||||||
options.webPreferences.backgroundThrottling = false;
|
options.webPreferences.backgroundThrottling = false;
|
||||||
|
@ -100,6 +100,19 @@ if (!IS_VANILLA && !isLegacyNonAsarVencord) {
|
||||||
|
|
||||||
super(options);
|
super(options);
|
||||||
initIpc(this);
|
initIpc(this);
|
||||||
|
|
||||||
|
// Workaround for https://github.com/electron/electron/issues/43367. Vesktop also has its own workaround
|
||||||
|
// @TODO: Remove this when the issue is fixed
|
||||||
|
if (IS_DISCORD_DESKTOP) {
|
||||||
|
this.webContents.on("devtools-opened", () => {
|
||||||
|
if (!nativeTheme.shouldUseDarkColors) return;
|
||||||
|
|
||||||
|
nativeTheme.themeSource = "light";
|
||||||
|
setTimeout(() => {
|
||||||
|
nativeTheme.themeSource = "dark";
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else super(options);
|
} else super(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +170,5 @@ if (!IS_VANILLA && !isLegacyNonAsarVencord) {
|
||||||
console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
|
console.log("[Vencord] Running in vanilla mode. Not loading Vencord");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLegacyNonAsarVencord) {
|
console.log("[Vencord] Loading original Discord app.asar");
|
||||||
console.log("[Vencord] Loading original Discord app.asar");
|
require(require.main!.filename);
|
||||||
require(require.main!.filename);
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,9 +16,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const ASAR_FILE = IS_VESKTOP
|
export const VENCORD_FILES = [
|
||||||
? "vesktop.asar"
|
IS_DISCORD_DESKTOP ? "patcher.js" : "vencordDesktopMain.js",
|
||||||
: "desktop.asar";
|
IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js",
|
||||||
|
IS_DISCORD_DESKTOP ? "renderer.js" : "vencordDesktopRenderer.js",
|
||||||
|
IS_DISCORD_DESKTOP ? "renderer.css" : "vencordDesktopRenderer.css",
|
||||||
|
];
|
||||||
|
|
||||||
export function serializeErrors(func: (...args: any[]) => any) {
|
export function serializeErrors(func: (...args: any[]) => any) {
|
||||||
return async function () {
|
return async function () {
|
||||||
|
|
|
@ -16,27 +16,20 @@
|
||||||
* 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 { isLegacyNonAsarVencord } from "@main/patcher";
|
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 { ipcMain } from "electron";
|
||||||
import {
|
import { writeFile } from "fs/promises";
|
||||||
existsSync as originalExistsSync,
|
|
||||||
renameSync as originalRenameSync,
|
|
||||||
writeFileSync as originalWriteFileSync,
|
|
||||||
} from "original-fs";
|
|
||||||
import { join } from "path";
|
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 { serializeErrors, VENCORD_FILES } 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}`;
|
||||||
let PendingUpdate: string | null = null;
|
let PendingUpdates = [] as [string, string][];
|
||||||
|
|
||||||
let hasUpdateToApplyOnQuit = false;
|
|
||||||
|
|
||||||
async function githubGet(endpoint: string) {
|
async function githubGet(endpoint: string) {
|
||||||
return get(API_BASE + endpoint, {
|
return get(API_BASE + endpoint, {
|
||||||
|
@ -72,22 +65,22 @@ async function fetchUpdates() {
|
||||||
if (hash === gitHash)
|
if (hash === gitHash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
data.assets.forEach(({ name, browser_download_url }) => {
|
||||||
const asset = data.assets.find(a => a.name === ASAR_FILE);
|
if (VENCORD_FILES.some(s => name.startsWith(s))) {
|
||||||
PendingUpdate = asset.browser_download_url;
|
PendingUpdates.push([name, browser_download_url]);
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyUpdates() {
|
async function applyUpdates() {
|
||||||
if (!PendingUpdate) return true;
|
await Promise.all(PendingUpdates.map(
|
||||||
|
async ([name, data]) => writeFile(
|
||||||
const data = await get(PendingUpdate);
|
join(__dirname, name),
|
||||||
originalWriteFileSync(__dirname + ".new", data);
|
await get(data)
|
||||||
hasUpdateToApplyOnQuit = true;
|
)
|
||||||
|
));
|
||||||
PendingUpdate = null;
|
PendingUpdates = [];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,51 +88,3 @@ ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${g
|
||||||
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
||||||
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
||||||
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
||||||
|
|
||||||
async function migrateLegacyToAsar() {
|
|
||||||
try {
|
|
||||||
const isFlatpak = process.platform === "linux" && !!process.env.FLATPAK_ID;
|
|
||||||
if (isFlatpak) throw "Flatpak Discord can't automatically be migrated.";
|
|
||||||
|
|
||||||
const data = await get(`https://github.com/${gitRemote}/releases/latest/download/desktop.asar`);
|
|
||||||
|
|
||||||
originalWriteFileSync(join(__dirname, "../vencord.asar"), data);
|
|
||||||
originalWriteFileSync(__filename, '// Legacy shim for new asar\n\nrequire("../vencord.asar");');
|
|
||||||
|
|
||||||
app.relaunch();
|
|
||||||
app.exit();
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Failed to migrate to asar", e);
|
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
|
||||||
dialog.showErrorBox(
|
|
||||||
"Legacy Install",
|
|
||||||
"The way Vencord loaded was changed and the updater failed to migrate. Please reinstall using the Vencord Installer!"
|
|
||||||
);
|
|
||||||
app.exit(1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyPreviousUpdate() {
|
|
||||||
originalRenameSync(__dirname + ".new", __dirname);
|
|
||||||
|
|
||||||
app.relaunch();
|
|
||||||
app.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
app.on("will-quit", () => {
|
|
||||||
if (hasUpdateToApplyOnQuit)
|
|
||||||
originalRenameSync(__dirname + ".new", __dirname);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isLegacyNonAsarVencord) {
|
|
||||||
console.warn("This is a legacy non asar install! Migrating to asar and restarting...");
|
|
||||||
migrateLegacyToAsar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originalExistsSync(__dirname + ".new")) {
|
|
||||||
console.warn("Found previous not applied update, applying now and restarting...");
|
|
||||||
applyPreviousUpdate();
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ export const ALLOWED_PROTOCOLS = [
|
||||||
"steam:",
|
"steam:",
|
||||||
"spotify:",
|
"spotify:",
|
||||||
"com.epicgames.launcher:",
|
"com.epicgames.launcher:",
|
||||||
"tidal:"
|
"tidal:",
|
||||||
|
"itunes:",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const IS_VANILLA = /* @__PURE__ */ process.argv.includes("--vanilla");
|
export const IS_VANILLA = /* @__PURE__ */ process.argv.includes("--vanilla");
|
||||||
|
|
1
src/modules.d.ts
vendored
1
src/modules.d.ts
vendored
|
@ -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" {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[class*="profileBadges"] {
|
|
||||||
flex: none;
|
|
||||||
}
|
|
|
@ -16,8 +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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "./fixBadgeOverflow.css";
|
|
||||||
|
|
||||||
import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
||||||
import DonateButton from "@components/DonateButton";
|
import DonateButton from "@components/DonateButton";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
@ -62,34 +60,6 @@ export default definePlugin({
|
||||||
authors: [Devs.Megu, Devs.Ven, Devs.TheSun],
|
authors: [Devs.Megu, Devs.Ven, Devs.TheSun],
|
||||||
required: true,
|
required: true,
|
||||||
patches: [
|
patches: [
|
||||||
/* Patch the badge list component on user profiles */
|
|
||||||
{
|
|
||||||
find: 'id:"premium",',
|
|
||||||
replacement: [
|
|
||||||
{
|
|
||||||
match: /&&(\i)\.push\(\{id:"premium".+?\}\);/,
|
|
||||||
replace: "$&$1.unshift(...$self.getBadges(arguments[0]));",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// alt: "", aria-hidden: false, src: originalSrc
|
|
||||||
match: /alt:" ","aria-hidden":!0,src:(?=(\i)\.src)/,
|
|
||||||
// ...badge.props, ..., src: badge.image ?? ...
|
|
||||||
replace: "...$1.props,$& $1.image??"
|
|
||||||
},
|
|
||||||
// replace their component with ours if applicable
|
|
||||||
{
|
|
||||||
match: /(?<=text:(\i)\.description,spacing:12,.{0,50})children:/,
|
|
||||||
replace: "children:$1.component ? () => $self.renderBadgeComponent($1) :"
|
|
||||||
},
|
|
||||||
// conditionally override their onClick with badge.onClick if it exists
|
|
||||||
{
|
|
||||||
match: /href:(\i)\.link/,
|
|
||||||
replace: "...($1.onClick && { onClick: vcE => $1.onClick(vcE, $1) }),$&"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
/* new profiles */
|
|
||||||
{
|
{
|
||||||
find: ".FULL_SIZE]:26",
|
find: ".FULL_SIZE]:26",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -107,7 +77,7 @@ export default definePlugin({
|
||||||
replace: "...$1.props,$& $1.image??"
|
replace: "...$1.props,$& $1.image??"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=text:(\i)\.description,.{0,50})children:/,
|
match: /(?<=text:(\i)\.description,.{0,200})children:/,
|
||||||
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
||||||
},
|
},
|
||||||
// conditionally override their onClick with badge.onClick if it exists
|
// conditionally override their onClick with badge.onClick if it exists
|
||||||
|
|
24
src/plugins/_api/dynamicImageModalApi.ts
Normal file
24
src/plugins/_api/dynamicImageModalApi.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "DynamicImageModalAPI",
|
||||||
|
authors: [Devs.sadan, Devs.Nuckyz],
|
||||||
|
description: "Allows you to omit either width or height when opening an image modal",
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "SCALE_DOWN:",
|
||||||
|
replacement: {
|
||||||
|
match: /!\(null==(\i)\|\|0===\i\|\|null==(\i)\|\|0===\i\)/,
|
||||||
|
replace: (_, width, height) => `!((null == ${width} || 0 === ${width}) && (null == ${height} || 0 === ${height}))`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
|
@ -31,7 +31,7 @@ export default definePlugin({
|
||||||
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
|
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
|
||||||
replace: "$&vencordProps=$1,"
|
replace: "$&vencordProps=$1,"
|
||||||
}, {
|
}, {
|
||||||
match: /\.Messages\.GUILD_OWNER(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
|
match: /#{intl::GUILD_OWNER}(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
|
||||||
replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps)),"
|
replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps)),"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default definePlugin({
|
||||||
authors: [Devs.Cyn],
|
authors: [Devs.Cyn],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".Messages.REMOVE_ATTACHMENT_BODY",
|
find: "#{intl::REMOVE_ATTACHMENT_BODY}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=.container\)?,children:)(\[.+?\])/,
|
match: /(?<=.container\)?,children:)(\[.+?\])/,
|
||||||
replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)",
|
replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)",
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: '"Message Username"',
|
find: '"Message Username"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.Messages\.GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE.+?}\),\i(?=\])/,
|
match: /#{intl::GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE}.+?}\),\i(?=\])/,
|
||||||
replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])"
|
replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default definePlugin({
|
||||||
authors: [Devs.Arjix, Devs.hunt, Devs.Ven],
|
authors: [Devs.Arjix, Devs.hunt, Devs.Ven],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".Messages.EDIT_TEXTAREA_HELP",
|
find: "#{intl::EDIT_TEXTAREA_HELP}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/,
|
match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/,
|
||||||
replace: (match, args) => "" +
|
replace: (match, args) => "" +
|
||||||
|
|
|
@ -24,15 +24,10 @@ export default definePlugin({
|
||||||
description: "API to add buttons to message popovers.",
|
description: "API to add buttons to message popovers.",
|
||||||
authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz],
|
authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz],
|
||||||
patches: [{
|
patches: [{
|
||||||
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
|
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
|
||||||
replacement: {
|
replacement: {
|
||||||
// foo && !bar ? createElement(reactionStuffs)... createElement(blah,...makeElement(reply-other))
|
match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#{intl::MESSAGE_ACTION_REPLY}.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/,
|
||||||
match: /\i&&!\i\?\(0,\i\.jsxs?\)\(.{0,200}renderEmojiPicker:.{0,500}\?(\i)\(\{key:"reply-other"/,
|
replace: "$&,Vencord.Api.MessagePopover._buildPopoverElements($1,$2)"
|
||||||
replace: (m, makeElement) => {
|
|
||||||
const msg = m.match(/message:(.{1,3}),/)?.[1];
|
|
||||||
if (!msg) throw new Error("Could not find message variable");
|
|
||||||
return `...Vencord.Api.MessagePopover._buildPopoverElements(${msg},${makeElement}),${m}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,16 +25,16 @@ export default definePlugin({
|
||||||
description: "Api required for plugins that modify the server list",
|
description: "Api required for plugins that modify the server list",
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "Messages.DISCODO_DISABLED",
|
find: "#{intl::DISCODO_DISABLED}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=Messages\.DISCODO_DISABLED.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
|
match: /(?<=#{intl::DISCODO_DISABLED}.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
|
||||||
replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))"
|
replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "Messages.SERVERS,children",
|
find: "#{intl::SERVERS}),children",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=Messages\.SERVERS,children:).+?default:return null\}\}\)/,
|
match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/,
|
||||||
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
|
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".METRICS,",
|
find: ".METRICS",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /this\._intervalId=/,
|
match: /this\._intervalId=/,
|
||||||
|
|
|
@ -25,8 +25,9 @@ import ThemesTab from "@components/VencordSettings/ThemesTab";
|
||||||
import UpdaterTab from "@components/VencordSettings/UpdaterTab";
|
import UpdaterTab from "@components/VencordSettings/UpdaterTab";
|
||||||
import VencordTab from "@components/VencordSettings/VencordTab";
|
import VencordTab from "@components/VencordSettings/VencordTab";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { getIntlMessage } from "@utils/discord";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { i18n, React } from "@webpack/common";
|
import { React } from "@webpack/common";
|
||||||
|
|
||||||
import gitHash from "~git-hash";
|
import gitHash from "~git-hash";
|
||||||
|
|
||||||
|
@ -57,20 +58,20 @@ export default definePlugin({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "Messages.ACTIVITY_SETTINGS",
|
find: ".SEARCH_NO_RESULTS&&0===",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=section:(.{0,50})\.DIVIDER\}\))([,;])(?=.{0,200}(\i)\.push.{0,100}label:(\i)\.header)/,
|
match: /(?<=section:(.{0,50})\.DIVIDER\}\))([,;])(?=.{0,200}(\i)\.push.{0,100}label:(\i)\.header)/,
|
||||||
replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}`
|
replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,30}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/,
|
match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,60}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/,
|
||||||
replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})`
|
replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/,
|
match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/,
|
||||||
replace: "$2.open($1);return;"
|
replace: "$2.open($1);return;"
|
||||||
|
@ -148,13 +149,18 @@ export default definePlugin({
|
||||||
|
|
||||||
if (!header) return;
|
if (!header) return;
|
||||||
|
|
||||||
|
try {
|
||||||
const names = {
|
const names = {
|
||||||
top: i18n.Messages.USER_SETTINGS,
|
top: getIntlMessage("USER_SETTINGS"),
|
||||||
aboveNitro: i18n.Messages.BILLING_SETTINGS,
|
aboveNitro: getIntlMessage("BILLING_SETTINGS"),
|
||||||
belowNitro: i18n.Messages.APP_SETTINGS,
|
belowNitro: getIntlMessage("APP_SETTINGS"),
|
||||||
aboveActivity: i18n.Messages.ACTIVITY_SETTINGS
|
aboveActivity: getIntlMessage("ACTIVITY_SETTINGS")
|
||||||
};
|
};
|
||||||
|
|
||||||
return header === names[settingsLocation];
|
return header === names[settingsLocation];
|
||||||
|
} catch {
|
||||||
|
return firstChild === "PREMIUM";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
patchedSettings: new WeakSet(),
|
patchedSettings: new WeakSet(),
|
||||||
|
@ -197,7 +203,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
get electronVersion() {
|
get electronVersion() {
|
||||||
return VencordNative.native.getVersions().electron || window.armcord?.electron || null;
|
return VencordNative.native.getVersions().electron || window.legcord?.electron || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
get chromiumVersion() {
|
get chromiumVersion() {
|
||||||
|
|
|
@ -77,7 +77,7 @@ async function generateDebugInfoMessage() {
|
||||||
const client = (() => {
|
const client = (() => {
|
||||||
if (IS_DISCORD_DESKTOP) return `Discord Desktop v${DiscordNative.app.getVersion()}`;
|
if (IS_DISCORD_DESKTOP) return `Discord Desktop v${DiscordNative.app.getVersion()}`;
|
||||||
if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`;
|
if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`;
|
||||||
if ("armcord" in window) return `ArmCord v${window.armcord.version}`;
|
if ("legcord" in window) return `Legcord v${window.legcord.version}`;
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web";
|
const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web";
|
||||||
|
@ -142,15 +142,15 @@ export default definePlugin({
|
||||||
required: true,
|
required: true,
|
||||||
description: "Helps us provide support to you",
|
description: "Helps us provide support to you",
|
||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven],
|
||||||
dependencies: ["CommandsAPI", "UserSettingsAPI", "MessageAccessoriesAPI"],
|
dependencies: ["UserSettingsAPI", "MessageAccessoriesAPI"],
|
||||||
|
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
patches: [{
|
patches: [{
|
||||||
find: ".BEGINNING_DM.format",
|
find: "#{intl::BEGINNING_DM}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,100}userId:(\i\.getRecipientId\(\)))/,
|
match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
|
||||||
replace: "$& $self.ContributorDmWarningCard({ userId: $1 }),"
|
replace: "$& $self.renderContributorDmWarningCard({ channel: $1 }),"
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
@ -235,7 +235,8 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ContributorDmWarningCard: ErrorBoundary.wrap(({ userId }) => {
|
renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
|
||||||
|
const userId = channel.getRecipientId();
|
||||||
if (!isPluginDev(userId)) return null;
|
if (!isPluginDev(userId)) return null;
|
||||||
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id)) return null;
|
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id)) return null;
|
||||||
|
|
||||||
|
|
7
src/plugins/accountPanelServerProfile/README.md
Normal file
7
src/plugins/accountPanelServerProfile/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# AccountPanelServerProfile
|
||||||
|
|
||||||
|
Right click your account panel in the bottom left to view your profile in the current server
|
||||||
|
|
||||||
|
![](https://github.com/user-attachments/assets/3228497d-488f-479c-93d2-a32ccdb08f0f)
|
||||||
|
|
||||||
|
![](https://github.com/user-attachments/assets/6fc45363-d95f-4810-812f-2f9fb28b41b5)
|
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import { getCurrentChannel } from "@utils/discord";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
|
import { ContextMenuApi, Menu, useEffect, useRef } from "@webpack/common";
|
||||||
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
|
interface UserProfileProps {
|
||||||
|
popoutProps: Record<string, any>;
|
||||||
|
currentUser: User;
|
||||||
|
originalPopout: () => React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cannot be undefined");
|
||||||
|
const styles = findByPropsLazy("accountProfilePopoutWrapper");
|
||||||
|
|
||||||
|
let openAlternatePopout = false;
|
||||||
|
let accountPanelRef: React.MutableRefObject<Record<PropertyKey, any> | null> = { current: null };
|
||||||
|
|
||||||
|
const AccountPanelContextMenu = ErrorBoundary.wrap(() => {
|
||||||
|
const { prioritizeServerProfile } = settings.use(["prioritizeServerProfile"]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Menu.Menu
|
||||||
|
navId="vc-ap-server-profile"
|
||||||
|
onClose={ContextMenuApi.closeContextMenu}
|
||||||
|
>
|
||||||
|
<Menu.MenuItem
|
||||||
|
id="vc-ap-view-alternate-popout"
|
||||||
|
label={prioritizeServerProfile ? "View Account Profile" : "View Server Profile"}
|
||||||
|
disabled={getCurrentChannel()?.getGuildId() == null}
|
||||||
|
action={e => {
|
||||||
|
openAlternatePopout = true;
|
||||||
|
accountPanelRef.current?.props.onMouseDown();
|
||||||
|
accountPanelRef.current?.props.onClick(e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Menu.MenuCheckboxItem
|
||||||
|
id="vc-ap-prioritize-server-profile"
|
||||||
|
label="Prioritize Server Profile"
|
||||||
|
checked={prioritizeServerProfile}
|
||||||
|
action={() => settings.store.prioritizeServerProfile = !prioritizeServerProfile}
|
||||||
|
/>
|
||||||
|
</Menu.Menu>
|
||||||
|
);
|
||||||
|
}, { noop: true });
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
prioritizeServerProfile: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Prioritize Server Profile when left clicking your account panel",
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "AccountPanelServerProfile",
|
||||||
|
description: "Right click your account panel in the bottom left to view your profile in the current server",
|
||||||
|
authors: [Devs.Nuckyz, Devs.relitrix],
|
||||||
|
settings,
|
||||||
|
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
|
||||||
|
group: true,
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /(?<=\.SIZE_32\)}\);)/,
|
||||||
|
replace: "$self.useAccountPanelRef();"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
|
||||||
|
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalPopout:()=>{${originalPopout}}})`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /\.AVATAR,children:.+?(?=renderPopout:)/,
|
||||||
|
replace: "$&onRequestClose:$self.onPopoutClose,"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(?<=.avatarWrapper,)/,
|
||||||
|
replace: "ref:$self.accountPanelRef,onContextMenu:$self.openAccountPanelContextMenu,"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
get accountPanelRef() {
|
||||||
|
return accountPanelRef;
|
||||||
|
},
|
||||||
|
|
||||||
|
useAccountPanelRef() {
|
||||||
|
useEffect(() => () => {
|
||||||
|
accountPanelRef.current = null;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (accountPanelRef = useRef(null));
|
||||||
|
},
|
||||||
|
|
||||||
|
openAccountPanelContextMenu(event: React.UIEvent) {
|
||||||
|
ContextMenuApi.openContextMenu(event, AccountPanelContextMenu);
|
||||||
|
},
|
||||||
|
|
||||||
|
onPopoutClose() {
|
||||||
|
openAlternatePopout = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
UserProfile: ErrorBoundary.wrap(({ popoutProps, currentUser, originalPopout }: UserProfileProps) => {
|
||||||
|
if (
|
||||||
|
(settings.store.prioritizeServerProfile && openAlternatePopout) ||
|
||||||
|
(!settings.store.prioritizeServerProfile && !openAlternatePopout)
|
||||||
|
) {
|
||||||
|
return originalPopout();
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentChannel = getCurrentChannel();
|
||||||
|
if (currentChannel?.getGuildId() == null) {
|
||||||
|
return originalPopout();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.accountProfilePopoutWrapper}>
|
||||||
|
<UserProfile {...popoutProps} userId={currentUser.id} guildId={currentChannel.getGuildId()} channelId={currentChannel.id} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}, { noop: true })
|
||||||
|
});
|
|
@ -41,7 +41,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Status emojis
|
// Status emojis
|
||||||
find: ".Messages.GUILD_OWNER,",
|
find: "#{intl::GUILD_OWNER}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=\.activityEmoji,.+?animate:)\i/,
|
match: /(?<=\.activityEmoji,.+?animate:)\i/,
|
||||||
replace: "!0"
|
replace: "!0"
|
||||||
|
|
3
src/plugins/alwaysExpandRoles/README.md
Normal file
3
src/plugins/alwaysExpandRoles/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Always Expand Roles
|
||||||
|
|
||||||
|
Always expands the role list in profile popouts
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Vencord, a modification for Discord's desktop app
|
* Vencord, a modification for Discord's desktop app
|
||||||
* Copyright (c) 2022 Vendicated and contributors
|
* Copyright (c) 2023 Vendicated and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,20 +16,22 @@
|
||||||
* 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 { migratePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
migratePluginSettings("AlwaysExpandRoles", "ShowAllRoles");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "TimeBarAllActivities",
|
name: "AlwaysExpandRoles",
|
||||||
description: "Adds the Spotify time bar to all activities if they have start and end timestamps",
|
description: "Always expands the role list in profile popouts",
|
||||||
authors: [Devs.fawn],
|
authors: [Devs.surgedevs],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "}renderTimeBar(",
|
find: 'action:"EXPAND_ROLES"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /renderTimeBar\((.{1,3})\){.{0,50}?let/,
|
match: /(roles:\i(?=.+?(\i)\(!0\)[,;]\i\({action:"EXPAND_ROLES"}\)).+?\[\i,\2\]=\i\.useState\()!1\)/,
|
||||||
replace: "renderTimeBar($1){let"
|
replace: (_, rest, setExpandedRoles) => `${rest}!0)`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
|
@ -71,7 +71,7 @@ export default definePlugin({
|
||||||
description: "Anonymise uploaded file names",
|
description: "Anonymise uploaded file names",
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "instantBatchUpload:function",
|
find: "instantBatchUpload:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /uploadFiles:(\i),/,
|
match: /uploadFiles:(\i),/,
|
||||||
replace:
|
replace:
|
||||||
|
@ -86,9 +86,9 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".Messages.ATTACHMENT_UTILITIES_SPOILER",
|
find: "#{intl::ATTACHMENT_UTILITIES_SPOILER}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}\i\.\i\.Messages\.ATTACHMENT_UTILITIES_SPOILER)/,
|
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}#{intl::ATTACHMENT_UTILITIES_SPOILER})/,
|
||||||
replace: "arguments[0].canEdit!==false?$self.renderIcon(arguments[0]):null,"
|
replace: "arguments[0].canEdit!==false?$self.renderIcon(arguments[0]):null,"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,7 @@ interface ActivityButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
state: string;
|
state?: string;
|
||||||
details?: string;
|
details?: string;
|
||||||
timestamps?: {
|
timestamps?: {
|
||||||
start?: number;
|
start?: number;
|
||||||
|
@ -52,8 +52,8 @@ const enum ActivityFlag {
|
||||||
|
|
||||||
export interface TrackData {
|
export interface TrackData {
|
||||||
name: string;
|
name: string;
|
||||||
album: string;
|
album?: string;
|
||||||
artist: string;
|
artist?: string;
|
||||||
|
|
||||||
appleMusicLink?: string;
|
appleMusicLink?: string;
|
||||||
songLink?: string;
|
songLink?: string;
|
||||||
|
@ -61,8 +61,8 @@ export interface TrackData {
|
||||||
albumArtwork?: string;
|
albumArtwork?: string;
|
||||||
artistArtwork?: string;
|
artistArtwork?: string;
|
||||||
|
|
||||||
playerPosition: number;
|
playerPosition?: number;
|
||||||
duration: number;
|
duration?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum AssetImageType {
|
const enum AssetImageType {
|
||||||
|
@ -120,7 +120,7 @@ const settings = definePluginSettings({
|
||||||
stateString: {
|
stateString: {
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
description: "Activity state format string",
|
description: "Activity state format string",
|
||||||
default: "{artist}"
|
default: "{artist} · {album}"
|
||||||
},
|
},
|
||||||
largeImageType: {
|
largeImageType: {
|
||||||
type: OptionType.SELECT,
|
type: OptionType.SELECT,
|
||||||
|
@ -155,8 +155,8 @@ const settings = definePluginSettings({
|
||||||
function customFormat(formatStr: string, data: TrackData) {
|
function customFormat(formatStr: string, data: TrackData) {
|
||||||
return formatStr
|
return formatStr
|
||||||
.replaceAll("{name}", data.name)
|
.replaceAll("{name}", data.name)
|
||||||
.replaceAll("{album}", data.album)
|
.replaceAll("{album}", data.album ?? "")
|
||||||
.replaceAll("{artist}", data.artist);
|
.replaceAll("{artist}", data.artist ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageAsset(type: AssetImageType, data: TrackData) {
|
function getImageAsset(type: AssetImageType, data: TrackData) {
|
||||||
|
@ -212,14 +212,16 @@ export default definePlugin({
|
||||||
|
|
||||||
const assets: ActivityAssets = {};
|
const assets: ActivityAssets = {};
|
||||||
|
|
||||||
|
const isRadio = Number.isNaN(trackData.duration) && (trackData.playerPosition === 0);
|
||||||
|
|
||||||
if (settings.store.largeImageType !== AssetImageType.Disabled) {
|
if (settings.store.largeImageType !== AssetImageType.Disabled) {
|
||||||
assets.large_image = largeImageAsset;
|
assets.large_image = largeImageAsset;
|
||||||
assets.large_text = customFormat(settings.store.largeTextString, trackData);
|
if (!isRadio) assets.large_text = customFormat(settings.store.largeTextString, trackData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.store.smallImageType !== AssetImageType.Disabled) {
|
if (settings.store.smallImageType !== AssetImageType.Disabled) {
|
||||||
assets.small_image = smallImageAsset;
|
assets.small_image = smallImageAsset;
|
||||||
assets.small_text = customFormat(settings.store.smallTextString, trackData);
|
if (!isRadio) assets.small_text = customFormat(settings.store.smallTextString, trackData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttons: ActivityButton[] = [];
|
const buttons: ActivityButton[] = [];
|
||||||
|
@ -243,17 +245,17 @@ export default definePlugin({
|
||||||
|
|
||||||
name: customFormat(settings.store.nameString, trackData),
|
name: customFormat(settings.store.nameString, trackData),
|
||||||
details: customFormat(settings.store.detailsString, trackData),
|
details: customFormat(settings.store.detailsString, trackData),
|
||||||
state: customFormat(settings.store.stateString, trackData),
|
state: isRadio ? undefined : customFormat(settings.store.stateString, trackData),
|
||||||
|
|
||||||
timestamps: (settings.store.enableTimestamps ? {
|
timestamps: (trackData.playerPosition && trackData.duration && settings.store.enableTimestamps) ? {
|
||||||
start: Date.now() - (trackData.playerPosition * 1000),
|
start: Date.now() - (trackData.playerPosition * 1000),
|
||||||
end: Date.now() - (trackData.playerPosition * 1000) + (trackData.duration * 1000),
|
end: Date.now() - (trackData.playerPosition * 1000) + (trackData.duration * 1000),
|
||||||
} : undefined),
|
} : undefined,
|
||||||
|
|
||||||
assets,
|
assets,
|
||||||
|
|
||||||
buttons: buttons.length ? buttons.map(v => v.label) : undefined,
|
buttons: !isRadio && buttons.length ? buttons.map(v => v.label) : undefined,
|
||||||
metadata: { button_urls: buttons.map(v => v.url) || undefined, },
|
metadata: !isRadio && buttons.length ? { button_urls: buttons.map(v => v.url) } : undefined,
|
||||||
|
|
||||||
type: settings.store.activityType,
|
type: settings.store.activityType,
|
||||||
flags: ActivityFlag.INSTANCE,
|
flags: ActivityFlag.INSTANCE,
|
||||||
|
|
|
@ -11,37 +11,11 @@ import type { TrackData } from ".";
|
||||||
|
|
||||||
const exec = promisify(execFile);
|
const exec = promisify(execFile);
|
||||||
|
|
||||||
// function exec(file: string, args: string[] = []) {
|
|
||||||
// return new Promise<{ code: number | null, stdout: string | null, stderr: string | null; }>((resolve, reject) => {
|
|
||||||
// const process = spawn(file, args, { stdio: [null, "pipe", "pipe"] });
|
|
||||||
|
|
||||||
// let stdout: string | null = null;
|
|
||||||
// process.stdout.on("data", (chunk: string) => { stdout ??= ""; stdout += chunk; });
|
|
||||||
// let stderr: string | null = null;
|
|
||||||
// process.stderr.on("data", (chunk: string) => { stdout ??= ""; stderr += chunk; });
|
|
||||||
|
|
||||||
// process.on("exit", code => { resolve({ code, stdout, stderr }); });
|
|
||||||
// process.on("error", err => reject(err));
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
async function applescript(cmds: string[]) {
|
async function applescript(cmds: string[]) {
|
||||||
const { stdout } = await exec("osascript", cmds.map(c => ["-e", c]).flat());
|
const { stdout } = await exec("osascript", cmds.map(c => ["-e", c]).flat());
|
||||||
return stdout;
|
return stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeSearchUrl(type: string, query: string) {
|
|
||||||
const url = new URL("https://tools.applemediaservices.com/api/apple-media/music/US/search.json");
|
|
||||||
url.searchParams.set("types", type);
|
|
||||||
url.searchParams.set("limit", "1");
|
|
||||||
url.searchParams.set("term", query);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
const requestOptions: RequestInit = {
|
|
||||||
headers: { "user-agent": "Mozilla/5.0 (Windows NT 10.0; rv:125.0) Gecko/20100101 Firefox/125.0" },
|
|
||||||
};
|
|
||||||
|
|
||||||
interface RemoteData {
|
interface RemoteData {
|
||||||
appleMusicLink?: string,
|
appleMusicLink?: string,
|
||||||
songLink?: string,
|
songLink?: string,
|
||||||
|
@ -51,6 +25,24 @@ interface RemoteData {
|
||||||
|
|
||||||
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
|
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
|
||||||
|
|
||||||
|
const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/;
|
||||||
|
const APPLE_MUSIC_TOKEN_REGEX = /\w+="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)",\w+="x-apple-jingle-correlation-key"/;
|
||||||
|
|
||||||
|
let cachedToken: string | undefined = undefined;
|
||||||
|
|
||||||
|
const getToken = async () => {
|
||||||
|
if (cachedToken) return cachedToken;
|
||||||
|
|
||||||
|
const html = await fetch("https://music.apple.com/").then(r => r.text());
|
||||||
|
const bundleUrl = new URL(html.match(APPLE_MUSIC_BUNDLE_REGEX)![1], "https://music.apple.com/");
|
||||||
|
|
||||||
|
const bundle = await fetch(bundleUrl).then(r => r.text());
|
||||||
|
const token = bundle.match(APPLE_MUSIC_TOKEN_REGEX)![1];
|
||||||
|
|
||||||
|
cachedToken = token;
|
||||||
|
return token;
|
||||||
|
};
|
||||||
|
|
||||||
async function fetchRemoteData({ id, name, artist, album }: { id: string, name: string, artist: string, album: string; }) {
|
async function fetchRemoteData({ id, name, artist, album }: { id: string, name: string, artist: string, album: string; }) {
|
||||||
if (id === cachedRemoteData?.id) {
|
if (id === cachedRemoteData?.id) {
|
||||||
if ("data" in cachedRemoteData) return cachedRemoteData.data;
|
if ("data" in cachedRemoteData) return cachedRemoteData.data;
|
||||||
|
@ -58,21 +50,39 @@ async function fetchRemoteData({ id, name, artist, album }: { id: string, name:
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [songData, artistData] = await Promise.all([
|
const dataUrl = new URL("https://amp-api-edge.music.apple.com/v1/catalog/us/search");
|
||||||
fetch(makeSearchUrl("songs", artist + " " + album + " " + name), requestOptions).then(r => r.json()),
|
dataUrl.searchParams.set("platform", "web");
|
||||||
fetch(makeSearchUrl("artists", artist.split(/ *[,&] */)[0]), requestOptions).then(r => r.json())
|
dataUrl.searchParams.set("l", "en-US");
|
||||||
]);
|
dataUrl.searchParams.set("limit", "1");
|
||||||
|
dataUrl.searchParams.set("with", "serverBubbles");
|
||||||
|
dataUrl.searchParams.set("types", "songs");
|
||||||
|
dataUrl.searchParams.set("term", `${name} ${artist} ${album}`);
|
||||||
|
dataUrl.searchParams.set("include[songs]", "artists");
|
||||||
|
|
||||||
const appleMusicLink = songData?.songs?.data[0]?.attributes.url;
|
const token = await getToken();
|
||||||
const songLink = songData?.songs?.data[0]?.id ? `https://song.link/i/${songData?.songs?.data[0]?.id}` : undefined;
|
|
||||||
|
|
||||||
const albumArtwork = songData?.songs?.data[0]?.attributes.artwork.url.replace("{w}", "512").replace("{h}", "512");
|
const songData = await fetch(dataUrl, {
|
||||||
const artistArtwork = artistData?.artists?.data[0]?.attributes.artwork.url.replace("{w}", "512").replace("{h}", "512");
|
headers: {
|
||||||
|
"accept": "*/*",
|
||||||
|
"accept-language": "en-US,en;q=0.9",
|
||||||
|
"authorization": `Bearer ${token}`,
|
||||||
|
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||||
|
"origin": "https://music.apple.com",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(data => data.results.song.data[0]);
|
||||||
|
|
||||||
cachedRemoteData = {
|
cachedRemoteData = {
|
||||||
id,
|
id,
|
||||||
data: { appleMusicLink, songLink, albumArtwork, artistArtwork }
|
data: {
|
||||||
|
appleMusicLink: songData.attributes.url,
|
||||||
|
songLink: `https://song.link/i/${songData.id}`,
|
||||||
|
albumArtwork: songData.attributes.artwork.url.replace("{w}x{h}", "512x512"),
|
||||||
|
artistArtwork: songData.relationships.artists.data[0].attributes.artwork.url.replace("{w}x{h}", "512x512"),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return cachedRemoteData.data;
|
return cachedRemoteData.data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("[AppleMusicRichPresence] Failed to fetch remote data:", e);
|
console.error("[AppleMusicRichPresence] Failed to fetch remote data:", e);
|
||||||
|
|
|
@ -73,8 +73,8 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
// ArmCord comes with its own arRPC implementation, so this plugin just confuses users
|
// Legcord comes with its own arRPC implementation, so this plugin just confuses users
|
||||||
if ("armcord" in window) return;
|
if ("legcord" in window) return;
|
||||||
|
|
||||||
if (ws) ws.close();
|
if (ws) ws.close();
|
||||||
ws = new WebSocket("ws://127.0.0.1:1337"); // try to open WebSocket
|
ws = new WebSocket("ws://127.0.0.1:1337"); // try to open WebSocket
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# AutomodContext
|
|
||||||
|
|
||||||
Allows you to jump to the messages surrounding an automod hit
|
|
||||||
|
|
||||||
![Visualization](https://github.com/Vendicated/Vencord/assets/61953774/d13740c8-2062-4553-b975-82fd3d6cc08b)
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a Discord client mod
|
|
||||||
* Copyright (c) 2024 Vendicated and contributors
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
import { findByPropsLazy } from "@webpack";
|
|
||||||
import { Button, ChannelStore, Text } from "@webpack/common";
|
|
||||||
|
|
||||||
const { selectChannel } = findByPropsLazy("selectChannel", "selectVoiceChannel");
|
|
||||||
|
|
||||||
function jumpToMessage(channelId: string, messageId: string) {
|
|
||||||
const guildId = ChannelStore.getChannel(channelId)?.guild_id;
|
|
||||||
|
|
||||||
selectChannel({
|
|
||||||
guildId,
|
|
||||||
channelId,
|
|
||||||
messageId,
|
|
||||||
jumpType: "INSTANT"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function findChannelId(message: any): string | null {
|
|
||||||
const { embeds: [embed] } = message;
|
|
||||||
const channelField = embed.fields.find(({ rawName }) => rawName === "channel_id");
|
|
||||||
|
|
||||||
if (!channelField) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return channelField.rawValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "AutomodContext",
|
|
||||||
description: "Allows you to jump to the messages surrounding an automod hit.",
|
|
||||||
authors: [Devs.JohnyTheCarrot],
|
|
||||||
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: ".Messages.GUILD_AUTOMOD_REPORT_ISSUES",
|
|
||||||
replacement: {
|
|
||||||
match: /\.Messages\.ACTIONS.+?}\)(?=,(\(0.{0,40}\.dot.*?}\)),)/,
|
|
||||||
replace: (m, dot) => `${m},${dot},$self.renderJumpButton({message:arguments[0].message})`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
renderJumpButton: ErrorBoundary.wrap(({ message }: { message: any; }) => {
|
|
||||||
const channelId = findChannelId(message);
|
|
||||||
|
|
||||||
if (!channelId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
style={{ padding: "2px 8px" }}
|
|
||||||
look={Button.Looks.LINK}
|
|
||||||
size={Button.Sizes.SMALL}
|
|
||||||
color={Button.Colors.LINK}
|
|
||||||
onClick={() => jumpToMessage(channelId, message.id)}
|
|
||||||
>
|
|
||||||
<Text color="text-link" variant="text-xs/normal">
|
|
||||||
Jump to Surrounding
|
|
||||||
</Text>
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
}, { noop: true })
|
|
||||||
});
|
|
|
@ -36,7 +36,7 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "BAN_CONFIRM_TITLE.",
|
find: "#{intl::BAN_CONFIRM_TITLE}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /src:\i\("?\d+"?\)/g,
|
match: /src:\i\("?\d+"?\)/g,
|
||||||
replace: "src:$self.source"
|
replace: "src:$self.source"
|
||||||
|
|
11
src/plugins/betterFolders/README.md
Normal file
11
src/plugins/betterFolders/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Better Folders
|
||||||
|
|
||||||
|
Better Folders offers a variety of options to improve your folder experience
|
||||||
|
|
||||||
|
Always show the folder icon, regardless of if the folder is open or not
|
||||||
|
|
||||||
|
Only have one folder open at a time
|
||||||
|
|
||||||
|
Open folders in a sidebar:
|
||||||
|
|
||||||
|
![A folder open in a separate sidebar](https://github.com/user-attachments/assets/432d3146-8091-4bae-9c1e-c19046c72947)
|
|
@ -18,9 +18,10 @@
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { getIntlMessage } from "@utils/discord";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
||||||
import { FluxDispatcher, i18n, useMemo } from "@webpack/common";
|
import { FluxDispatcher, useMemo } from "@webpack/common";
|
||||||
|
|
||||||
import FolderSideBar from "./FolderSideBar";
|
import FolderSideBar from "./FolderSideBar";
|
||||||
|
|
||||||
|
@ -30,9 +31,9 @@ enum FolderIconDisplay {
|
||||||
MoreThanOneFolderExpanded
|
MoreThanOneFolderExpanded
|
||||||
}
|
}
|
||||||
|
|
||||||
const GuildsTree = findLazy(m => m.prototype?.moveNextTo);
|
|
||||||
const SortedGuildStore = findStoreLazy("SortedGuildStore");
|
|
||||||
export const ExpandedGuildFolderStore = findStoreLazy("ExpandedGuildFolderStore");
|
export const ExpandedGuildFolderStore = findStoreLazy("ExpandedGuildFolderStore");
|
||||||
|
const SortedGuildStore = findStoreLazy("SortedGuildStore");
|
||||||
|
const GuildsTree = findLazy(m => m.prototype?.moveNextTo);
|
||||||
const FolderUtils = findByPropsLazy("move", "toggleGuildFolderExpand");
|
const FolderUtils = findByPropsLazy("move", "toggleGuildFolderExpand");
|
||||||
|
|
||||||
let lastGuildId = null as string | null;
|
let lastGuildId = null as string | null;
|
||||||
|
@ -118,22 +119,22 @@ export default definePlugin({
|
||||||
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
|
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
|
||||||
{
|
{
|
||||||
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
|
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
|
||||||
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0].isBetterFolders,betterFoldersOriginalTree,arguments[0].betterFoldersExpandedIds)`
|
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0]?.isBetterFolders,betterFoldersOriginalTree,arguments[0]?.betterFoldersExpandedIds)`
|
||||||
},
|
},
|
||||||
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
||||||
{
|
{
|
||||||
match: /lastTargetNode:\i\[\i\.length-1\].+?Fragment.+?\]}\)\]/,
|
match: /lastTargetNode:\i\[\i\.length-1\].+?Fragment.+?\]}\)\]/,
|
||||||
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0].isBetterFolders))"
|
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
|
||||||
},
|
},
|
||||||
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
|
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
|
||||||
{
|
{
|
||||||
match: /unreadMentionsIndicatorBottom,.+?}\)\]/,
|
match: /unreadMentionsIndicatorBottom,.+?}\)\]/,
|
||||||
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0].isBetterFolders))"
|
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))"
|
||||||
},
|
},
|
||||||
// Export the isBetterFolders variable to the folders component
|
// Export the isBetterFolders variable to the folders component
|
||||||
{
|
{
|
||||||
match: /(?<=\.Messages\.SERVERS.+?switch\((\i)\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,)/,
|
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
|
||||||
replace: 'isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
|
replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -167,31 +168,31 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
predicate: () => settings.store.keepIcons,
|
predicate: () => settings.store.keepIcons,
|
||||||
match: /(?<=let{folderNode:\i,setNodeRef:\i,.+?expanded:(\i),.+?;)(?=let)/,
|
match: /(?<=let{folderNode:\i,setNodeRef:\i,.+?expanded:(\i),.+?;)(?=let)/,
|
||||||
replace: (_, isExpanded) => `${isExpanded}=!!arguments[0].isBetterFolders&&${isExpanded};`
|
replace: (_, isExpanded) => `${isExpanded}=!!arguments[0]?.isBetterFolders&&${isExpanded};`
|
||||||
},
|
},
|
||||||
// Disable expanding and collapsing folders transition in the normal GuildsBar sidebar
|
// Disable expanding and collapsing folders transition in the normal GuildsBar sidebar
|
||||||
{
|
{
|
||||||
predicate: () => !settings.store.keepIcons,
|
predicate: () => !settings.store.keepIcons,
|
||||||
match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/,
|
match: /(?<=#{intl::SERVER_FOLDER_PLACEHOLDER}.+?useTransition\)\()/,
|
||||||
replace: "!!arguments[0].isBetterFolders&&"
|
replace: "$self.shouldShowTransition(arguments[0])&&"
|
||||||
},
|
},
|
||||||
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
||||||
{
|
{
|
||||||
predicate: () => !settings.store.keepIcons,
|
predicate: () => !settings.store.keepIcons,
|
||||||
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
||||||
replace: (m, isExpanded) => `${m}!arguments[0].isBetterFolders&&${isExpanded}?null:`
|
replace: (m, isExpanded) => `${m}$self.shouldRenderContents(arguments[0],${isExpanded})?null:`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
|
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
|
||||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||||
match: /(?<=\.wrapper,children:\[)/,
|
match: /(?<=\.wrapper,children:\[)/,
|
||||||
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0].isBetterFolders,arguments[0].betterFoldersExpandedIds)&&"
|
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Decide if we should render the expanded folder icon if we are rendering the Better Folders sidebar
|
// Decide if we should render the expanded folder icon if we are rendering the Better Folders sidebar
|
||||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||||
match: /(?<=\.expandedFolderBackground.+?}\),)(?=\i,)/,
|
match: /(?<=\.expandedFolderBackground.+?}\),)(?=\i,)/,
|
||||||
replace: "!$self.shouldShowFolderIconAndBackground(!!arguments[0].isBetterFolders,arguments[0].betterFoldersExpandedIds)?null:"
|
replace: "!$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)?null:"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -200,12 +201,12 @@ export default definePlugin({
|
||||||
predicate: () => settings.store.sidebar,
|
predicate: () => settings.store.sidebar,
|
||||||
replacement: {
|
replacement: {
|
||||||
// Render the Better Folders sidebar
|
// Render the Better Folders sidebar
|
||||||
match: /(?<=({className:\i\.guilds,themeOverride:\i})\))/,
|
match: /(container.{0,50}({className:\i\.guilds,themeOverride:\i})\))/,
|
||||||
replace: ",$self.FolderSideBar($1)"
|
replace: "$1,$self.FolderSideBar({...$2})"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".Messages.DISCODO_DISABLED",
|
find: "#{intl::DISCODO_DISABLED}",
|
||||||
predicate: () => settings.store.closeAllHomeButton,
|
predicate: () => settings.store.closeAllHomeButton,
|
||||||
replacement: {
|
replacement: {
|
||||||
// Close all folders when clicking the home button
|
// Close all folders when clicking the home button
|
||||||
|
@ -249,6 +250,10 @@ export default definePlugin({
|
||||||
dispatchingFoldersClose = false;
|
dispatchingFoldersClose = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
LOGOUT() {
|
||||||
|
closeFolders();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -270,12 +275,16 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
||||||
|
try {
|
||||||
return child => {
|
return child => {
|
||||||
if (isBetterFolders) {
|
if (isBetterFolders) {
|
||||||
return child?.props?.["aria-label"] === i18n.Messages.SERVERS;
|
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
} catch {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
||||||
|
@ -302,7 +311,20 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
FolderSideBar: guildsBarProps => <FolderSideBar {...guildsBarProps} />,
|
shouldShowTransition(props: any) {
|
||||||
|
// Pending guilds
|
||||||
|
if (props?.folderNode?.id === 1) return true;
|
||||||
|
|
||||||
closeFolders
|
return !!props?.isBetterFolders;
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldRenderContents(props: any, isExpanded: boolean) {
|
||||||
|
// Pending guilds
|
||||||
|
if (props?.folderNode?.id === 1) return false;
|
||||||
|
|
||||||
|
return !props?.isBetterFolders && isExpanded;
|
||||||
|
},
|
||||||
|
|
||||||
|
FolderSideBar,
|
||||||
|
closeFolders,
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,9 +34,9 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".Messages.GIF,",
|
find: "#{intl::GIF}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /alt:(\i)=(\i\.\i\.Messages\.GIF)(?=,[^}]*\}=(\i))/,
|
match: /alt:(\i)=(\i\.\i\.string\(\i\.\i#{intl::GIF}\))(?=,[^}]*\}=(\i))/,
|
||||||
replace:
|
replace:
|
||||||
// rename prop so we can always use default value
|
// rename prop so we can always use default value
|
||||||
"alt_$$:$1=$self.altify($3)||$2",
|
"alt_$$:$1=$self.altify($3)||$2",
|
||||||
|
|
|
@ -17,13 +17,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { definePluginSettings, Settings } from "@api/Settings";
|
import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { canonicalizeMatch } from "@utils/patches";
|
import { canonicalizeMatch } from "@utils/patches";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
|
||||||
|
|
||||||
const UserPopoutSectionCssClasses = findByPropsLazy("section", "lastSection");
|
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
hide: {
|
hide: {
|
||||||
|
@ -67,28 +63,14 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "Messages.NOTE_PLACEHOLDER",
|
find: "#{intl::NOTE_PLACEHOLDER}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.NOTE_PLACEHOLDER,/,
|
match: /#{intl::NOTE_PLACEHOLDER}\),/,
|
||||||
replace: "$&spellCheck:!$self.noSpellCheck,"
|
replace: "$&spellCheck:!$self.noSpellCheck,"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
find: ".popularApplicationCommandIds,",
|
|
||||||
replacement: {
|
|
||||||
match: /lastSection:(!?\i)}\),/,
|
|
||||||
replace: "$&$self.patchPadding({lastSection:$1}),"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
patchPadding: ErrorBoundary.wrap(({ lastSection }) => {
|
|
||||||
if (!lastSection) return null;
|
|
||||||
return (
|
|
||||||
<div className={UserPopoutSectionCssClasses.lastSection} ></div>
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
get noSpellCheck() {
|
get noSpellCheck() {
|
||||||
return settings.store.noSpellCheck;
|
return settings.store.noSpellCheck;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,11 @@ export default definePlugin({
|
||||||
id="vc-view-role-icon"
|
id="vc-view-role-icon"
|
||||||
label="View Role Icon"
|
label="View Role Icon"
|
||||||
action={() => {
|
action={() => {
|
||||||
openImageModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`);
|
openImageModal({
|
||||||
|
url: `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`,
|
||||||
|
height: 128,
|
||||||
|
width: 128
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
icon={ImageIcon}
|
icon={ImageIcon}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
find: ".ADD_ROLE_A11Y_LABEL",
|
find: "#{intl::ADD_ROLE_A11Y_LABEL}",
|
||||||
all: true,
|
all: true,
|
||||||
predicate: () => Settings.plugins.BetterRoleDot.copyRoleColorInProfilePopout && !Settings.plugins.BetterRoleDot.bothStyles,
|
predicate: () => Settings.plugins.BetterRoleDot.copyRoleColorInProfilePopout && !Settings.plugins.BetterRoleDot.bothStyles,
|
||||||
noWarn: true,
|
noWarn: true,
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "Messages.AUTH_SESSIONS_SESSION_LOG_OUT",
|
find: "#{intl::AUTH_SESSIONS_SESSION_LOG_OUT}",
|
||||||
replacement: [
|
replacement: [
|
||||||
// Replace children with a single label with state
|
// Replace children with a single label with state
|
||||||
{
|
{
|
||||||
|
|
69
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
69
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { openPluginModal } from "@components/PluginSettings/PluginModal";
|
||||||
|
import { getIntlMessage } from "@utils/discord";
|
||||||
|
import { isObjectEmpty } from "@utils/misc";
|
||||||
|
import { Alerts, Menu, useMemo, useState } from "@webpack/common";
|
||||||
|
|
||||||
|
import Plugins from "~plugins";
|
||||||
|
|
||||||
|
function onRestartNeeded() {
|
||||||
|
Alerts.show({
|
||||||
|
title: "Restart required",
|
||||||
|
body: <p>You have changed settings that require a restart.</p>,
|
||||||
|
confirmText: "Restart now",
|
||||||
|
cancelText: "Later!",
|
||||||
|
onConfirm: () => location.reload()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function PluginsSubmenu() {
|
||||||
|
const sortedPlugins = useMemo(() => Object.values(Plugins)
|
||||||
|
.sort((a, b) => a.name.localeCompare(b.name)), []);
|
||||||
|
const [query, setQuery] = useState("");
|
||||||
|
|
||||||
|
const search = query.toLowerCase();
|
||||||
|
const include = (p: typeof Plugins[keyof typeof Plugins]) => (
|
||||||
|
Vencord.Plugins.isPluginEnabled(p.name)
|
||||||
|
&& p.options && !isObjectEmpty(p.options)
|
||||||
|
&& (
|
||||||
|
p.name.toLowerCase().includes(search)
|
||||||
|
|| p.description.toLowerCase().includes(search)
|
||||||
|
|| p.tags?.some(t => t.toLowerCase().includes(search))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const plugins = sortedPlugins.filter(include);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Menu.MenuControlItem
|
||||||
|
id="vc-plugins-search"
|
||||||
|
control={(props, ref) => (
|
||||||
|
<Menu.MenuSearchControl
|
||||||
|
{...props}
|
||||||
|
query={query}
|
||||||
|
onChange={setQuery}
|
||||||
|
ref={ref}
|
||||||
|
placeholder={getIntlMessage("SEARCH")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{!!plugins.length && <Menu.MenuSeparator />}
|
||||||
|
|
||||||
|
{plugins.map(p => (
|
||||||
|
<Menu.MenuItem
|
||||||
|
key={p.name}
|
||||||
|
id={p.name}
|
||||||
|
label={p.name}
|
||||||
|
action={() => openPluginModal(p, onRestartNeeded)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -7,12 +7,15 @@
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { classNameFactory } from "@api/Styles";
|
import { classNameFactory } from "@api/Styles";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { getIntlMessage } from "@utils/discord";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { waitFor } from "@webpack";
|
import { waitFor } from "@webpack";
|
||||||
import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
|
import { ComponentDispatch, FocusLock, Menu, useEffect, useRef } from "@webpack/common";
|
||||||
import type { HTMLAttributes, ReactElement } from "react";
|
import type { HTMLAttributes, ReactElement } from "react";
|
||||||
|
|
||||||
|
import PluginsSubmenu from "./PluginsSubmenu";
|
||||||
|
|
||||||
type SettingsEntry = { section: string, label: string; };
|
type SettingsEntry = { section: string, label: string; };
|
||||||
|
|
||||||
const cl = classNameFactory("");
|
const cl = classNameFactory("");
|
||||||
|
@ -109,7 +112,7 @@ export default definePlugin({
|
||||||
predicate: () => settings.store.disableFade
|
predicate: () => settings.store.disableFade
|
||||||
},
|
},
|
||||||
{ // Load menu TOC eagerly
|
{ // Load menu TOC eagerly
|
||||||
find: "Messages.USER_SETTINGS_WITH_BUILD_OVERRIDE.format",
|
find: "#{intl::USER_SETTINGS_WITH_BUILD_OVERRIDE}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/,
|
match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/,
|
||||||
replace: "$&(async ()=>$2)(),"
|
replace: "$&(async ()=>$2)(),"
|
||||||
|
@ -117,14 +120,22 @@ export default definePlugin({
|
||||||
predicate: () => settings.store.eagerLoad
|
predicate: () => settings.store.eagerLoad
|
||||||
},
|
},
|
||||||
{ // Settings cog context menu
|
{ // Settings cog context menu
|
||||||
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
|
||||||
replacement: {
|
replacement: [
|
||||||
|
{
|
||||||
match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/,
|
match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/,
|
||||||
replace: "$1$self.wrapMenu($2)"
|
replace: "$1$self.wrapMenu($2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /case \i\.\i\.DEVELOPER_OPTIONS:return \i;/,
|
||||||
|
replace: "$&case 'VencordPlugins':return $self.PluginsSubmenu();"
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
PluginsSubmenu,
|
||||||
|
|
||||||
// This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary
|
// This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary
|
||||||
// without possibly also catching unrelated errors of children.
|
// without possibly also catching unrelated errors of children.
|
||||||
//
|
//
|
||||||
|
@ -149,7 +160,7 @@ export default definePlugin({
|
||||||
if (item.section === "HEADER") {
|
if (item.section === "HEADER") {
|
||||||
items.push({ label: item.label, items: [] });
|
items.push({ label: item.label, items: [] });
|
||||||
} else if (item.section === "DIVIDER") {
|
} else if (item.section === "DIVIDER") {
|
||||||
items.push({ label: i18n.Messages.OTHER_OPTIONS, items: [] });
|
items.push({ label: getIntlMessage("OTHER_OPTIONS"), items: [] });
|
||||||
} else {
|
} else {
|
||||||
items.at(-1)!.items.push(item);
|
items.at(-1)!.items.push(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,9 @@ export default definePlugin({
|
||||||
description: "Upload with a single click, open menu with right click",
|
description: "Upload with a single click, open menu with right click",
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "Messages.CHAT_ATTACH_UPLOAD_OR_INVITE",
|
find: '"ChannelAttachButton"',
|
||||||
replacement: {
|
replacement: {
|
||||||
// Discord merges multiple props here with Object.assign()
|
match: /\.attachButtonInner,"aria-label":.{0,50},onDoubleClick:(.+?:void 0),\.\.\.(\i),/,
|
||||||
// This patch passes a third object to it with which we override onClick and onContextMenu
|
|
||||||
match: /CHAT_ATTACH_UPLOAD_OR_INVITE,onDoubleClick:(.+?:void 0),\.\.\.(\i),/,
|
|
||||||
replace: "$&onClick:$1,onContextMenu:$2.onClick,",
|
replace: "$&onClick:$1,onContextMenu:$2.onClick,",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,7 +57,11 @@ export const handleViewPreview = async ({ guildId, channelId, ownerId }: Applica
|
||||||
const previewUrl = await ApplicationStreamPreviewStore.getPreviewURL(guildId, channelId, ownerId);
|
const previewUrl = await ApplicationStreamPreviewStore.getPreviewURL(guildId, channelId, ownerId);
|
||||||
if (!previewUrl) return;
|
if (!previewUrl) return;
|
||||||
|
|
||||||
openImageModal(previewUrl);
|
openImageModal({
|
||||||
|
url: previewUrl,
|
||||||
|
height: 720,
|
||||||
|
width: 1280
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addViewStreamContext: NavContextMenuPatchCallback = (children, { userId }: { userId: string | bigint; }) => {
|
export const addViewStreamContext: NavContextMenuPatchCallback = (children, { userId }: { userId: string | bigint; }) => {
|
||||||
|
|
|
@ -45,8 +45,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".embedWrapper,embed",
|
find: ".embedWrapper,embed",
|
||||||
replacement: [{
|
replacement: [{
|
||||||
match: /\.embedWrapper(?=.+?channel_id:(\i)\.id)/g,
|
match: /\.container/,
|
||||||
replace: "$&+($1.nsfw?' vc-nsfw-img':'')"
|
replace: "$&+(this.props.channel.nsfw? ' vc-nsfw-img': '')"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -155,4 +155,5 @@ export const defaultRules = [
|
||||||
"igshid",
|
"igshid",
|
||||||
"igsh",
|
"igsh",
|
||||||
"share_id@reddit.com",
|
"share_id@reddit.com",
|
||||||
|
"si@soundcloud.com",
|
||||||
];
|
];
|
||||||
|
|
|
@ -12,9 +12,9 @@ import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||||
import { findByCodeLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
import { findByCodeLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
||||||
import { Button, Forms, useStateFromStores } from "@webpack/common";
|
import { Button, Forms, ThemeStore, useStateFromStores } from "@webpack/common";
|
||||||
|
|
||||||
const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
|
||||||
|
|
||||||
const colorPresets = [
|
const colorPresets = [
|
||||||
"#1E1514", "#172019", "#13171B", "#1C1C28", "#402D2D",
|
"#1E1514", "#172019", "#13171B", "#1C1C28", "#402D2D",
|
||||||
|
@ -30,13 +30,12 @@ function onPickColor(color: number) {
|
||||||
updateColorVars(hexColor);
|
updateColorVars(hexColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveClientTheme = findByCodeLazy('type:"UNSYNCED_USER_SETTINGS_UPDATE",settings:{useSystemTheme:"system"===');
|
const saveClientTheme = findByCodeLazy('type:"UNSYNCED_USER_SETTINGS_UPDATE', '"system"===');
|
||||||
|
|
||||||
function setTheme(theme: string) {
|
function setTheme(theme: string) {
|
||||||
saveClientTheme({ theme });
|
saveClientTheme({ theme });
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThemeStore = findStoreLazy("ThemeStore");
|
|
||||||
const NitroThemeStore = findStoreLazy("ClientThemesBackgroundStore");
|
const NitroThemeStore = findStoreLazy("ClientThemesBackgroundStore");
|
||||||
|
|
||||||
function ThemeSettings() {
|
function ThemeSettings() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ConsoleJanitor
|
# ConsoleJanitor
|
||||||
|
|
||||||
Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and noisy/spammy logging messages.
|
Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and Discord logger messages.
|
||||||
|
|
||||||
Some of the disabled messages include the "notosans-400-normalitalic" error and MessageActionCreators, Routing/Utils loggers.
|
One of the disabled messages is the "Window state not initialized" warning, for example.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||||
|
|
||||||
const Noop = () => { };
|
const Noop = () => { };
|
||||||
const NoopLogger = {
|
const NoopLogger = {
|
||||||
|
@ -22,10 +22,12 @@ const NoopLogger = {
|
||||||
fileOnly: Noop
|
fileOnly: Noop
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logAllow = new Set();
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
disableNoisyLoggers: {
|
disableLoggers: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Disable noisy loggers like the MessageActionCreators",
|
description: "Disables Discords loggers",
|
||||||
default: false,
|
default: false,
|
||||||
restartNeeded: true
|
restartNeeded: true
|
||||||
},
|
},
|
||||||
|
@ -34,18 +36,43 @@ const settings = definePluginSettings({
|
||||||
description: "Disable the Spotify logger, which leaks account information and access token",
|
description: "Disable the Spotify logger, which leaks account information and access token",
|
||||||
default: true,
|
default: true,
|
||||||
restartNeeded: true
|
restartNeeded: true
|
||||||
|
},
|
||||||
|
whitelistedLoggers: {
|
||||||
|
type: OptionType.STRING,
|
||||||
|
description: "Semi colon separated list of loggers to allow even if others are hidden",
|
||||||
|
default: "GatewaySocket; Routing/Utils",
|
||||||
|
onChange(newVal: string) {
|
||||||
|
logAllow.clear();
|
||||||
|
newVal.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ConsoleJanitor",
|
name: "ConsoleJanitor",
|
||||||
description: "Disables annoying console messages/errors",
|
description: "Disables annoying console messages/errors",
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz, Devs.sadan],
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
|
startAt: StartAt.Init,
|
||||||
|
start() {
|
||||||
|
logAllow.clear();
|
||||||
|
this.settings.store.whitelistedLoggers?.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
|
||||||
|
},
|
||||||
|
|
||||||
NoopLogger: () => NoopLogger,
|
NoopLogger: () => NoopLogger,
|
||||||
|
shouldLog(logger: string) {
|
||||||
|
return logAllow.has(logger);
|
||||||
|
},
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
{
|
||||||
|
find: 'react-spring: The "interpolate" function',
|
||||||
|
replacement: {
|
||||||
|
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
|
||||||
|
replace: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
find: 'console.warn("Window state not initialized"',
|
find: 'console.warn("Window state not initialized"',
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -60,13 +87,6 @@ export default definePlugin({
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
find: "notosans-400-normalitalic",
|
|
||||||
replacement: {
|
|
||||||
match: /,"notosans-.+?"/g,
|
|
||||||
replace: ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
find: 'console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");',
|
find: 'console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");',
|
||||||
all: true,
|
all: true,
|
||||||
|
@ -110,34 +130,13 @@ export default definePlugin({
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...[
|
// Patches discords generic logger function
|
||||||
'("MessageActionCreators")', '("ChannelMessages")',
|
|
||||||
'("Routing/Utils")', '("RTCControlSocket")',
|
|
||||||
'("ConnectionEventFramerateReducer")', '("RTCLatencyTestManager")',
|
|
||||||
'("OverlayBridgeStore")', '("RPCServer:WSS")', '("RPCServer:IPC")'
|
|
||||||
].map(logger => ({
|
|
||||||
find: logger,
|
|
||||||
predicate: () => settings.store.disableNoisyLoggers,
|
|
||||||
all: true,
|
|
||||||
replacement: {
|
|
||||||
match: new RegExp(String.raw`new \i\.\i${logger.replace(/([()])/g, "\\$1")}`),
|
|
||||||
replace: `$self.NoopLogger${logger}`
|
|
||||||
}
|
|
||||||
})),
|
|
||||||
{
|
{
|
||||||
find: '"Experimental codecs: "',
|
find: "Σ:",
|
||||||
predicate: () => settings.store.disableNoisyLoggers,
|
predicate: () => settings.store.disableLoggers,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /new \i\.\i\("Connection\("\.concat\(\i,"\)"\)\)/,
|
match: /(?<=&&)(?=console)/,
|
||||||
replace: "$self.NoopLogger()"
|
replace: "$self.shouldLog(arguments[0])&&"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: '"Handling ping: "',
|
|
||||||
predicate: () => settings.store.disableNoisyLoggers,
|
|
||||||
replacement: {
|
|
||||||
match: /new \i\.\i\("RTCConnection\("\.concat.+?\)\)(?=,)/,
|
|
||||||
replace: "$self.NoopLogger()"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -148,5 +147,5 @@ export default definePlugin({
|
||||||
replace: "$self.NoopLogger()"
|
replace: "$self.NoopLogger()"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||||
|
import { runtimeHashMessageKey } from "@utils/intlHash";
|
||||||
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
|
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
|
||||||
import { relaunch } from "@utils/native";
|
import { relaunch } from "@utils/native";
|
||||||
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
|
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
|
||||||
|
@ -104,6 +105,7 @@ function makeShortcuts() {
|
||||||
canonicalizeMatch,
|
canonicalizeMatch,
|
||||||
canonicalizeReplace,
|
canonicalizeReplace,
|
||||||
canonicalizeReplacement,
|
canonicalizeReplacement,
|
||||||
|
runtimeHashMessageKey,
|
||||||
fakeRender: (component: ComponentType, props: any) => {
|
fakeRender: (component: ComponentType, props: any) => {
|
||||||
const prevWin = fakeRenderWin?.deref();
|
const prevWin = fakeRenderWin?.deref();
|
||||||
const win = prevWin?.closed === false
|
const win = prevWin?.closed === false
|
||||||
|
|
5
src/plugins/copyFileContents/README.md
Normal file
5
src/plugins/copyFileContents/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# CopyFileContents
|
||||||
|
|
||||||
|
Adds a button to text file attachments to copy their contents.
|
||||||
|
|
||||||
|
![](https://github.com/user-attachments/assets/b1a0f6f4-106f-4953-94d9-4c5ef5810bca)
|
60
src/plugins/copyFileContents/index.tsx
Normal file
60
src/plugins/copyFileContents/index.tsx
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import "./style.css";
|
||||||
|
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { CopyIcon, NoEntrySignIcon } from "@components/Icons";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import { copyWithToast } from "@utils/misc";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
import { Tooltip, useState } from "@webpack/common";
|
||||||
|
|
||||||
|
const CheckMarkIcon = () => {
|
||||||
|
return <svg width="24" height="24" viewBox="0 0 24 24">
|
||||||
|
<path fill="currentColor" d="M21.7 5.3a1 1 0 0 1 0 1.4l-12 12a1 1 0 0 1-1.4 0l-6-6a1 1 0 1 1 1.4-1.4L9 16.58l11.3-11.3a1 1 0 0 1 1.4 0Z"></path>
|
||||||
|
</svg>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "CopyFileContents",
|
||||||
|
description: "Adds a button to text file attachments to copy their contents",
|
||||||
|
authors: [Devs.Obsidian, Devs.Nuckyz],
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "#{intl::PREVIEW_BYTES_LEFT}",
|
||||||
|
replacement: {
|
||||||
|
match: /\.footerGap.+?url:\i,fileName:\i,fileSize:\i}\),(?<=fileContents:(\i),bytesLeft:(\i).+?)/g,
|
||||||
|
replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2}),"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
addCopyButton: ErrorBoundary.wrap(({ fileContents, bytesLeft }: { fileContents: string, bytesLeft: number; }) => {
|
||||||
|
const [recentlyCopied, setRecentlyCopied] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip text={recentlyCopied ? "Copied!" : bytesLeft > 0 ? "File too large to copy" : "Copy File Contents"}>
|
||||||
|
{tooltipProps => (
|
||||||
|
<div
|
||||||
|
{...tooltipProps}
|
||||||
|
className="vc-cfc-button"
|
||||||
|
role="button"
|
||||||
|
onClick={() => {
|
||||||
|
if (!recentlyCopied && bytesLeft <= 0) {
|
||||||
|
copyWithToast(fileContents);
|
||||||
|
setRecentlyCopied(true);
|
||||||
|
setTimeout(() => setRecentlyCopied(false), 2000);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{recentlyCopied ? <CheckMarkIcon /> : bytesLeft > 0 ? <NoEntrySignIcon color="var(--channel-icon)" /> : <CopyIcon />}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}, { noop: true }),
|
||||||
|
});
|
9
src/plugins/copyFileContents/style.css
Normal file
9
src/plugins/copyFileContents/style.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
.vc-cfc-button {
|
||||||
|
color: var(--interactive-normal);
|
||||||
|
cursor: pointer;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-cfc-button:hover {
|
||||||
|
color: var(--interactive-hover);
|
||||||
|
}
|
|
@ -67,7 +67,7 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".Messages.ERRORS_UNEXPECTED_CRASH",
|
find: "#{intl::ERRORS_UNEXPECTED_CRASH}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /this\.setState\((.+?)\)/,
|
match: /this\.setState\((.+?)\)/,
|
||||||
replace: "$self.handleCrash(this,$1);"
|
replace: "$self.handleCrash(this,$1);"
|
||||||
|
@ -175,7 +175,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
if (settings.store.attemptToNavigateToHome) {
|
if (settings.store.attemptToNavigateToHome) {
|
||||||
try {
|
try {
|
||||||
NavigationRouter.transitionTo("/channels/@me");
|
NavigationRouter.transitionToGuild("@me");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
CrashHandlerLogger.debug("Failed to navigate to home", err);
|
CrashHandlerLogger.debug("Failed to navigate to home", err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,11 @@ import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
import { findByCodeLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common";
|
import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common";
|
||||||
|
|
||||||
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
|
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
|
||||||
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
|
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
|
||||||
const ActivityClassName = findByPropsLazy("activity", "buttonColor");
|
|
||||||
|
|
||||||
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;
|
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;
|
||||||
|
|
||||||
|
@ -436,8 +435,8 @@ export default definePlugin({
|
||||||
|
|
||||||
<Forms.FormDivider className={Margins.top8} />
|
<Forms.FormDivider className={Margins.top8} />
|
||||||
|
|
||||||
<div style={{ width: "284px", ...profileThemeStyle }}>
|
<div style={{ width: "284px", ...profileThemeStyle, padding: 8, marginTop: 8, borderRadius: 8, background: "var(--bg-mod-faint)" }}>
|
||||||
{activity[0] && <ActivityComponent activity={activity[0]} className={ActivityClassName.activity} channelId={SelectedChannelStore.getChannelId()}
|
{activity[0] && <ActivityComponent activity={activity[0]} channelId={SelectedChannelStore.getChannelId()}
|
||||||
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
|
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
|
||||||
application={{ id: settings.store.appID }}
|
application={{ id: settings.store.appID }}
|
||||||
user={UserStore.getCurrentUser()} />}
|
user={UserStore.getCurrentUser()} />}
|
||||||
|
|
|
@ -37,8 +37,8 @@ export default definePlugin({
|
||||||
find: 'type:"IDLE",idle:',
|
find: 'type:"IDLE",idle:',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=Date\.now\(\)-\i>)\i\.\i/,
|
match: /(?<=Date\.now\(\)-\i>)\i\.\i\|\|/,
|
||||||
replace: "$self.getIdleTimeout()"
|
replace: "$self.getIdleTimeout()||"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /Math\.min\((\i\.\i\.getSetting\(\)\*\i\.\i\.\i\.SECOND),\i\.\i\)/,
|
match: /Math\.min\((\i\.\i\.getSetting\(\)\*\i\.\i\.\i\.SECOND),\i\.\i\)/,
|
||||||
|
|
|
@ -46,7 +46,7 @@ const embedUrlRe = /https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/;
|
||||||
async function embedDidMount(this: Component<Props>) {
|
async function embedDidMount(this: Component<Props>) {
|
||||||
try {
|
try {
|
||||||
const { embed } = this.props;
|
const { embed } = this.props;
|
||||||
const { replaceElements } = settings.store;
|
const { replaceElements, dearrowByDefault } = settings.store;
|
||||||
|
|
||||||
if (!embed || embed.dearrow || embed.provider?.name !== "YouTube" || !embed.video?.url) return;
|
if (!embed || embed.dearrow || embed.provider?.name !== "YouTube" || !embed.video?.url) return;
|
||||||
|
|
||||||
|
@ -63,18 +63,22 @@ async function embedDidMount(this: Component<Props>) {
|
||||||
|
|
||||||
if (!hasTitle && !hasThumb) return;
|
if (!hasTitle && !hasThumb) return;
|
||||||
|
|
||||||
|
|
||||||
embed.dearrow = {
|
embed.dearrow = {
|
||||||
enabled: true
|
enabled: dearrowByDefault
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
||||||
embed.dearrow.oldTitle = embed.rawTitle;
|
const replacementTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
||||||
embed.rawTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
embed.dearrow.oldTitle = dearrowByDefault ? embed.rawTitle : replacementTitle;
|
||||||
|
if (dearrowByDefault) embed.rawTitle = replacementTitle;
|
||||||
|
}
|
||||||
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
||||||
embed.dearrow.oldThumb = embed.thumbnail.proxyURL;
|
const replacementProxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
|
||||||
embed.thumbnail.proxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
|
|
||||||
|
embed.dearrow.oldThumb = dearrowByDefault ? embed.thumbnail.proxyURL : replacementProxyURL;
|
||||||
|
if (dearrowByDefault) embed.thumbnail.proxyURL = replacementProxyURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
|
@ -96,6 +100,7 @@ function DearrowButton({ component }: { component: Component<Props>; }) {
|
||||||
className={"vc-dearrow-toggle-" + (embed.dearrow.enabled ? "on" : "off")}
|
className={"vc-dearrow-toggle-" + (embed.dearrow.enabled ? "on" : "off")}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const { enabled, oldThumb, oldTitle } = embed.dearrow;
|
const { enabled, oldThumb, oldTitle } = embed.dearrow;
|
||||||
|
settings.store.dearrowByDefault = !enabled;
|
||||||
embed.dearrow.enabled = !enabled;
|
embed.dearrow.enabled = !enabled;
|
||||||
if (oldTitle) {
|
if (oldTitle) {
|
||||||
embed.dearrow.oldTitle = embed.rawTitle;
|
embed.dearrow.oldTitle = embed.rawTitle;
|
||||||
|
@ -153,6 +158,12 @@ const settings = definePluginSettings({
|
||||||
{ label: "Titles", value: ReplaceElements.ReplaceTitlesOnly },
|
{ label: "Titles", value: ReplaceElements.ReplaceTitlesOnly },
|
||||||
{ label: "Thumbnails", value: ReplaceElements.ReplaceThumbnailsOnly },
|
{ label: "Thumbnails", value: ReplaceElements.ReplaceThumbnailsOnly },
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
dearrowByDefault: {
|
||||||
|
description: "Dearrow videos automatically",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: true,
|
||||||
|
restartNeeded: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "DefaultCustomizationSections",
|
find: "DefaultCustomizationSections",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/,
|
match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/,
|
||||||
replace: "$self.DecorSection(),"
|
replace: "$self.DecorSection(),"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ export default definePlugin({
|
||||||
replace: "$self.DecorationGridItem=$&"
|
replace: "$self.DecorationGridItem=$&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<==)\i=>{let{user:\i,avatarDecoration.{300,600}decorationGridItemChurned/,
|
match: /(?<==)\i=>{let{user:\i,avatarDecoration/,
|
||||||
replace: "$self.DecorationGridDecoration=$&"
|
replace: "$self.DecorationGridDecoration=$&"
|
||||||
},
|
},
|
||||||
// Remove NEW label from decor avatar decorations
|
// Remove NEW label from decor avatar decorations
|
||||||
|
@ -91,7 +91,7 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
// Use Decor avatar decoration hook
|
// Use Decor avatar decoration hook
|
||||||
{
|
{
|
||||||
match: /(?<=\i\)\({avatarDecoration:)(\i).avatarDecoration(?=,)/,
|
match: /(?<=\i\)\({avatarDecoration:)(\i)(?=,)(?<=currentUser:(\i).+?)/,
|
||||||
replace: "$self.useUserDecorAvatarDecoration($1)??$&"
|
replace: "$self.useUserDecorAvatarDecoration($1)??$&"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PlusIcon } from "@components/Icons";
|
import { PlusIcon } from "@components/Icons";
|
||||||
import { i18n, Text } from "@webpack/common";
|
import { getIntlMessage } from "@utils/discord";
|
||||||
|
import { Text } from "@webpack/common";
|
||||||
import { HTMLProps } from "react";
|
import { HTMLProps } from "react";
|
||||||
|
|
||||||
import { DecorationGridItem } from ".";
|
import { DecorationGridItem } from ".";
|
||||||
|
@ -24,7 +25,7 @@ export default function DecorationGridCreate(props: DecorationGridCreateProps) {
|
||||||
variant="text-xs/normal"
|
variant="text-xs/normal"
|
||||||
color="header-primary"
|
color="header-primary"
|
||||||
>
|
>
|
||||||
{i18n.Messages.CREATE}
|
{getIntlMessage("CREATE")}
|
||||||
</Text>
|
</Text>
|
||||||
</DecorationGridItem >;
|
</DecorationGridItem >;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { NoEntrySignIcon } from "@components/Icons";
|
import { NoEntrySignIcon } from "@components/Icons";
|
||||||
import { i18n, Text } from "@webpack/common";
|
import { getIntlMessage } from "@utils/discord";
|
||||||
|
import { Text } from "@webpack/common";
|
||||||
import { HTMLProps } from "react";
|
import { HTMLProps } from "react";
|
||||||
|
|
||||||
import { DecorationGridItem } from ".";
|
import { DecorationGridItem } from ".";
|
||||||
|
@ -24,7 +25,7 @@ export default function DecorationGridNone(props: DecorationGridNoneProps) {
|
||||||
variant="text-xs/normal"
|
variant="text-xs/normal"
|
||||||
color="header-primary"
|
color="header-primary"
|
||||||
>
|
>
|
||||||
{i18n.Messages.NONE}
|
{getIntlMessage("NONE")}
|
||||||
</Text>
|
</Text>
|
||||||
</DecorationGridItem >;
|
</DecorationGridItem >;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Flex } from "@components/Flex";
|
import { Flex } from "@components/Flex";
|
||||||
import { openInviteModal } from "@utils/discord";
|
import { openInviteModal } from "@utils/discord";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes, copyWithToast } from "@utils/misc";
|
||||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||||
import { findComponentByCodeLazy } from "@webpack";
|
import { findComponentByCodeLazy } from "@webpack";
|
||||||
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
|
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
|
||||||
|
@ -45,7 +45,11 @@ interface Section {
|
||||||
authorIds?: string[];
|
authorIds?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
function SectionHeader({ section }: { section: Section; }) {
|
interface SectionHeaderProps {
|
||||||
|
section: Section;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SectionHeader({ section }: SectionHeaderProps) {
|
||||||
const hasSubtitle = typeof section.subtitle !== "undefined";
|
const hasSubtitle = typeof section.subtitle !== "undefined";
|
||||||
const hasAuthorIds = typeof section.authorIds !== "undefined";
|
const hasAuthorIds = typeof section.authorIds !== "undefined";
|
||||||
|
|
||||||
|
@ -62,6 +66,7 @@ function SectionHeader({ section }: { section: Section; }) {
|
||||||
})();
|
})();
|
||||||
}, [section.authorIds]);
|
}, [section.authorIds]);
|
||||||
|
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Forms.FormTitle style={{ flexGrow: 1 }}>{section.title}</Forms.FormTitle>
|
<Forms.FormTitle style={{ flexGrow: 1 }}>{section.title}</Forms.FormTitle>
|
||||||
|
@ -74,8 +79,7 @@ function SectionHeader({ section }: { section: Section; }) {
|
||||||
size={16}
|
size={16}
|
||||||
showUserPopout
|
showUserPopout
|
||||||
className={Margins.bottom8}
|
className={Margins.bottom8}
|
||||||
/>
|
/>}
|
||||||
}
|
|
||||||
</Flex>
|
</Flex>
|
||||||
{hasSubtitle &&
|
{hasSubtitle &&
|
||||||
<Forms.FormText type="description" className={Margins.bottom8}>
|
<Forms.FormText type="description" className={Margins.bottom8}>
|
||||||
|
@ -204,7 +208,16 @@ function ChangeDecorationModal(props: ModalProps) {
|
||||||
{activeSelectedDecoration?.alt}
|
{activeSelectedDecoration?.alt}
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
{activeDecorationHasAuthor && <Text key={`createdBy-${activeSelectedDecoration.authorId}`}>Created by {Parser.parse(`<@${activeSelectedDecoration.authorId}>`)}</Text>}
|
{activeDecorationHasAuthor && (
|
||||||
|
<Text key={`createdBy-${activeSelectedDecoration.authorId}`}>
|
||||||
|
Created by {Parser.parse(`<@${activeSelectedDecoration.authorId}>`)}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
{isActiveDecorationPreset && (
|
||||||
|
<Button onClick={() => copyWithToast(activeDecorationPreset.id)}>
|
||||||
|
Copy Preset ID
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
|
find: "#{intl::BOT_CALL_IDLE_DISCONNECT_2}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
|
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
|
||||||
replace: ";return;"
|
replace: ";return;"
|
||||||
|
|
|
@ -23,12 +23,13 @@ import { ErrorCard } from "@components/ErrorCard";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy, findLazy } from "@webpack";
|
||||||
import { Forms, React } from "@webpack/common";
|
import { Forms, React } from "@webpack/common";
|
||||||
|
|
||||||
import hideBugReport from "./hideBugReport.css?managed";
|
import hideBugReport from "./hideBugReport.css?managed";
|
||||||
|
|
||||||
const KbdStyles = findByPropsLazy("key", "combo");
|
const KbdStyles = findByPropsLazy("key", "combo");
|
||||||
|
const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter");
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
toolbarDevMenu: {
|
toolbarDevMenu: {
|
||||||
|
@ -78,8 +79,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "toolbar:function",
|
find: "toolbar:function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\i\.isStaff\(\)/,
|
match: /hasBugReporterAccess:(\i)/,
|
||||||
replace: "true"
|
replace: "_hasBugReporterAccess:$1=true"
|
||||||
},
|
},
|
||||||
predicate: () => settings.store.toolbarDevMenu
|
predicate: () => settings.store.toolbarDevMenu
|
||||||
},
|
},
|
||||||
|
@ -91,10 +92,18 @@ export default definePlugin({
|
||||||
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
||||||
replace: "false",
|
replace: "false",
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// enable option to always record clips even if you are not streaming
|
||||||
|
{
|
||||||
|
find: "isDecoupledGameClippingEnabled(){",
|
||||||
|
replacement: {
|
||||||
|
match: /\i\.isStaff\(\)/,
|
||||||
|
replace: "true"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
start: () => enableStyle(hideBugReport),
|
start: () => !BugReporterExperiment.getCurrentConfig().hasBugReporterAccess && enableStyle(hideBugReport),
|
||||||
stop: () => disableStyle(hideBugReport),
|
stop: () => disableStyle(hideBugReport),
|
||||||
|
|
||||||
settingsAboutComponent: () => {
|
settingsAboutComponent: () => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
|
||||||
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
|
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
|
||||||
import { getCurrentGuild } from "@utils/discord";
|
import { getCurrentGuild } from "@utils/discord";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType, Patch } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
||||||
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||||
import type { Emoji } from "@webpack/types";
|
import type { Emoji } from "@webpack/types";
|
||||||
|
@ -194,6 +194,26 @@ const hasExternalStickerPerms = (channelId: string) => hasPermission(channelId,
|
||||||
const hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS);
|
const hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS);
|
||||||
const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES);
|
const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES);
|
||||||
|
|
||||||
|
function makeBypassPatches(): Omit<Patch, "plugin"> {
|
||||||
|
const mapping: Array<{ func: string, predicate?: () => boolean; }> = [
|
||||||
|
{ func: "canUseCustomStickersEverywhere", predicate: () => settings.store.enableStickerBypass },
|
||||||
|
{ func: "canUseHighVideoUploadQuality", predicate: () => settings.store.enableStreamQualityBypass },
|
||||||
|
{ func: "canStreamQuality", predicate: () => settings.store.enableStreamQualityBypass },
|
||||||
|
{ func: "canUseClientThemes" },
|
||||||
|
{ func: "canUseCustomNotificationSounds" },
|
||||||
|
{ func: "canUsePremiumAppIcons" }
|
||||||
|
];
|
||||||
|
|
||||||
|
return {
|
||||||
|
find: "canUseCustomStickersEverywhere:",
|
||||||
|
replacement: mapping.map(({ func, predicate }) => ({
|
||||||
|
match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`),
|
||||||
|
replace: "return true;",
|
||||||
|
predicate
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FakeNitro",
|
name: "FakeNitro",
|
||||||
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],
|
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],
|
||||||
|
@ -203,6 +223,17 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
// General bypass patches
|
||||||
|
makeBypassPatches(),
|
||||||
|
// Patch the emoji picker in voice calls to not be bypassed by fake nitro
|
||||||
|
{
|
||||||
|
find: "emojiItemDisabled]",
|
||||||
|
predicate: () => settings.store.enableEmojiBypass,
|
||||||
|
replacement: {
|
||||||
|
match: /CHAT/,
|
||||||
|
replace: "STATUS"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
find: ".PREMIUM_LOCKED;",
|
find: ".PREMIUM_LOCKED;",
|
||||||
group: true,
|
group: true,
|
||||||
|
@ -243,15 +274,6 @@ export default definePlugin({
|
||||||
replace: (_, rest1, rest2) => `${rest1},fakeNitroOriginal){if(!fakeNitroOriginal)return false;${rest2}`
|
replace: (_, rest1, rest2) => `${rest1},fakeNitroOriginal){if(!fakeNitroOriginal)return false;${rest2}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Allow stickers to be sent everywhere
|
|
||||||
{
|
|
||||||
find: "canUseCustomStickersEverywhere:function",
|
|
||||||
predicate: () => settings.store.enableStickerBypass,
|
|
||||||
replacement: {
|
|
||||||
match: /canUseCustomStickersEverywhere:function\(\i\){/,
|
|
||||||
replace: "$&return true;"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// Make stickers always available
|
// Make stickers always available
|
||||||
{
|
{
|
||||||
find: '"SENDABLE"',
|
find: '"SENDABLE"',
|
||||||
|
@ -261,37 +283,15 @@ export default definePlugin({
|
||||||
replace: "true?"
|
replace: "true?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Allow streaming with high quality
|
|
||||||
{
|
|
||||||
find: "canUseHighVideoUploadQuality:function",
|
|
||||||
predicate: () => settings.store.enableStreamQualityBypass,
|
|
||||||
replacement: [
|
|
||||||
"canUseHighVideoUploadQuality",
|
|
||||||
"canStreamQuality",
|
|
||||||
].map(func => {
|
|
||||||
return {
|
|
||||||
match: new RegExp(`${func}:function\\(\\i(?:,\\i)?\\){`, "g"),
|
|
||||||
replace: "$&return true;"
|
|
||||||
};
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// Remove boost requirements to stream with high quality
|
// Remove boost requirements to stream with high quality
|
||||||
{
|
{
|
||||||
find: "STREAM_FPS_OPTION.format",
|
find: "#{intl::STREAM_FPS_OPTION}",
|
||||||
predicate: () => settings.store.enableStreamQualityBypass,
|
predicate: () => settings.store.enableStreamQualityBypass,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /guildPremiumTier:\i\.\i\.TIER_\d,?/g,
|
match: /guildPremiumTier:\i\.\i\.TIER_\d,?/g,
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Allow client themes to be changeable
|
|
||||||
{
|
|
||||||
find: "canUseClientThemes:function",
|
|
||||||
replacement: {
|
|
||||||
match: /canUseClientThemes:function\(\i\){/,
|
|
||||||
replace: "$&return true;"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
find: '"UserSettingsProtoStore"',
|
find: '"UserSettingsProtoStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
|
@ -350,13 +350,13 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Filter attachments to remove fake nitro stickers or emojis
|
// Filter attachments to remove fake nitro stickers or emojis
|
||||||
predicate: () => settings.store.transformStickers,
|
predicate: () => settings.store.transformStickers,
|
||||||
match: /renderAttachments\(\i\){let{attachments:(\i).+?;/,
|
match: /renderAttachments\(\i\){.+?{attachments:(\i).+?;/,
|
||||||
replace: (m, attachments) => `${m}${attachments}=$self.filterAttachments(${attachments});`
|
replace: (m, attachments) => `${m}${attachments}=$self.filterAttachments(${attachments});`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".Messages.STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION.format",
|
find: "#{intl::STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION}",
|
||||||
predicate: () => settings.store.transformStickers,
|
predicate: () => settings.store.transformStickers,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".Messages.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION",
|
find: "#{intl::EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION}",
|
||||||
predicate: () => settings.store.transformEmojis,
|
predicate: () => settings.store.transformEmojis,
|
||||||
replacement: {
|
replacement: {
|
||||||
// Add the fake nitro emoji notice
|
// Add the fake nitro emoji notice
|
||||||
|
@ -389,14 +389,6 @@ export default definePlugin({
|
||||||
replace: (_, reactNode, props) => `$self.addFakeNotice(${FakeNoticeType.Emoji},${reactNode},!!${props}?.fakeNitroNode?.fake)`
|
replace: (_, reactNode, props) => `$self.addFakeNotice(${FakeNoticeType.Emoji},${reactNode},!!${props}?.fakeNitroNode?.fake)`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Allow using custom app icons
|
|
||||||
{
|
|
||||||
find: "canUsePremiumAppIcons:function",
|
|
||||||
replacement: {
|
|
||||||
match: /canUsePremiumAppIcons:function\(\i\){/,
|
|
||||||
replace: "$&return true;"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Separate patch for allowing using custom app icons
|
// Separate patch for allowing using custom app icons
|
||||||
{
|
{
|
||||||
find: /\.getCurrentDesktopIcon.{0,25}\.isPremium/,
|
find: /\.getCurrentDesktopIcon.{0,25}\.isPremium/,
|
||||||
|
@ -412,14 +404,6 @@ export default definePlugin({
|
||||||
match: /(?<=type:"(?:SOUNDBOARD_SOUNDS_RECEIVED|GUILD_SOUNDBOARD_SOUND_CREATE|GUILD_SOUNDBOARD_SOUND_UPDATE|GUILD_SOUNDBOARD_SOUNDS_UPDATE)".+?available:)\i\.available/g,
|
match: /(?<=type:"(?:SOUNDBOARD_SOUNDS_RECEIVED|GUILD_SOUNDBOARD_SOUND_CREATE|GUILD_SOUNDBOARD_SOUND_UPDATE|GUILD_SOUNDBOARD_SOUNDS_UPDATE)".+?available:)\i\.available/g,
|
||||||
replace: "true"
|
replace: "true"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// Allow using custom notification sounds
|
|
||||||
{
|
|
||||||
find: "canUseCustomNotificationSounds:function",
|
|
||||||
replacement: {
|
|
||||||
match: /canUseCustomNotificationSounds:function\(\i\){/,
|
|
||||||
replace: "$&return true;"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue