Compare commits

..

22 Commits

Author SHA1 Message Date
Vendicated
79b35d5797 initial custom plugin loading 2023-04-20 01:19:13 +02:00
V
62194674eb Delete highResAvatars.ts 2023-04-20 00:45:24 +02:00
V
04da98498f Restore src/Vencord.ts 2023-04-20 00:44:48 +02:00
Vendicated
6fa0fb017b more additions for external plugins 2023-04-20 00:41:02 +02:00
Vendicated
11ecc45b71 more fixes 2023-04-19 23:12:39 +02:00
Vendicated
82cd8d98f6 convert import aliases 2023-04-19 23:08:07 +02:00
Vendicated
c815f1c5f3 Run autofix to sort these imports! 2023-04-19 22:59:57 +02:00
Vendicated
e248f58d9f stuffs 3 2023-04-19 22:37:58 +02:00
Vendicated
3171b78a36 stuffs 2 2023-04-19 21:49:12 +02:00
Vendicated
525aa3af33 stuffs 2023-04-19 21:36:17 +02:00
Vendicated
b7299ea2cc npm types package 2023-04-19 20:18:42 +02:00
Vendicated
8dd70f5d1a Fix inserting text when markdown preview is off 2023-04-18 23:13:10 +02:00
Amsyar Rasyiq
8be6c6e3ce fix(ReviewDB): fix margin in self-profile preview (#935)
Co-authored-by: V <vendicated@riseup.net>
2023-04-18 18:53:11 +02:00
V
7e96b5dcfb RelationShipNotifier: Support multiple users (#944) 2023-04-18 16:52:46 +00:00
Đỗ Văn Hoài Tuân
99a7d78e9b [skip ci] USRBG: Update README link to a more accurate one (#943) 2023-04-18 16:04:17 +02:00
Nuckyz
e70d00d008 BadgesAPI: Don't depend on getBadges module not being undefined (#942) 2023-04-18 05:25:14 +00:00
Nuckyz
c0ac6a4b86 SilentMessageToggle: Option to persist state (#941) 2023-04-18 04:54:21 +00:00
Vendicated
29749e93c7 CI Reporter fixes 2023-04-18 02:54:22 +02:00
Vendicated
993c6be219 Fix badges 2023-04-18 02:47:48 +02:00
Đỗ Văn Hoài Tuân
e2e1cf2bfd feat(plugin): USRBG (#844)
Co-authored-by: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com>
Co-authored-by: Vendicated <vendicated@riseup.net>
2023-04-18 00:18:18 +02:00
Vendicated
59e3c2c609 ci: fix cding into wrong folder 2023-04-17 04:09:20 +02:00
Nuckyz
43d7ca4c30 Make chat bar buttons have a consistent size (#927)
Co-authored-by: V <vendicated@riseup.net>
2023-04-17 02:09:11 +00:00
39 changed files with 653 additions and 161 deletions

View File

@ -43,7 +43,7 @@ jobs:
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish || EXIT_CODE=$?
# Firefox
cd ../chromium-unpacked
cd ../firefox-unpacked
npm i -g web-ext@7.4.0 web-ext-submit@7.4.0
web-ext-submit || EXIT_CODE=$?

View File

@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
"version": "1.1.8",
"version": "1.1.9",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
@ -28,7 +28,8 @@
"testWeb": "pnpm lint && pnpm buildWeb && pnpm testTsc",
"testTsc": "tsc --noEmit",
"uninject": "node scripts/runInstaller.mjs",
"watch": "node scripts/build/build.mjs --watch"
"watch": "node scripts/build/build.mjs --watch",
"buildTypes": "ttsc --emitDeclarationOnly --declaration --outDir packages/vencord-types"
},
"dependencies": {
"@vap/core": "0.0.12",
@ -62,8 +63,10 @@
"stylelint": "^14.16.1",
"stylelint-config-standard": "^29.0.0",
"tsx": "^3.12.6",
"ttypescript": "^1.5.15",
"type-fest": "^3.5.3",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"typescript-transform-paths": "^3.4.6"
},
"packageManager": "pnpm@8.1.1",
"pnpm": {

7
packages/vencord-types/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
*
!.*ignore
!package.json
!README.md
!prepare.ts
!index.d.ts
!globals.d.ts

View File

@ -0,0 +1,3 @@
node_modules
prepare.ts
.gitignore

View File

@ -0,0 +1,11 @@
# Vencord Types
Typings for Vencord's api, published to npm
```sh
npm i @vencord/types
yarn add @vencord/types
pnpm add @vencord/types
```

24
packages/vencord-types/globals.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare global {
export var VencordNative: typeof import("./VencordNative").default;
export var Vencord: typeof import("./Vencord");
}
export { };

5
packages/vencord-types/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/* eslint-disable */
/// <reference path="Vencord.d.ts" />
/// <reference path="globals.d.ts" />
/// <reference path="modules.d.ts" />

View File

@ -0,0 +1,26 @@
{
"name": "@vencord/types",
"private": false,
"version": "0.1.3",
"description": "",
"types": "index.d.ts",
"scripts": {
"prepublishOnly": "tsx ./prepare.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Vencord",
"license": "GPL-3.0",
"devDependencies": {
"tsx": "^3.12.6"
},
"dependencies": {
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.18",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"discord-types": "^1.3.26",
"standalone-electron-types": "^1.0.0",
"type-fest": "^3.5.3"
}
}

View File

@ -0,0 +1,44 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { cpSync, readdirSync, rmSync } from "fs";
import { join } from "path";
const SRC = join(__dirname, "..", "..", "src");
for (const file of ["preload.d.ts", "userplugins", "main", "debug"]) {
rmSync(join(__dirname, file), { recursive: true, force: true });
}
function copyDtsFiles(from: string, to: string) {
for (const file of readdirSync(from, { withFileTypes: true })) {
// bad
if (from === SRC && file.name === "globals.d.ts") continue;
const fullFrom = join(from, file.name);
const fullTo = join(to, file.name);
if (file.isDirectory()) {
copyDtsFiles(fullFrom, fullTo);
} else if (file.name.endsWith(".d.ts")) {
cpSync(fullFrom, fullTo);
}
}
}
copyDtsFiles(SRC, __dirname);

358
pnpm-lock.yaml generated
View File

@ -8,102 +8,138 @@ patchedDependencies:
hash: 7wc6icvgtg3uswirb5tpsbjnbe
path: patches/eslint@8.28.0.patch
dependencies:
'@vap/core':
specifier: 0.0.12
version: 0.0.12
'@vap/shiki':
specifier: 0.10.3
version: 0.10.3
fflate:
specifier: ^0.7.4
version: 0.7.4
nanoid:
specifier: ^4.0.2
version: 4.0.2
virtual-merge:
specifier: ^1.0.1
version: 1.0.1
importers:
devDependencies:
'@types/diff':
specifier: ^5.0.2
version: 5.0.2
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
'@types/yazl':
specifier: ^2.4.2
version: 2.4.2
'@typescript-eslint/eslint-plugin':
specifier: ^5.49.0
version: 5.49.0(@typescript-eslint/parser@5.49.0)(eslint@8.28.0)(typescript@4.9.4)
'@typescript-eslint/parser':
specifier: ^5.49.0
version: 5.49.0(eslint@8.28.0)(typescript@4.9.4)
diff:
specifier: ^5.1.0
version: 5.1.0
discord-types:
specifier: ^1.3.26
version: 1.3.26
esbuild:
specifier: ^0.15.18
version: 0.15.18
eslint:
specifier: ^8.28.0
version: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe)
eslint-import-resolver-alias:
specifier: ^1.1.2
version: 1.1.2
eslint-plugin-header:
specifier: ^3.1.1
version: 3.1.1(eslint@8.28.0)
eslint-plugin-path-alias:
specifier: ^1.0.0
version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0)
eslint-plugin-simple-import-sort:
specifier: ^8.0.0
version: 8.0.0(eslint@8.28.0)
eslint-plugin-unused-imports:
specifier: ^2.0.0
version: 2.0.0(@typescript-eslint/eslint-plugin@5.49.0)(eslint@8.28.0)
highlight.js:
specifier: 10.6.0
version: 10.6.0
moment:
specifier: ^2.29.4
version: 2.29.4
puppeteer-core:
specifier: ^19.6.0
version: 19.6.0
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
stylelint:
specifier: ^14.16.1
version: 14.16.1
stylelint-config-standard:
specifier: ^29.0.0
version: 29.0.0(stylelint@14.16.1)
tsx:
specifier: ^3.12.6
version: 3.12.6
type-fest:
specifier: ^3.5.3
version: 3.5.3
typescript:
specifier: ^4.9.4
version: 4.9.4
.:
dependencies:
'@vap/core':
specifier: 0.0.12
version: 0.0.12
'@vap/shiki':
specifier: 0.10.3
version: 0.10.3
fflate:
specifier: ^0.7.4
version: 0.7.4
nanoid:
specifier: ^4.0.2
version: 4.0.2
virtual-merge:
specifier: ^1.0.1
version: 1.0.1
devDependencies:
'@types/diff':
specifier: ^5.0.2
version: 5.0.2
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
'@types/yazl':
specifier: ^2.4.2
version: 2.4.2
'@typescript-eslint/eslint-plugin':
specifier: ^5.49.0
version: 5.49.0(@typescript-eslint/parser@5.49.0)(eslint@8.28.0)(typescript@4.9.4)
'@typescript-eslint/parser':
specifier: ^5.49.0
version: 5.49.0(eslint@8.28.0)(typescript@4.9.4)
diff:
specifier: ^5.1.0
version: 5.1.0
discord-types:
specifier: ^1.3.26
version: 1.3.26
esbuild:
specifier: ^0.15.18
version: 0.15.18
eslint:
specifier: ^8.28.0
version: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe)
eslint-import-resolver-alias:
specifier: ^1.1.2
version: 1.1.2
eslint-plugin-header:
specifier: ^3.1.1
version: 3.1.1(eslint@8.28.0)
eslint-plugin-path-alias:
specifier: ^1.0.0
version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0)
eslint-plugin-simple-import-sort:
specifier: ^8.0.0
version: 8.0.0(eslint@8.28.0)
eslint-plugin-unused-imports:
specifier: ^2.0.0
version: 2.0.0(@typescript-eslint/eslint-plugin@5.49.0)(eslint@8.28.0)
highlight.js:
specifier: 10.6.0
version: 10.6.0
moment:
specifier: ^2.29.4
version: 2.29.4
puppeteer-core:
specifier: ^19.6.0
version: 19.6.0
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
stylelint:
specifier: ^14.16.1
version: 14.16.1
stylelint-config-standard:
specifier: ^29.0.0
version: 29.0.0(stylelint@14.16.1)
tsx:
specifier: ^3.12.6
version: 3.12.6
ttypescript:
specifier: ^1.5.15
version: 1.5.15(ts-node@10.9.1)(typescript@4.9.4)
type-fest:
specifier: ^3.5.3
version: 3.5.3
typescript:
specifier: ^4.9.4
version: 4.9.4
typescript-transform-paths:
specifier: ^3.4.6
version: 3.4.6(typescript@4.9.4)
packages/vencord-types:
dependencies:
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
discord-types:
specifier: ^1.3.26
version: 1.3.26
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
type-fest:
specifier: ^3.5.3
version: 3.5.3
devDependencies:
tsx:
specifier: ^3.12.6
version: 3.12.6
packages:
@ -128,6 +164,13 @@ packages:
js-tokens: 4.0.0
dev: true
/@cspotcode/source-map-support@0.8.1:
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
dependencies:
'@jridgewell/trace-mapping': 0.3.9
dev: true
/@csstools/selector-specificity@2.1.1(postcss-selector-parser@6.0.11)(postcss@8.4.21):
resolution: {integrity: sha512-jwx+WCqszn53YHOfvFMJJRd/B2GqkCBt+1MJSG6o5/s8+ytHMvDZXsJgUEWLk12UnLd7HYKac4BYU5i/Ron1Cw==}
engines: {node: ^14 || ^16 || >=18}
@ -413,6 +456,22 @@ packages:
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
dev: true
/@jridgewell/resolve-uri@3.1.1:
resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==}
engines: {node: '>=6.0.0'}
dev: true
/@jridgewell/sourcemap-codec@1.4.15:
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
dev: true
/@jridgewell/trace-mapping@0.3.9:
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
dependencies:
'@jridgewell/resolve-uri': 3.1.1
'@jridgewell/sourcemap-codec': 1.4.15
dev: true
/@nodelib/fs.scandir@2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@ -434,6 +493,22 @@ packages:
fastq: 1.13.0
dev: true
/@tsconfig/node10@1.0.9:
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
dev: true
/@tsconfig/node12@1.0.11:
resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==}
dev: true
/@tsconfig/node14@1.0.3:
resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==}
dev: true
/@tsconfig/node16@1.0.3:
resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==}
dev: true
/@types/diff@5.0.2:
resolution: {integrity: sha512-uw8eYMIReOwstQ0QKF0sICefSy8cNO/v7gOTiIy9SbwuHyEecJUm7qlgueOO5S1udZ5I/irVydHVwMchgzbKTg==}
dev: true
@ -444,7 +519,6 @@ packages:
/@types/lodash@4.14.191:
resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==}
dev: true
/@types/minimist@1.2.2:
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
@ -452,7 +526,6 @@ packages:
/@types/node@18.11.18:
resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==}
dev: true
/@types/normalize-package-data@2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@ -464,20 +537,17 @@ packages:
/@types/prop-types@15.7.5:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
dev: true
/@types/react-dom@18.0.10:
resolution: {integrity: sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==}
dependencies:
'@types/react': 18.0.27
dev: true
/@types/react@17.0.2:
resolution: {integrity: sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==}
dependencies:
'@types/prop-types': 15.7.5
csstype: 3.1.0
dev: true
/@types/react@18.0.27:
resolution: {integrity: sha512-3vtRKHgVxu3Jp9t718R9BuzoD4NcQ8YJ5XRzsSKxNDiDonD2MXIT1TmSkenxuCycZJoQT5d2vE8LwWJxBC1gmA==}
@ -485,11 +555,9 @@ packages:
'@types/prop-types': 15.7.5
'@types/scheduler': 0.16.2
csstype: 3.1.0
dev: true
/@types/scheduler@0.16.2:
resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==}
dev: true
/@types/semver@7.3.13:
resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
@ -669,6 +737,11 @@ packages:
acorn: 8.8.0
dev: true
/acorn-walk@8.2.0:
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
engines: {node: '>=0.4.0'}
dev: true
/acorn@8.8.0:
resolution: {integrity: sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==}
engines: {node: '>=0.4.0'}
@ -721,6 +794,10 @@ packages:
color-convert: 2.0.1
dev: true
/arg@4.1.3:
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
dev: true
/argparse@2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
dev: true
@ -950,6 +1027,10 @@ packages:
yaml: 1.10.2
dev: true
/create-require@1.1.1:
resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
dev: true
/cross-fetch@3.1.5:
resolution: {integrity: sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==}
dependencies:
@ -980,7 +1061,6 @@ packages:
/csstype@3.1.0:
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
dev: true
/debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
@ -1053,6 +1133,11 @@ packages:
resolution: {integrity: sha512-RqoZ2GmqaNxyx+99L/RemY5CkwG9D0WEfOKxekwCRXOGrDCep62ngezEJUVMq6rISYQ+085fJnWDQqGHlxVNww==}
dev: true
/diff@4.0.2:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
dev: true
/diff@5.1.0:
resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==}
engines: {node: '>=0.3.1'}
@ -1070,7 +1155,6 @@ packages:
dependencies:
'@types/react': 17.0.2
moment: 2.29.4
dev: true
/doctrine@3.0.0:
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
@ -2171,6 +2255,10 @@ packages:
yallist: 4.0.0
dev: true
/make-error@1.3.6:
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
dev: true
/map-cache@0.2.2:
resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==}
engines: {node: '>=0.10.0'}
@ -2262,7 +2350,6 @@ packages:
/moment@2.29.4:
resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
dev: true
/ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
@ -2828,7 +2915,6 @@ packages:
resolution: {integrity: sha512-0HOi/tlTz3mjWhsAz4uRbpQcHMZ+ifj1JzWW9nugykOHClBBG77ps8QinrzX1eow4Iw2pnC+RFaSYRgufF4BOg==}
dependencies:
'@types/node': 18.11.18
dev: true
/static-extend@0.1.2:
resolution: {integrity: sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g==}
@ -3043,6 +3129,37 @@ packages:
engines: {node: '>=8'}
dev: true
/ts-node@10.9.1(@types/node@18.11.18)(typescript@4.9.4):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
peerDependencies:
'@swc/core': '>=1.2.50'
'@swc/wasm': '>=1.2.50'
'@types/node': '*'
typescript: '>=2.7'
peerDependenciesMeta:
'@swc/core':
optional: true
'@swc/wasm':
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.9
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.3
'@types/node': 18.11.18
acorn: 8.8.0
acorn-walk: 8.2.0
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 4.9.4
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: true
/tslib@1.14.1:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true
@ -3068,6 +3185,18 @@ packages:
fsevents: 2.3.2
dev: true
/ttypescript@1.5.15(ts-node@10.9.1)(typescript@4.9.4):
resolution: {integrity: sha512-48ykDNHzFnPMnv4hYX1P8Q84TvCZyL1QlFxeuxsuZ48X2+ameBgPenvmCkHJtoOSxpoWTWi8NcgNrRnVDOmfSg==}
hasBin: true
peerDependencies:
ts-node: '>=8.0.2'
typescript: '>=3.2.2'
dependencies:
resolve: 1.22.1
ts-node: 10.9.1(@types/node@18.11.18)(typescript@4.9.4)
typescript: 4.9.4
dev: true
/type-check@0.4.0:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@ -3098,6 +3227,14 @@ packages:
/type-fest@3.5.3:
resolution: {integrity: sha512-V2+og4j/rWReWvaFrse3s9g2xvUv/K9Azm/xo6CjIuq7oeGqsoimC7+9/A3tfvNcbQf8RPSVj/HV81fB4DJrjA==}
engines: {node: '>=14.16'}
/typescript-transform-paths@3.4.6(typescript@4.9.4):
resolution: {integrity: sha512-qdgpCk9oRHkIBhznxaHAapCFapJt5e4FbFik7Y4qdqtp6VyC3smAIPoDEIkjZ2eiF7x5+QxUPYNwJAtw0thsTw==}
peerDependencies:
typescript: '>=3.6.5'
dependencies:
minimatch: 3.1.2
typescript: 4.9.4
dev: true
/typescript@4.9.4:
@ -3151,6 +3288,10 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true
/v8-compile-cache-lib@3.0.1:
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
dev: true
/v8-compile-cache@2.3.0:
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
dev: true
@ -3251,6 +3392,11 @@ packages:
fd-slicer: 1.1.0
dev: true
/yn@3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'}
dev: true
/yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}

2
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,2 @@
packages:
- packages/*

View File

@ -76,7 +76,7 @@ await Promise.all([
outfile: "dist/renderer.js",
format: "iife",
target: ["esnext"],
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
footer: { js: "Vencord.Plugins.loadExternalPlugins();\n//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
globalName: "Vencord",
sourcemap,
plugins: [
@ -110,7 +110,7 @@ await Promise.all([
outfile: "dist/vencordDesktopRenderer.js",
format: "iife",
target: ["esnext"],
footer: { js: "//# sourceURL=VencordDesktopRenderer\n" + sourceMapFooter("vencordDesktopRenderer") },
footer: { js: "Vencord.Plugins.loadExternalPlugins();\n//# sourceURL=VencordDesktopRenderer\n" + sourceMapFooter("vencordDesktopRenderer") },
globalName: "Vencord",
sourcemap,
plugins: [

View File

@ -186,7 +186,16 @@ page.on("console", async e => {
} else if (isDebug) {
console.error(e.text());
} else if (level === "error") {
const text = e.text();
const text = await Promise.all(
e.args().map(async a => {
try {
return await maybeGetError(a) || await a.jsonValue();
} catch (e) {
return a.toString();
}
})
).then(a => a.join(" "));
if (!text.startsWith("Failed to load resource: the server responded with a status of")) {
console.error("Got unexpected error", text);
report.otherErrors.push(text);
@ -258,7 +267,7 @@ function runTime(token: string) {
if (!isWasm)
await wreq.e(id as any);
await new Promise(r => setTimeout(r, 100));
await new Promise(r => setTimeout(r, 500));
}
console.error("[PUP_DEBUG]", "Finished loading chunks!");

View File

@ -28,6 +28,7 @@ import * as $MessagePopover from "./MessagePopover";
import * as $Notices from "./Notices";
import * as $Notifications from "./Notifications";
import * as $ServerList from "./ServerList";
import * as $Settings from "./settings";
import * as $SettingsStore from "./SettingsStore";
import * as $Styles from "./Styles";
@ -104,3 +105,9 @@ export const Notifications = $Notifications;
* An api allowing you to patch and add/remove items to/from context menus
*/
export const ContextMenu = $ContextMenu;
/**
* Settings lol
*/
export const Settings = $Settings;
export const settings = $Settings;

View File

@ -16,6 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export { default as ErrorBoundary } from "./ErrorBoundary";
export * from "./ErrorCard";
export * from "./Flex";
export * from "./Heart";
export * from "./Link";
export { default as PatchHelper } from "./PatchHelper";
export { default as PluginSettings } from "./PluginSettings";
export * from "./Switch";
export { default as VencordSettings } from "./VencordSettings";

View File

@ -22,13 +22,13 @@ import { debounce } from "@utils/debounce";
import IpcEvents from "@utils/IpcEvents";
import { Queue } from "@utils/Queue";
import { BrowserWindow, ipcMain, shell } from "electron";
import { mkdirSync, readFileSync, watch } from "fs";
import { mkdirSync, readdirSync, readFileSync, watch } from "fs";
import { open, readFile, writeFile } from "fs/promises";
import { join } from "path";
import monacoHtml from "~fileContent/../components/monacoWin.html;base64";
import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE } from "./utils/constants";
import { ALLOWED_PROTOCOLS, PLUGINS_DIR, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE } from "./utils/constants";
mkdirSync(SETTINGS_DIR, { recursive: true });
@ -105,3 +105,15 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
});
await win.loadURL(`data:text/html;base64,${monacoHtml}`);
});
ipcMain.on(IpcEvents.GET_PLUGINS, e => {
try {
const files = readdirSync(PLUGINS_DIR).filter(f => f.endsWith(".js"));
console.log(files);
e.returnValue = files.map(f => [f, readFileSync(join(PLUGINS_DIR, f), "utf-8")]);
} catch (err) {
console.error(err);
e.returnValue = [];
}
});

View File

@ -25,6 +25,7 @@ export const DATA_DIR = process.env.VENCORD_USER_DATA_DIR ?? (
: join(app.getPath("userData"), "..", "Vencord")
);
export const SETTINGS_DIR = join(DATA_DIR, "settings");
export const PLUGINS_DIR = join(DATA_DIR, "plugins");
export const QUICKCSS_PATH = join(SETTINGS_DIR, "quickCss.css");
export const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json");
export const ALLOWED_PROTOCOLS = [

2
src/modules.d.ts vendored
View File

@ -20,7 +20,7 @@
/// <reference types="standalone-electron-types"/>
declare module "~plugins" {
const plugins: Record<string, import("@utils/types").Plugin>;
const plugins: Record<string, import("./utils/types").Plugin>;
export default plugins;
}

View File

@ -56,21 +56,17 @@ export default definePlugin({
authors: [Devs.Megu, Devs.Ven, Devs.TheSun],
required: true,
patches: [
/* Patch the badges array */
{
find: "Messages.ACTIVE_DEVELOPER_BADGE_TOOLTIP",
replacement: {
match: /(?<=void 0:)\i.getBadges\(\)/,
replace: "Vencord.Api.Badges._getBadges(arguments[0]).concat($&??[])",
}
},
/* Patch the badge list component on user profiles */
{
find: "Messages.PROFILE_USER_BADGES,role:",
replacement: [
{
match: /null==\i\?void 0:(\i)\.getBadges\(\)/,
replace: (_, badgesMod) => `Vencord.Api.Badges._getBadges(arguments[0]).concat(${badgesMod}?.getBadges()??[])`,
},
{
// alt: "", aria-hidden: false, src: originalSrc
match: /alt:" ","aria-hidden":!0,src:(?=.{0,10}\b(\i)\.(?:icon|key))/g,
match: /alt:" ","aria-hidden":!0,src:(?=(\i)\.src)/g,
// ...badge.props, ..., src: badge.image ?? ...
replace: "...$1.props,$& $1.image??"
},

View File

@ -17,9 +17,9 @@
*/
import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types";
import { filters, mapMangledModuleLazy } from "@webpack";
import { ComponentDispatch } from "@webpack/common";
const ExpressionPickerState = mapMangledModuleLazy('name:"expression-picker-last-active-view"', {
close: filters.byCode("activeView:null", "setState")
@ -40,7 +40,7 @@ export default definePlugin({
handleSelect(gif?: { url: string; }) {
if (gif) {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: gif.url + " " });
insertTextIntoChatInputBox(gif.url + " ");
ExpressionPickerState.close();
}
}

View File

@ -18,6 +18,7 @@
import { registerCommand, unregisterCommand } from "@api/Commands";
import { Settings } from "@api/settings";
import IpcEvents from "@utils/IpcEvents";
import Logger from "@utils/Logger";
import { Patch, Plugin } from "@utils/types";
@ -63,7 +64,7 @@ for (const p of pluginsValues) if (settings[p.name]?.enabled) {
});
}
for (const p of pluginsValues) {
function initPlugin(p: Plugin) {
if (p.settings) {
p.settings.pluginName = p.name;
p.options ??= {};
@ -82,6 +83,9 @@ for (const p of pluginsValues) {
}
}
}
for (const p of pluginsValues) {
initPlugin(p);
}
export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins() {
for (const name in Plugins)
@ -172,3 +176,18 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu
return true;
}, p => `stopPlugin ${p.name}`);
export function loadExternalPlugins() {
for (const [name, src] of VencordNative.ipc.sendSync(IpcEvents.GET_PLUGINS)) {
try {
const p = Function(src)().default;
if (!p.name || Object.prototype.hasOwnProperty.call(Plugins, p.name))
throw new Error("Invalid plugin or name conflicts with existing plugin");
Plugins[p.name] = p;
initPlugin(p);
} catch (err) {
logger.error(`Failed to load plugin ${name}`, err);
}
}
}

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { insertTextIntoChatInputBox } from "@utils/discord";
import {
ModalContent,
ModalFooter,
@ -24,7 +25,7 @@ import {
ModalRoot,
openModal,
} from "@utils/modal";
import { Button, ComponentDispatch, Forms, React, Switch, TextInput } from "@webpack/common";
import { Button, Forms, React, Switch, TextInput } from "@webpack/common";
import { encrypt } from "../index";
@ -84,9 +85,7 @@ function EncModal(props: ModalProps) {
const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted;
if (!toSend) return;
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {
rawText: `${toSend}`
});
insertTextIntoChatInputBox(toSend);
props.onClose();
}}

View File

@ -85,7 +85,7 @@ function ChatBarIcon() {
onMouseLeave={onMouseLeave}
innerClassName={ButtonWrapperClasses.button}
onClick={() => buildEncModal()}
style={{ marginRight: "2px" }}
style={{ padding: "0 4px" }}
>
<div className={ButtonWrapperClasses.buttonWrapper}>
<svg

View File

@ -18,8 +18,9 @@
import { addButton, removeButton } from "@api/MessagePopover";
import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types";
import { ChannelStore, ComponentDispatch } from "@webpack/common";
import { ChannelStore } from "@webpack/common";
export default definePlugin({
name: "QuickMention",
@ -34,7 +35,7 @@ export default definePlugin({
icon: this.Icon,
message: msg,
channel: ChannelStore.getChannel(msg.channel_id),
onClick: () => ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: `<@${msg.author.id}> ` })
onClick: () => insertTextIntoChatInputBox(`<@${msg.author.id}> `)
};
});
},

View File

@ -19,7 +19,7 @@
import { FluxEvents } from "@webpack/types";
import { onChannelDelete, onGuildDelete, onRelationshipRemove } from "./functions";
import { syncFriends, syncGroups, syncGuilds } from "./utils";
import { syncAndRunChecks, syncFriends, syncGroups, syncGuilds } from "./utils";
export const FluxHandlers: Partial<Record<FluxEvents, Array<(data: any) => void>>> = {
GUILD_CREATE: [syncGuilds],
@ -28,7 +28,8 @@ export const FluxHandlers: Partial<Record<FluxEvents, Array<(data: any) => void>
CHANNEL_DELETE: [onChannelDelete],
RELATIONSHIP_ADD: [syncFriends],
RELATIONSHIP_UPDATE: [syncFriends],
RELATIONSHIP_REMOVE: [syncFriends, onRelationshipRemove]
RELATIONSHIP_REMOVE: [syncFriends, onRelationshipRemove],
CONNECTION_OPEN: [syncAndRunChecks]
};
export function forEachEvent(fn: (event: FluxEvents, handler: (data: any) => void) => void) {

View File

@ -18,7 +18,7 @@
import { DataStore, Notices } from "@api/index";
import { showNotification } from "@api/Notifications";
import { ChannelStore, GuildStore, RelationshipStore, UserUtils } from "@webpack/common";
import { ChannelStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
import settings from "./settings";
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
@ -30,11 +30,20 @@ const friends = {
requests: [] as string[]
};
const guildsKey = () => `relationship-notifier-guilds-${UserStore.getCurrentUser().id}`;
const groupsKey = () => `relationship-notifier-groups-${UserStore.getCurrentUser().id}`;
const friendsKey = () => `relationship-notifier-friends-${UserStore.getCurrentUser().id}`;
async function runMigrations() {
DataStore.delMany(["relationship-notifier-guilds", "relationship-notifier-groups", "relationship-notifier-friends"]);
}
export async function syncAndRunChecks() {
await runMigrations();
const [oldGuilds, oldGroups, oldFriends] = await DataStore.getMany([
"relationship-notifier-guilds",
"relationship-notifier-groups",
"relationship-notifier-friends"
guildsKey(),
groupsKey(),
friendsKey()
]) as [Map<string, SimpleGuild> | undefined, Map<string, SimpleGroupChannel> | undefined, Record<"friends" | "requests", string[]> | undefined];
await Promise.all([syncGuilds(), syncGroups(), syncFriends()]);
@ -104,7 +113,7 @@ export async function syncGuilds() {
iconURL: icon && `https://cdn.discordapp.com/icons/${id}/${icon}.png`
});
}
await DataStore.set("relationship-notifier-guilds", guilds);
await DataStore.set(guildsKey(), guilds);
}
export function getGroup(id: string) {
@ -126,7 +135,7 @@ export async function syncGroups() {
});
}
await DataStore.set("relationship-notifier-groups", groups);
await DataStore.set(groupsKey(), groups);
}
export async function syncFriends() {
@ -145,5 +154,5 @@ export async function syncFriends() {
}
}
await DataStore.set("relationship-notifier-friends", friends);
await DataStore.set(friendsKey(), friends);
}

View File

@ -57,7 +57,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
}
return (
<div className="ReviewDB">
<div className="vc-reviewdb-view">
<Text
tag="h2"
variant="eyebrow"

View File

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import "./style.css";
import { Settings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
@ -38,7 +40,7 @@ export default definePlugin({
replacement: {
match: /\(.{0,10}\{user:(.),setNote:.,canDM:.,.+?\}\)/,
replace: "$&,$self.getReviewsComponent($1)"
},
}
}
],

View File

@ -0,0 +1,3 @@
[class|="section"]:not([class|="lastSection"]) + .vc-reviewdb-view {
margin-top: 12px;
}

View File

@ -21,11 +21,11 @@ import "./styles.css";
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
import { classNameFactory } from "@api/Styles";
import { Devs } from "@utils/constants";
import { getTheme, Theme } from "@utils/discord";
import { getTheme, insertTextIntoChatInputBox, Theme } from "@utils/discord";
import { Margins } from "@utils/margins";
import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
import definePlugin from "@utils/types";
import { Button, ButtonLooks, ButtonWrapperClasses, ComponentDispatch, Forms, Parser, Select, Tooltip, useMemo, useState } from "@webpack/common";
import { Button, ButtonLooks, ButtonWrapperClasses, Forms, Parser, Select, Tooltip, useMemo, useState } from "@webpack/common";
function parseTime(time: string) {
const cleanTime = time.slice(1, -1).replace(/(\d)(AM|PM)$/i, "$1 $2");
@ -104,7 +104,7 @@ function PickerModal({ rootProps, close }: { rootProps: ModalProps, close(): voi
<ModalFooter>
<Button
onClick={() => {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: formatted });
insertTextIntoChatInputBox(formatted + " ");
close();
}}
>Insert</Button>

View File

@ -43,7 +43,7 @@
}
.vc-st-button {
margin-right: 4px;
padding: 0 8px;
}
.vc-st-button svg {

View File

@ -17,22 +17,41 @@
*/
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import { Button, ButtonLooks, ButtonWrapperClasses, React, Tooltip } from "@webpack/common";
let lastState = false;
const settings = definePluginSettings({
persistState: {
type: OptionType.BOOLEAN,
description: "Whether to persist the state of the silent message toggle when changing channels",
default: false,
onChange(newValue: boolean) {
if (newValue === false) lastState = false;
}
}
});
function SilentMessageToggle(chatBoxProps: {
type: {
analyticsName: string;
};
}) {
const [enabled, setEnabled] = React.useState(false);
const [enabled, setEnabled] = React.useState(lastState);
function setEnabledValue(value: boolean) {
if (settings.store.persistState) lastState = value;
setEnabled(value);
}
React.useEffect(() => {
const listener: SendListener = (_, message) => {
if (enabled) {
setEnabled(false);
setEnabledValue(false);
if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content;
}
};
@ -49,11 +68,11 @@ function SilentMessageToggle(chatBoxProps: {
<div style={{ display: "flex" }}>
<Button
{...tooltipProps}
onClick={() => setEnabled(prev => !prev)}
onClick={() => setEnabledValue(!enabled)}
size=""
look={ButtonLooks.BLANK}
innerClassName={ButtonWrapperClasses.button}
style={{ margin: "0px 8px" }}
style={{ padding: "0 8px" }}
>
<div className={ButtonWrapperClasses.buttonWrapper}>
<svg
@ -79,6 +98,7 @@ export default definePlugin({
name: "SilentMessageToggle",
authors: [Devs.Nuckyz],
description: "Adds a button to the chat bar to toggle sending a silent message.",
settings,
patches: [
{
find: ".activeCommandOption",

View File

@ -57,7 +57,7 @@ function SilentTypingToggle(chatBoxProps: {
size=""
look={ButtonLooks.BLANK}
innerClassName={ButtonWrapperClasses.button}
style={{ margin: "0 8px 0" }}
style={{ padding: "0 8px" }}
>
<div className={ButtonWrapperClasses.buttonWrapper}>
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">

View File

@ -0,0 +1,31 @@
:is([class*="userProfile"], [class*="userPopout"]) [class*="bannerPremium"] {
background: center / cover no-repeat;
position: relative;
z-index: -1;
}
[class*="userPopout"] [class*="NonPremium"] [class*="bannerPremium"] {
top: -30px;
}
[class*="NonPremium"]:has([class*="bannerPremium"]) [class*="bannerSVGWrapper"] {
min-height: 120px !important;
}
[class*="NonPremium"]:has([class*="bannerPremium"]) [class*="bannerSVGWrapper"] foreignObject {
height: 360px;
}
[class*="userPopout"] [class*="NonPremium"]:has([class*="bannerPremium"]) [class*="bannerSVGWrapper"] rect {
height: 120px;
y: -30;
}
[class*="userPopout"] [class*="NonPremium"]:has([class*="bannerPremium"]) [class*="bannerSVGWrapper"] circle {
cy: 86;
}
[class*="NonPremium"]:has([class*="bannerPremium"]) [class*="avatarPositionNormal"],
[class*="PremiumWithoutBanner"]:has([class*="bannerPremium"]) [class*="avatarPositionPremiumNoBanner"] {
top: 76px;
}

View File

@ -0,0 +1,75 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/settings";
import { enableStyle } from "@api/Styles";
import { Link } from "@components/Link";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import style from "./index.css?managed";
const BASE_URL = "https://raw.githubusercontent.com/AutumnVN/usrbg/main/usrbg.json";
let data = {} as Record<string, string>;
const settings = definePluginSettings({
nitroFirst: {
description: "Banner to use if both Nitro and USRBG banners are present",
type: OptionType.SELECT,
options: [
{ label: "Nitro banner", value: true, default: true },
{ label: "USRBG banner", value: false },
]
}
});
export default definePlugin({
name: "USRBG",
description: "USRBG is a community maintained database of Discord banners, allowing anyone to get a banner without requiring Nitro",
authors: [Devs.AutumnVN, Devs.pylix],
settings,
patches: [
{
find: ".bannerSrc,",
replacement: {
match: /(\i)\.bannerSrc,/,
replace: "$self.useBannerHook($1),"
}
}
],
settingsAboutComponent: () => {
return (
<Link href="https://github.com/AutumnVN/usrbg#how-to-request-your-own-usrbg-banner">CLICK HERE TO GET YOUR OWN BANNER</Link>
);
},
useBannerHook({ displayProfile, user }: any) {
if (displayProfile?.banner && settings.store.nitroFirst) return;
if (data[user.id]) return data[user.id];
},
async start() {
enableStyle(style);
const res = await fetch(BASE_URL);
if (res.ok)
data = await res.json();
}
});

View File

@ -43,4 +43,5 @@ export default strEnum({
UPDATE: "VencordUpdate",
BUILD: "VencordBuild",
OPEN_MONACO_EDITOR: "VencordOpenMonacoEditor",
GET_PLUGINS: "VencordGetPlugins",
} as const);

View File

@ -17,7 +17,7 @@
*/
import { findLazy } from "@webpack";
import { ChannelStore, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common";
import { ChannelStore, ComponentDispatch, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common";
import { Guild } from "discord-types/general";
const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings"));
@ -42,3 +42,10 @@ export const enum Theme {
export function getTheme(): Theme {
return PreloadedUserSettings.getCurrentValue()?.appearance?.theme;
}
export function insertTextIntoChatInputBox(text: string) {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {
rawText: text,
plainText: text
});
}

View File

@ -16,17 +16,27 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export * from "./ChangeList";
export * as Constants from "./constants";
export * from "./debounce";
export * as Discord from "./discord";
export * from "./discord";
export * from "./guards";
export { default as IpcEvents } from "./IpcEvents";
export { default as Logger } from "./Logger";
export * from "./margins";
export * from "./misc";
export * as Modals from "./modal";
export * from "./modal";
export * from "./onceDefined";
export * from "./proxyLazy";
export * from "./Queue";
export * from "./react";
export * from "./text";
import * as t from "./types";
export const types = {
// necessary so plugin repo's esbuild doesn't explode
__esModule: true,
...t
};

View File

@ -25,7 +25,18 @@
"@webpack/types": ["./webpack/common/types"],
"@webpack/common": ["./webpack/common"],
"@webpack": ["./webpack/webpack"]
}
},
"plugins": [
// Transform paths in output .js files
{ "transform": "typescript-transform-paths" },
// Transform paths in output .d.ts files (Include this line if you output declarations files)
{
"transform": "typescript-transform-paths",
"afterDeclarations": true
}
]
},
"include": ["src/**/*"]
}