Merge branch 'dev' into modules-proxy-patches
This commit is contained in:
commit
edf4e75ae2
|
@ -16,5 +16,6 @@ DON'T
|
||||||
|
|
||||||
Repetitive violations of these guidelines might get your access to the repository restricted.
|
Repetitive violations of these guidelines might get your access to the repository restricted.
|
||||||
|
|
||||||
|
If you feel like a user is violating these guidelines or feel treated unfairly, please refrain from vigilantism
|
||||||
If you feel like a user is violating these guidelines or feel treated unfairly, please refrain from publicly challenging them and instead contact a Moderator on our Discord server or send an email to vendicated+conduct@riseup.net!
|
and instead report the issue to a moderator! The best way is joining our [official Discord community](https://vencord.dev/discord)
|
||||||
|
and opening a modmail ticket.
|
||||||
|
|
|
@ -1,82 +1,55 @@
|
||||||
# Contribution Guide
|
# Contributing to Vencord
|
||||||
|
|
||||||
First of all, thank you for contributing! :3
|
Vencord is a community project and welcomes any kind of contribution from anyone!
|
||||||
|
|
||||||
To ensure your contribution is robust, please follow the below guide!
|
We have development documentation for new contributors, which can be found at <https://docs.vencord.dev>.
|
||||||
|
|
||||||
For a friendly introduction to plugins, see [Megu's Plugin Guide!](docs/2_PLUGINS.md)
|
All contributions should be made in accordance with our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
## Style Guide
|
## How to contribute
|
||||||
|
|
||||||
- This project has a very minimal .editorconfig. Make sure your editor supports this!
|
Contributions can be sent via pull requests. If you're new to Git, check [this guide](https://opensource.com/article/19/7/create-pull-request-github).
|
||||||
If you are using VSCode, it should automatically recommend you the extension; If not,
|
|
||||||
please install the Editorconfig extension
|
|
||||||
- Try to follow the formatting in the rest of the project and stay consistent
|
|
||||||
- Follow the file naming convention. File names should usually be camelCase, unless they export a Class
|
|
||||||
or React Component, in which case they should be PascalCase
|
|
||||||
|
|
||||||
## Contributing a Plugin
|
Pull requests can be made either to the `main` or the `dev` branch. However, unless you're an advanced user, I recommend sticking to `main`. This is because the dev branch might contain unstable changes and be force pushed frequently, which could cause conflicts in your pull request.
|
||||||
|
|
||||||
Because plugins modify code directly, incompatibilities are a problem.
|
## Write a plugin
|
||||||
|
|
||||||
Thus, 3rd party plugins are not supported, instead all plugins are part of Vencord itself.
|
Writing a plugin is the primary way to contribute.
|
||||||
This way we can ensure compatibility and high quality patches.
|
|
||||||
|
|
||||||
Follow the below guide to make your first plugin!
|
Before starting your plugin:
|
||||||
|
- Check existing pull requests to see if someone is already working on a similar plugin
|
||||||
|
- Check our [plugin requests tracker](https://github.com/Vencord/plugin-requests/issues) to see if there is an existing request, or if the same idea has been rejected
|
||||||
|
- If there isn't an existing request, [open one](https://github.com/Vencord/plugin-requests/issues/new?assignees=&labels=&projects=&template=request.yml) yourself
|
||||||
|
and include that you'd like to work on this yourself. Then wait for feedback to see if the idea even has any chance of being accepted. Or maybe others have some ideas to improve it!
|
||||||
|
- Familarise yourself with our plugin rules below to ensure your plugin is not banned
|
||||||
|
|
||||||
### Finding the right module to patch
|
### Plugin Rules
|
||||||
|
|
||||||
If the thing you want to patch is an action performed when interacting with a part of the UI, use React DevTools.
|
- No simple slash command plugins like `/cat`. Instead, make a [user installable Discord bot](https://discord.com/developers/docs/change-log#userinstallable-apps-preview)
|
||||||
They come preinstalled and can be found as the "Components" tab in DevTools.
|
- No simple text replace plugins like Let me Google that for you. The TextReplace plugin can do this
|
||||||
Use the Selector (top left) to select the UI Element. Now you can see all callbacks, props or jump to the source
|
- No raw DOM manipulation. Use proper patches and React
|
||||||
directly.
|
- No FakeDeafen or FakeMute
|
||||||
|
- No StereoMic
|
||||||
|
- No plugins that simply hide or redesign ui elements. This can be done with CSS
|
||||||
|
- No selfbots or API spam (animated status, message pruner, auto reply, nitro snipers, etc)
|
||||||
|
- No untrusted third party APIs. Popular services like Google or GitHub are fine, but absolutely no self hosted ones
|
||||||
|
- No plugins that require the user to enter their own API key
|
||||||
|
- Do not introduce new dependencies unless absolutely necessary and warranted
|
||||||
|
|
||||||
If it is anything else, or you're too lazy to use React DevTools, hit `CTRL + Shift + F` while in DevTools and
|
## Improve Vencord itself
|
||||||
enter a search term, for example "getUser" to search all source files.
|
|
||||||
Look at the results until you find something promising. Set a breakpoint and trigger the execution of that part of Code to inspect arguments, locals, etc...
|
|
||||||
|
|
||||||
### Writing a robust patch
|
If you have any ideas on how to improve Vencord itself, or want to propose a new plugin API, feel free to open a feature request so we can discuss.
|
||||||
|
|
||||||
##### "find"
|
Or if you notice any bugs or typos, feel free to fix them!
|
||||||
|
|
||||||
First you need to find a good `find` value. This should be a string that is unique to your module.
|
## Contribute to our Documentation
|
||||||
If you want to patch the `getUser` function, usually a good first try is `getUser:` or `function getUser()`,
|
|
||||||
depending on how the module is structured. Again, make sure this string is unique to your module and is not
|
|
||||||
found in any other module. To verify this, search for it in all bundles (CTRL + Shift + F)
|
|
||||||
|
|
||||||
##### "match"
|
The source code of our documentation is available at <https://github.com/Vencord/Docs>
|
||||||
|
|
||||||
This is the regex that will operate on the module found with "find". Just like in find, you should make sure
|
If you see anything outdated, incorrect or lacking, please fix it!
|
||||||
this only matches exactly the part you want to patch and no other parts in the file.
|
If you think a new page should be added, feel free to suggest it via an issue and we can discuss.
|
||||||
|
|
||||||
The easiest way to write and test your regex is the following:
|
## Help out users in our Discord community
|
||||||
|
|
||||||
- Get the ID of the module you want to patch. To do this, go to it in the sources tab and scroll up until you
|
We have an open support channel in our [Discord community](https://vencord.dev/discord).
|
||||||
see something like `447887: (e,t,n)=>{` (Obviously the number will differ).
|
Helping out users there is always appreciated! The more, the merrier.
|
||||||
- Now paste the following into the console: `Vencord.Webpack.wreq.m[447887].toString()` (Changing the number to your ID)
|
|
||||||
- Now either test regexes on this string in the console or use a tool like https://regex101.com
|
|
||||||
|
|
||||||
Also pay attention to the following:
|
|
||||||
|
|
||||||
- Never hardcode variable or parameter names or any other minified names. They will change in the future. The only Exception to this rule
|
|
||||||
are the react props parameter which seems to always be `e`, but even then only rely on this if it is necessary.
|
|
||||||
Instead, use one of the following approaches where applicable:
|
|
||||||
- Match 1 or 2 of any character: `.{1,2}`, for example to match the variable name in `var a=b`, `var (.{1,2})=`
|
|
||||||
- Match any but a guaranteed terminating character: `[^;]+`, for example to match the entire assigned value in `var a=b||c||func();`,
|
|
||||||
`var .{1,2}=([^;]+);`
|
|
||||||
- If you don't care about that part, just match a bunch of chars: `.{0,50}`, for example to extract the variable "b" in `createElement("div",{a:"foo",c:"bar"},b)`, `createElement\("div".{0,30},(.{1,2})\),`. Note the `.{0,30}`, this is essentially the same as `.+`, but safer as you can't end up accidently eating thousands of characters
|
|
||||||
- Additionally, as you might have noticed, all of the above approaches use regex groups (`(...)`) to capture the variable name. You can then use those groups in your replacement to access those variables dynamically
|
|
||||||
|
|
||||||
#### "replace"
|
|
||||||
|
|
||||||
This is the replacement for the match. This is the second argument to [String.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace), so refer to those docs for info.
|
|
||||||
|
|
||||||
Never hardcode minified variable or parameter names here. Instead, use capture groups in your regex to capture the variable names
|
|
||||||
and use those in your replacement
|
|
||||||
|
|
||||||
Make sure your replacement does not introduce any whitespace. While this might seem weird, random whitespace may mess up other patches.
|
|
||||||
This includes spaces, tabs and especially newlines
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
And that's it! Now open a Pull Request with your Plugin
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
> [!WARNING]
|
|
||||||
> These instructions are only for advanced users. If you're not a Developer, you should use our [graphical installer](https://github.com/Vendicated/VencordInstaller#usage) instead.
|
|
||||||
> No support will be provided for installing in this fashion. If you cannot figure it out, you should just stick to a regular install.
|
|
||||||
|
|
||||||
# Installation Guide
|
|
||||||
|
|
||||||
Welcome to Megu's Installation Guide! In this file, you will learn about how to download, install, and uninstall Vencord!
|
|
||||||
|
|
||||||
## Sections
|
|
||||||
|
|
||||||
- [Installation Guide](#installation-guide)
|
|
||||||
- [Sections](#sections)
|
|
||||||
- [Dependencies](#dependencies)
|
|
||||||
- [Installing Vencord](#installing-vencord)
|
|
||||||
- [Updating Vencord](#updating-vencord)
|
|
||||||
- [Uninstalling Vencord](#uninstalling-vencord)
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
- Install Git from https://git-scm.com/download
|
|
||||||
- Install Node.JS LTS from here: https://nodejs.dev/en/
|
|
||||||
|
|
||||||
## Installing Vencord
|
|
||||||
|
|
||||||
Install `pnpm`:
|
|
||||||
|
|
||||||
> :exclamation: This next command may need to be run as admin/root depending on your system, and you may need to close and reopen your terminal for pnpm to be in your PATH.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm i -g pnpm
|
|
||||||
```
|
|
||||||
|
|
||||||
> :exclamation: **IMPORTANT** Make sure you aren't using an admin/root terminal from here onwards. It **will** mess up your Discord/Vencord instance and you **will** most likely have to reinstall.
|
|
||||||
|
|
||||||
Clone Vencord:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/Vendicated/Vencord
|
|
||||||
cd Vencord
|
|
||||||
```
|
|
||||||
|
|
||||||
Install dependencies:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm install --frozen-lockfile
|
|
||||||
```
|
|
||||||
|
|
||||||
Build Vencord:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm build
|
|
||||||
```
|
|
||||||
|
|
||||||
Inject vencord into your client:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm inject
|
|
||||||
```
|
|
||||||
|
|
||||||
Then fully close Discord from your taskbar or task manager, and restart it. Vencord should be injected - you can check this by looking for the Vencord section in Discord settings.
|
|
||||||
|
|
||||||
## Updating Vencord
|
|
||||||
|
|
||||||
If you're using Discord already, go into the `Updater` tab in settings.
|
|
||||||
|
|
||||||
Sometimes it may be necessary to manually update if the GUI updater fails.
|
|
||||||
|
|
||||||
To pull latest changes:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git pull
|
|
||||||
```
|
|
||||||
|
|
||||||
If this fails, you likely need to reset your local changes to vencord to resolve merge errors:
|
|
||||||
|
|
||||||
> :exclamation: This command will remove any local changes you've made to vencord. Make sure you back up if you made any code changes you don't want to lose!
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git reset --hard
|
|
||||||
git pull
|
|
||||||
```
|
|
||||||
|
|
||||||
and then to build the changes:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm build
|
|
||||||
```
|
|
||||||
|
|
||||||
Then just refresh your client
|
|
||||||
|
|
||||||
## Uninstalling Vencord
|
|
||||||
|
|
||||||
Simply run:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm uninject
|
|
||||||
```
|
|
|
@ -1,111 +0,0 @@
|
||||||
# Plugins Guide
|
|
||||||
|
|
||||||
Welcome to Megu's Plugin Guide! In this file, you will learn about how to write your own plugin!
|
|
||||||
|
|
||||||
You don't need to run `pnpm build` every time you make a change. Instead, use `pnpm watch` - this will auto-compile Vencord whenever you make a change. If using code patches (recommended), you will need to CTRL+R to load the changes.
|
|
||||||
|
|
||||||
## Plugin Entrypoint
|
|
||||||
|
|
||||||
> If it doesn't already exist, create a folder called `userplugins` in the `src` directory of this repo.
|
|
||||||
|
|
||||||
1. Create a folder in `src/userplugins/` with the name of your plugin. For example, `src/userplugins/epicPlugin/` - All of your plugin files will go here.
|
|
||||||
|
|
||||||
2. Create a file in that folder called `index.ts`
|
|
||||||
|
|
||||||
3. In `index.ts`, copy-paste the following template code:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "Epic Plugin",
|
|
||||||
description: "This plugin is absolutely epic",
|
|
||||||
authors: [
|
|
||||||
{
|
|
||||||
id: 12345n,
|
|
||||||
name: "Your Name",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
patches: [],
|
|
||||||
// Delete these two below if you are only using code patches
|
|
||||||
start() {},
|
|
||||||
stop() {},
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Change the name, description, and authors to your own information.
|
|
||||||
|
|
||||||
Replace `12345n` with your user ID ending in `n` (e.g., `545581357812678656n`). If you don't want to share your Discord account, use `0n` instead!
|
|
||||||
|
|
||||||
## How Plugins Work In Vencord
|
|
||||||
|
|
||||||
Vencord uses a different way of making mods than you're used to.
|
|
||||||
Instead of monkeypatching webpack, we directly modify the code before Discord loads it.
|
|
||||||
|
|
||||||
This is _significantly_ more efficient than monkeypatching webpack, and is surprisingly easy, but it may be confusing at first.
|
|
||||||
|
|
||||||
## Making your patch
|
|
||||||
|
|
||||||
For an in-depth guide into patching code, see [CONTRIBUTING.md](../CONTRIBUTING.md)
|
|
||||||
|
|
||||||
in the `index.ts` file we made earlier, you'll see a `patches` array.
|
|
||||||
|
|
||||||
> You'll see examples of how patches are used in all the existing plugins, and it'll be easier to understand by looking at those examples, so do that first, and then return here!
|
|
||||||
|
|
||||||
> For a good example of a plugin using code patches AND runtime patching, check `src/plugins/unindent.ts`, which uses code patches to run custom runtime code.
|
|
||||||
|
|
||||||
One of the patches in the `isStaff` plugin, looks like this:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
match: /(\w+)\.isStaff=function\(\){return\s*!1};/,
|
|
||||||
replace: "$1.isStaff=function(){return true};",
|
|
||||||
},
|
|
||||||
```
|
|
||||||
|
|
||||||
The above regex matches the string in discord that will look something like:
|
|
||||||
|
|
||||||
```js
|
|
||||||
abc.isStaff = function () {
|
|
||||||
return !1;
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
Remember that Discord code is minified, so there won't be any newlines, and there will only be spaces where necessary. So the source code looks something like:
|
|
||||||
|
|
||||||
```
|
|
||||||
abc.isStaff=function(){return!1;}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can find these snippets by opening the devtools (`ctrl+shift+i`) and pressing `ctrl+shift+f`, searching for what you're looking to modify in there, and beautifying the file to make it more readable.
|
|
||||||
|
|
||||||
In the `match` regex in the example shown above, you'll notice at the start there is a `(\w+)`.
|
|
||||||
Anything in the brackets will be accessible in the `replace` string using `$<number>`. e.g., the first pair of brackets will be `$1`, the second will be `$2`, etc.
|
|
||||||
|
|
||||||
The replacement string we used is:
|
|
||||||
|
|
||||||
```
|
|
||||||
"$1.isStaff=function(){return true;};"
|
|
||||||
```
|
|
||||||
|
|
||||||
Which, using the above example, would replace the code with:
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
> In this example, `$1` becomes `abc`
|
|
||||||
|
|
||||||
```js
|
|
||||||
abc.isStaff = function () {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
The match value _can_ be a string, rather than regex, however usually regex will be better suited, as it can work with unknown values, whereas strings must be exact matches.
|
|
||||||
|
|
||||||
Once you've made your plugin, make sure you run `pnpm test` and make sure your code is nice and clean!
|
|
||||||
|
|
||||||
If you want to publish your plugin into the Vencord repo, move your plugin from `src/userplugins` into the `src/plugins` folder and open a PR!
|
|
||||||
|
|
||||||
> **Warning**
|
|
||||||
> Make sure you've read [CONTRIBUTING.md](../CONTRIBUTING.md) before opening a PR
|
|
||||||
|
|
||||||
If you need more help, ask in the support channel in our [Discord Server](https://discord.gg/D9uwnFnqmd).
|
|
|
@ -13,9 +13,6 @@
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"author": "Vendicated",
|
"author": "Vendicated",
|
||||||
"directories": {
|
|
||||||
"doc": "docs"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
||||||
"buildStandalone": "pnpm build --standalone",
|
"buildStandalone": "pnpm build --standalone",
|
||||||
|
|
|
@ -136,7 +136,6 @@ async function printReport() {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
description: "Here's the latest Vencord Report!",
|
description: "Here's the latest Vencord Report!",
|
||||||
username: "Vencord Reporter" + (CANARY ? " (Canary)" : ""),
|
username: "Vencord Reporter" + (CANARY ? " (Canary)" : ""),
|
||||||
avatar_url: "https://cdn.discordapp.com/avatars/1017176847865352332/c312b6b44179ae6817de7e4b09e9c6af.webp?size=512",
|
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: "Bad Patches",
|
title: "Bad Patches",
|
||||||
|
|
|
@ -44,6 +44,11 @@ export interface ProfileBadge {
|
||||||
position?: BadgePosition;
|
position?: BadgePosition;
|
||||||
/** The badge name to display, Discord uses this. Required for component badges */
|
/** The badge name to display, Discord uses this. Required for component badges */
|
||||||
key?: string;
|
key?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows dynamically returning multiple badges
|
||||||
|
*/
|
||||||
|
getBadges?(userInfo: BadgeUserArgs): ProfileBadge[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const Badges = new Set<ProfileBadge>();
|
const Badges = new Set<ProfileBadge>();
|
||||||
|
@ -73,9 +78,16 @@ export function _getBadges(args: BadgeUserArgs) {
|
||||||
const badges = [] as ProfileBadge[];
|
const badges = [] as ProfileBadge[];
|
||||||
for (const badge of Badges) {
|
for (const badge of Badges) {
|
||||||
if (!badge.shouldShow || badge.shouldShow(args)) {
|
if (!badge.shouldShow || badge.shouldShow(args)) {
|
||||||
|
const b = badge.getBadges
|
||||||
|
? badge.getBadges(args).map(b => {
|
||||||
|
b.component &&= ErrorBoundary.wrap(b.component, { noop: true });
|
||||||
|
return b;
|
||||||
|
})
|
||||||
|
: [{ ...badge, ...args }];
|
||||||
|
|
||||||
badge.position === BadgePosition.START
|
badge.position === BadgePosition.START
|
||||||
? badges.unshift({ ...badge, ...args })
|
? badges.unshift(...b)
|
||||||
: badges.push({ ...badge, ...args });
|
: badges.push(...b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const donorBadges = (Plugins.BadgeAPI as unknown as typeof import("../plugins/_api/badges").default).getDonorBadges(args.userId);
|
const donorBadges = (Plugins.BadgeAPI as unknown as typeof import("../plugins/_api/badges").default).getDonorBadges(args.userId);
|
||||||
|
|
|
@ -31,10 +31,20 @@ export interface ExpandableHeaderProps {
|
||||||
headerText: string;
|
headerText: string;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
buttons?: React.ReactNode[];
|
buttons?: React.ReactNode[];
|
||||||
|
forceOpen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ExpandableHeader({ children, onMoreClick, buttons, moreTooltipText, defaultState = false, onDropDownClick, headerText }: ExpandableHeaderProps) {
|
export function ExpandableHeader({
|
||||||
const [showContent, setShowContent] = useState(defaultState);
|
children,
|
||||||
|
onMoreClick,
|
||||||
|
buttons,
|
||||||
|
moreTooltipText,
|
||||||
|
onDropDownClick,
|
||||||
|
headerText,
|
||||||
|
defaultState = false,
|
||||||
|
forceOpen = false,
|
||||||
|
}: ExpandableHeaderProps) {
|
||||||
|
const [showContent, setShowContent] = useState(defaultState || forceOpen);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -90,6 +100,7 @@ export function ExpandableHeader({ children, onMoreClick, buttons, moreTooltipTe
|
||||||
setShowContent(v => !v);
|
setShowContent(v => !v);
|
||||||
onDropDownClick?.(showContent);
|
onDropDownClick?.(showContent);
|
||||||
}}
|
}}
|
||||||
|
disabled={forceOpen}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
width="24"
|
width="24"
|
||||||
|
|
|
@ -290,3 +290,42 @@ export function NoEntrySignIcon(props: IconProps) {
|
||||||
</Icon>
|
</Icon>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SafetyIcon(props: IconProps) {
|
||||||
|
return (
|
||||||
|
<Icon
|
||||||
|
{...props}
|
||||||
|
className={classes(props.className, "vc-safety-icon")}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
fillRule="evenodd"
|
||||||
|
clipRule="evenodd"
|
||||||
|
d="M4.27 5.22A2.66 2.66 0 0 0 3 7.5v2.3c0 5.6 3.3 10.68 8.42 12.95.37.17.79.17 1.16 0A14.18 14.18 0 0 0 21 9.78V7.5c0-.93-.48-1.78-1.27-2.27l-6.17-3.76a3 3 0 0 0-3.12 0L4.27 5.22ZM6 7.68l6-3.66V12H6.22C6.08 11.28 6 10.54 6 9.78v-2.1Zm6 12.01V12h5.78A11.19 11.19 0 0 1 12 19.7Z"
|
||||||
|
/>
|
||||||
|
</Icon>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NotesIcon(props: IconProps) {
|
||||||
|
return (
|
||||||
|
<Icon
|
||||||
|
{...props}
|
||||||
|
className={classes(props.className, "vc-notes-icon")}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M8 3C7.44771 3 7 3.44772 7 4V5C7 5.55228 7.44772 6 8 6H16C16.5523 6 17 5.55228 17 5V4C17 3.44772 16.5523 3 16 3H15.1245C14.7288 3 14.3535 2.82424 14.1002 2.52025L13.3668 1.64018C13.0288 1.23454 12.528 1 12 1C11.472 1 10.9712 1.23454 10.6332 1.64018L9.8998 2.52025C9.64647 2.82424 9.27121 3 8.8755 3H8Z"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fillRule="evenodd"
|
||||||
|
clipRule="evenodd"
|
||||||
|
fill="currentColor"
|
||||||
|
d="M19 4.49996V4.99996C19 6.65681 17.6569 7.99996 16 7.99996H8C6.34315 7.99996 5 6.65681 5 4.99996V4.49996C5 4.22382 4.77446 3.99559 4.50209 4.04109C3.08221 4.27826 2 5.51273 2 6.99996V19C2 20.6568 3.34315 22 5 22H19C20.6569 22 22 20.6568 22 19V6.99996C22 5.51273 20.9178 4.27826 19.4979 4.04109C19.2255 3.99559 19 4.22382 19 4.49996ZM8 12C7.44772 12 7 12.4477 7 13C7 13.5522 7.44772 14 8 14H16C16.5523 14 17 13.5522 17 13C17 12.4477 16.5523 12 16 12H8ZM7 17C7 16.4477 7.44772 16 8 16H13C13.5523 16 14 16.4477 14 17C14 17.5522 13.5523 18 13 18H8C7.44772 18 7 17.5522 7 17Z"
|
||||||
|
/>
|
||||||
|
</Icon>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -136,6 +136,8 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
getBadges(props: { userId: string; user?: User; guildId: string; }) {
|
getBadges(props: { userId: string; user?: User; guildId: string; }) {
|
||||||
|
if (!props) return [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
props.userId ??= props.user?.id!;
|
props.userId ??= props.user?.id!;
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,9 @@ interface ProfileModalProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
||||||
const ProfileModal = findComponentByCodeLazy<ProfileModalProps>('"ProfileCustomizationPreview"');
|
const ProfileModal = findComponentByCodeLazy<ProfileModalProps>("isTryItOutFlow:", "pendingThemeColors:", "pendingAvatarDecoration:", "EDIT_PROFILE_BANNER");
|
||||||
|
|
||||||
const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i\("?(.+?)"?\).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
|
const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FakeProfileThemes",
|
name: "FakeProfileThemes",
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default definePlugin({
|
||||||
...data,
|
...data,
|
||||||
options: [OptionalMessageOption],
|
options: [OptionalMessageOption],
|
||||||
execute: opts => ({
|
execute: opts => ({
|
||||||
content: findOption(opts, "message", "") + data.description
|
content: findOption(opts, "message", "") + " " + data.description
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default definePlugin({
|
||||||
find: ".Messages.MUTUAL_GUILDS_WITH_END_COUNT", // Note: the module is lazy-loaded
|
find: ".Messages.MUTUAL_GUILDS_WITH_END_COUNT", // Note: the module is lazy-loaded
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=\.tabBarItem.{0,50}MUTUAL_GUILDS.+?}\),)(?=.+?(\(0,\i\.jsxs?\)\(.{0,100}id:))/,
|
match: /(?<=\.tabBarItem.{0,50}MUTUAL_GUILDS.+?}\),)(?=.+?(\(0,\i\.jsxs?\)\(.{0,100}id:))/,
|
||||||
replace: '(arguments[0].user.bot||arguments[0].isCurrentUser)?null:$1"MUTUAL_GDMS",children:"Mutual Groups"}),'
|
replace: '$self.isBotOrSelf(arguments[0].user)?null:$1"MUTUAL_GDMS",children:"Mutual Groups"}),'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -58,9 +58,24 @@ export default definePlugin({
|
||||||
match: /(?<={user:(\i),onClose:(\i)}\);)(?=case \i\.\i\.MUTUAL_FRIENDS)/,
|
match: /(?<={user:(\i),onClose:(\i)}\);)(?=case \i\.\i\.MUTUAL_FRIENDS)/,
|
||||||
replace: "case \"MUTUAL_GDMS\":return $self.renderMutualGDMs({user: $1, onClose: $2});"
|
replace: "case \"MUTUAL_GDMS\":return $self.renderMutualGDMs({user: $1, onClose: $2});"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".MUTUAL_FRIENDS?(",
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /(?<=onItemSelect:\i,children:)(\i)\.map/,
|
||||||
|
replace: "[...$1, ...($self.isBotOrSelf(arguments[0].user) ? [] : [{section:'MUTUAL_GDMS',text:'Mutual Groups'}])].map"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /\(0,\i\.jsx\)\(\i,\{items:\i,section:(\i)/,
|
||||||
|
replace: "$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):$&"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
isBotOrSelf: (user: User) => user.bot || user.id === UserStore.getCurrentUser().id,
|
||||||
|
|
||||||
renderMutualGDMs: ErrorBoundary.wrap(({ user, onClose }: { user: User, onClose: () => void; }) => {
|
renderMutualGDMs: ErrorBoundary.wrap(({ user, onClose }: { user: User, onClose: () => void; }) => {
|
||||||
const entries = ChannelStore.getSortedPrivateChannels().filter(c => c.isGroupDM() && c.recipients.includes(user.id)).map(c => (
|
const entries = ChannelStore.getSortedPrivateChannels().filter(c => c.isGroupDM() && c.recipients.includes(user.id)).map(c => (
|
||||||
<Clickable
|
<Clickable
|
||||||
|
|
|
@ -16,10 +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 {
|
||||||
|
findGroupChildrenByChildId,
|
||||||
|
NavContextMenuPatchCallback
|
||||||
|
} from "@api/ContextMenu";
|
||||||
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||||
|
import { CogWheel } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, mapMangledModuleLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy, mapMangledModuleLazy } from "@webpack";
|
||||||
|
import { Menu } from "@webpack/common";
|
||||||
|
import { Guild } from "discord-types/general";
|
||||||
|
|
||||||
const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings");
|
const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings");
|
||||||
const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(", {
|
const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(", {
|
||||||
|
@ -73,31 +80,21 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
migratePluginSettings("NewGuildSettings", "MuteNewGuild");
|
const makeContextMenuPatch: (shouldAddIcon: boolean) => NavContextMenuPatchCallback = (shouldAddIcon: boolean) => (children, { guild }: { guild: Guild, onClose(): void; }) => {
|
||||||
export default definePlugin({
|
if (!guild) return;
|
||||||
name: "NewGuildSettings",
|
|
||||||
description: "Automatically mute new servers and change various other settings upon joining",
|
|
||||||
tags: ["MuteNewGuild", "mute", "server"],
|
|
||||||
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi, Devs.GabiRP],
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: ",acceptInvite(",
|
|
||||||
replacement: {
|
|
||||||
match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!==.+?;/,
|
|
||||||
replace: (m, guildId) => `${m}$self.handleMute(${guildId});`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "{joinGuild:",
|
|
||||||
replacement: {
|
|
||||||
match: /guildId:(\i),lurker:(\i).{0,20}}\)\);/,
|
|
||||||
replace: (m, guildId, lurker) => `${m}if(!${lurker})$self.handleMute(${guildId});`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
settings,
|
|
||||||
|
|
||||||
handleMute(guildId: string | null) {
|
const group = findGroupChildrenByChildId("privacy", children);
|
||||||
|
group?.push(
|
||||||
|
<Menu.MenuItem
|
||||||
|
label="Apply NewGuildSettings"
|
||||||
|
id="vc-newguildsettings-apply"
|
||||||
|
icon={shouldAddIcon ? CogWheel : void 0}
|
||||||
|
action={() => applyDefaultSettings(guild.id)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
function applyDefaultSettings(guildId: string | null) {
|
||||||
if (guildId === "@me" || guildId === "null" || guildId == null) return;
|
if (guildId === "@me" || guildId === "null" || guildId == null) return;
|
||||||
updateGuildNotificationSettings(guildId,
|
updateGuildNotificationSettings(guildId,
|
||||||
{
|
{
|
||||||
|
@ -117,4 +114,34 @@ export default definePlugin({
|
||||||
toggleShowAllChannels(guildId);
|
toggleShowAllChannels(guildId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
migratePluginSettings("NewGuildSettings", "MuteNewGuild");
|
||||||
|
export default definePlugin({
|
||||||
|
name: "NewGuildSettings",
|
||||||
|
description: "Automatically mute new servers and change various other settings upon joining",
|
||||||
|
tags: ["MuteNewGuild", "mute", "server"],
|
||||||
|
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi, Devs.GabiRP],
|
||||||
|
contextMenus: {
|
||||||
|
"guild-context": makeContextMenuPatch(false),
|
||||||
|
"guild-header-popout": makeContextMenuPatch(true)
|
||||||
|
},
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ",acceptInvite(",
|
||||||
|
replacement: {
|
||||||
|
match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!==.+?;/,
|
||||||
|
replace: (m, guildId) => `${m}$self.applyDefaultSettings(${guildId});`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "{joinGuild:",
|
||||||
|
replacement: {
|
||||||
|
match: /guildId:(\i),lurker:(\i).{0,20}}\)\);/,
|
||||||
|
replace: (m, guildId, lurker) => `${m}if(!${lurker})$self.applyDefaultSettings(${guildId});`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
settings,
|
||||||
|
applyDefaultSettings
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,7 +43,7 @@ const Classes = proxyLazyWebpack(() =>
|
||||||
))
|
))
|
||||||
) as Record<"roles" | "rolePill" | "rolePillBorder" | "desaturateUserColors" | "flex" | "alignCenter" | "justifyCenter" | "svg" | "background" | "dot" | "dotBorderColor" | "roleCircle" | "dotBorderBase" | "flex" | "alignCenter" | "justifyCenter" | "wrap" | "root" | "role" | "roleRemoveButton" | "roleDot" | "roleFlowerStar" | "roleRemoveIcon" | "roleRemoveIconFocused" | "roleVerifiedIcon" | "roleName" | "roleNameOverflow" | "actionButton" | "overflowButton" | "addButton" | "addButtonIcon" | "overflowRolesPopout" | "overflowRolesPopoutArrowWrapper" | "overflowRolesPopoutArrow" | "popoutBottom" | "popoutTop" | "overflowRolesPopoutHeader" | "overflowRolesPopoutHeaderIcon" | "overflowRolesPopoutHeaderText" | "roleIcon", string>;
|
) as Record<"roles" | "rolePill" | "rolePillBorder" | "desaturateUserColors" | "flex" | "alignCenter" | "justifyCenter" | "svg" | "background" | "dot" | "dotBorderColor" | "roleCircle" | "dotBorderBase" | "flex" | "alignCenter" | "justifyCenter" | "wrap" | "root" | "role" | "roleRemoveButton" | "roleDot" | "roleFlowerStar" | "roleRemoveIcon" | "roleRemoveIconFocused" | "roleVerifiedIcon" | "roleName" | "roleNameOverflow" | "actionButton" | "overflowButton" | "addButton" | "addButtonIcon" | "overflowRolesPopout" | "overflowRolesPopoutArrowWrapper" | "overflowRolesPopoutArrow" | "popoutBottom" | "popoutTop" | "overflowRolesPopoutHeader" | "overflowRolesPopoutHeaderIcon" | "overflowRolesPopoutHeaderText" | "roleIcon", string>;
|
||||||
|
|
||||||
function UserPermissionsComponent({ guild, guildMember, showBorder }: { guild: Guild; guildMember: GuildMember; showBorder: boolean; }) {
|
function UserPermissionsComponent({ guild, guildMember, showBorder, forceOpen = false }: { guild: Guild; guildMember: GuildMember; showBorder: boolean; forceOpen?: boolean; }) {
|
||||||
const stns = settings.use(["permissionsSortOrder"]);
|
const stns = settings.use(["permissionsSortOrder"]);
|
||||||
|
|
||||||
const [rolePermissions, userPermissions] = useMemo(() => {
|
const [rolePermissions, userPermissions] = useMemo(() => {
|
||||||
|
@ -95,6 +95,7 @@ function UserPermissionsComponent({ guild, guildMember, showBorder }: { guild: G
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpandableHeader
|
<ExpandableHeader
|
||||||
|
forceOpen={forceOpen}
|
||||||
headerText="Permissions"
|
headerText="Permissions"
|
||||||
moreTooltipText="Role Details"
|
moreTooltipText="Role Details"
|
||||||
onMoreClick={() =>
|
onMoreClick={() =>
|
||||||
|
|
|
@ -20,15 +20,22 @@ import "./styles.css";
|
||||||
|
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { SafetyIcon } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { ChannelStore, GuildMemberStore, GuildStore, Menu, PermissionsBits, UserStore } from "@webpack/common";
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
import { Button, ChannelStore, Dialog, GuildMemberStore, GuildStore, Menu, PermissionsBits, Popout, TooltipContainer, UserStore } from "@webpack/common";
|
||||||
import type { Guild, GuildMember } from "discord-types/general";
|
import type { Guild, GuildMember } from "discord-types/general";
|
||||||
|
|
||||||
import openRolesAndUsersPermissionsModal, { PermissionType, RoleOrUserPermission } from "./components/RolesAndUsersPermissions";
|
import openRolesAndUsersPermissionsModal, { PermissionType, RoleOrUserPermission } from "./components/RolesAndUsersPermissions";
|
||||||
import UserPermissions from "./components/UserPermissions";
|
import UserPermissions from "./components/UserPermissions";
|
||||||
import { getSortedRoles, sortPermissionOverwrites } from "./utils";
|
import { getSortedRoles, sortPermissionOverwrites } from "./utils";
|
||||||
|
|
||||||
|
const PopoutClasses = findByPropsLazy("container", "scroller", "list");
|
||||||
|
const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "text");
|
||||||
|
|
||||||
export const enum PermissionsSortOrder {
|
export const enum PermissionsSortOrder {
|
||||||
HighestRole,
|
HighestRole,
|
||||||
LowestRole
|
LowestRole
|
||||||
|
@ -168,10 +175,45 @@ export default definePlugin({
|
||||||
match: /showBorder:(.{0,60})}\),(?<=guild:(\i),guildMember:(\i),.+?)/,
|
match: /showBorder:(.{0,60})}\),(?<=guild:(\i),guildMember:(\i),.+?)/,
|
||||||
replace: (m, showBoder, guild, guildMember) => `${m}$self.UserPermissions(${guild},${guildMember},${showBoder}),`
|
replace: (m, showBoder, guild, guildMember) => `${m}$self.UserPermissions(${guild},${guildMember},${showBoder}),`
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".VIEW_ALL_ROLES,",
|
||||||
|
replacement: {
|
||||||
|
match: /children:"\+"\.concat\(\i\.length-\i\.length\).{0,20}\}\),/,
|
||||||
|
replace: "$&$self.ViewPermissionsButton(arguments[0]),"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
UserPermissions: (guild: Guild, guildMember: GuildMember | undefined, showBoder: boolean) => !!guildMember && <UserPermissions guild={guild} guildMember={guildMember} showBorder={showBoder} />,
|
UserPermissions: (guild: Guild, guildMember: GuildMember | undefined, showBorder: boolean) =>
|
||||||
|
!!guildMember && <UserPermissions guild={guild} guildMember={guildMember} showBorder={showBorder} />,
|
||||||
|
|
||||||
|
ViewPermissionsButton: ErrorBoundary.wrap(({ guild, guildMember }: { guild: Guild; guildMember: GuildMember; }) => (
|
||||||
|
<Popout
|
||||||
|
position="bottom"
|
||||||
|
align="center"
|
||||||
|
renderPopout={() => (
|
||||||
|
<Dialog className={PopoutClasses.container} style={{ width: "500px" }}>
|
||||||
|
<UserPermissions guild={guild} guildMember={guildMember} showBorder forceOpen />
|
||||||
|
</Dialog>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{popoutProps => (
|
||||||
|
<TooltipContainer text="View Permissions">
|
||||||
|
<Button
|
||||||
|
{...popoutProps}
|
||||||
|
color={Button.Colors.CUSTOM}
|
||||||
|
look={Button.Looks.FILLED}
|
||||||
|
size={Button.Sizes.NONE}
|
||||||
|
innerClassName={classes(RoleButtonClasses.buttonInner, RoleButtonClasses.icon)}
|
||||||
|
className={classes(RoleButtonClasses.button, RoleButtonClasses.icon, "vc-permviewer-role-button")}
|
||||||
|
>
|
||||||
|
<SafetyIcon height="16" width="16" />
|
||||||
|
</Button>
|
||||||
|
</TooltipContainer>
|
||||||
|
)}
|
||||||
|
</Popout>
|
||||||
|
), { noop: true }),
|
||||||
|
|
||||||
contextMenus: {
|
contextMenus: {
|
||||||
"user-context": makeContextMenuPatch("roles", MenuItemParentType.User),
|
"user-context": makeContextMenuPatch("roles", MenuItemParentType.User),
|
||||||
|
|
|
@ -149,3 +149,21 @@
|
||||||
.vc-permviewer-perms-perms-item .vc-info-icon:hover {
|
.vc-permviewer-perms-perms-item .vc-info-icon:hover {
|
||||||
color: var(--interactive-active);
|
color: var(--interactive-active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* copy pasted from discord cause impossible to webpack find */
|
||||||
|
.vc-permviewer-role-button {
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
background: var(--bg-mod-faint);
|
||||||
|
color: var(--interactive-normal);
|
||||||
|
border: 1px solid var(--border-faint);
|
||||||
|
/* stylelint-disable-next-line value-no-vendor-prefix */
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
|
height: 24px;
|
||||||
|
padding: 4px
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-profile-theme .vc-permviewer-role-button {
|
||||||
|
background: rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-6));
|
||||||
|
border-color: var(--profile-body-border-color)
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { addBadge, BadgePosition, ProfileBadge, removeBadge } from "@api/Badges";
|
import "./style.css";
|
||||||
|
|
||||||
|
import { addBadge, BadgePosition, BadgeUserArgs, ProfileBadge, removeBadge } from "@api/Badges";
|
||||||
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
|
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
|
||||||
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
||||||
import { Settings } from "@api/Settings";
|
import { Settings } from "@api/Settings";
|
||||||
|
@ -27,7 +29,20 @@ import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||||
import { PresenceStore, Tooltip, UserStore } from "@webpack/common";
|
import { PresenceStore, Tooltip, UserStore } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
const SessionsStore = findStoreLazy("SessionsStore");
|
export interface Session {
|
||||||
|
sessionId: string;
|
||||||
|
status: string;
|
||||||
|
active: boolean;
|
||||||
|
clientInfo: {
|
||||||
|
version: number;
|
||||||
|
os: string;
|
||||||
|
client: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const SessionsStore = findStoreLazy("SessionsStore") as {
|
||||||
|
getSessions(): Record<string, Session>;
|
||||||
|
};
|
||||||
|
|
||||||
function Icon(path: string, opts?: { viewBox?: string; width?: number; height?: number; }) {
|
function Icon(path: string, opts?: { viewBox?: string; width?: number; height?: number; }) {
|
||||||
return ({ color, tooltip, small }: { color: string; tooltip: string; small: boolean; }) => (
|
return ({ color, tooltip, small }: { color: string; tooltip: string; small: boolean; }) => (
|
||||||
|
@ -67,15 +82,11 @@ const PlatformIcon = ({ platform, status, small }: { platform: Platform, status:
|
||||||
return <Icon color={StatusUtils.useStatusFillColor(status)} tooltip={tooltip} small={small} />;
|
return <Icon color={StatusUtils.useStatusFillColor(status)} tooltip={tooltip} small={small} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatus = (id: string): Record<Platform, string> => PresenceStore.getState()?.clientStatuses?.[id];
|
function ensureOwnStatus(user: User) {
|
||||||
|
|
||||||
const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, small = false }: { user: User; wantMargin?: boolean; wantTopMargin?: boolean; small?: boolean; }) => {
|
|
||||||
if (!user || user.bot) return null;
|
|
||||||
|
|
||||||
if (user.id === UserStore.getCurrentUser().id) {
|
if (user.id === UserStore.getCurrentUser().id) {
|
||||||
const sessions = SessionsStore.getSessions();
|
const sessions = SessionsStore.getSessions();
|
||||||
if (typeof sessions !== "object") return null;
|
if (typeof sessions !== "object") return null;
|
||||||
const sortedSessions = Object.values(sessions).sort(({ status: a }: any, { status: b }: any) => {
|
const sortedSessions = Object.values(sessions).sort(({ status: a }, { status: b }) => {
|
||||||
if (a === b) return 0;
|
if (a === b) return 0;
|
||||||
if (a === "online") return 1;
|
if (a === "online") return 1;
|
||||||
if (b === "online") return -1;
|
if (b === "online") return -1;
|
||||||
|
@ -84,7 +95,7 @@ const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, sma
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
const ownStatus = Object.values(sortedSessions).reduce((acc: any, curr: any) => {
|
const ownStatus = Object.values(sortedSessions).reduce((acc, curr) => {
|
||||||
if (curr.clientInfo.client !== "unknown")
|
if (curr.clientInfo.client !== "unknown")
|
||||||
acc[curr.clientInfo.client] = curr.status;
|
acc[curr.clientInfo.client] = curr.status;
|
||||||
return acc;
|
return acc;
|
||||||
|
@ -93,6 +104,37 @@ const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, sma
|
||||||
const { clientStatuses } = PresenceStore.getState();
|
const { clientStatuses } = PresenceStore.getState();
|
||||||
clientStatuses[UserStore.getCurrentUser().id] = ownStatus;
|
clientStatuses[UserStore.getCurrentUser().id] = ownStatus;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBadges({ userId }: BadgeUserArgs): ProfileBadge[] {
|
||||||
|
const user = UserStore.getUser(userId);
|
||||||
|
|
||||||
|
if (!user || user.bot) return [];
|
||||||
|
|
||||||
|
ensureOwnStatus(user);
|
||||||
|
|
||||||
|
const status = PresenceStore.getState()?.clientStatuses?.[user.id] as Record<Platform, string>;
|
||||||
|
if (!status) return [];
|
||||||
|
|
||||||
|
return Object.entries(status).map(([platform, status]) => ({
|
||||||
|
component: () => (
|
||||||
|
<span className="vc-platform-indicator">
|
||||||
|
<PlatformIcon
|
||||||
|
key={platform}
|
||||||
|
platform={platform as Platform}
|
||||||
|
status={status}
|
||||||
|
small={false}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
key: `vc-platform-indicator-${platform}`
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, small = false }: { user: User; wantMargin?: boolean; wantTopMargin?: boolean; small?: boolean; }) => {
|
||||||
|
if (!user || user.bot) return null;
|
||||||
|
|
||||||
|
ensureOwnStatus(user);
|
||||||
|
|
||||||
const status = PresenceStore.getState()?.clientStatuses?.[user.id] as Record<Platform, string>;
|
const status = PresenceStore.getState()?.clientStatuses?.[user.id] as Record<Platform, string>;
|
||||||
if (!status) return null;
|
if (!status) return null;
|
||||||
|
@ -112,17 +154,10 @@ const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, sma
|
||||||
<span
|
<span
|
||||||
className="vc-platform-indicator"
|
className="vc-platform-indicator"
|
||||||
style={{
|
style={{
|
||||||
display: "inline-flex",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
marginLeft: wantMargin ? 4 : 0,
|
marginLeft: wantMargin ? 4 : 0,
|
||||||
verticalAlign: "top",
|
|
||||||
position: "relative",
|
|
||||||
top: wantTopMargin ? 2 : 0,
|
top: wantTopMargin ? 2 : 0,
|
||||||
padding: !wantMargin ? 1 : 0,
|
|
||||||
gap: 2
|
gap: 2
|
||||||
}}
|
}}
|
||||||
|
|
||||||
>
|
>
|
||||||
{icons}
|
{icons}
|
||||||
</span>
|
</span>
|
||||||
|
@ -130,10 +165,8 @@ const PlatformIndicator = ({ user, wantMargin = true, wantTopMargin = false, sma
|
||||||
};
|
};
|
||||||
|
|
||||||
const badge: ProfileBadge = {
|
const badge: ProfileBadge = {
|
||||||
component: p => <PlatformIndicator {...p} user={UserStore.getUser(p.userId)} wantMargin={false} />,
|
getBadges,
|
||||||
position: BadgePosition.START,
|
position: BadgePosition.START,
|
||||||
shouldShow: userInfo => !!Object.keys(getStatus(userInfo.userId) ?? {}).length,
|
|
||||||
key: "indicator"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const indicatorLocations = {
|
const indicatorLocations = {
|
||||||
|
|
7
src/plugins/platformIndicators/style.css
Normal file
7
src/plugins/platformIndicators/style.css
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.vc-platform-indicator {
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
vertical-align: top;
|
||||||
|
position: relative;
|
||||||
|
}
|
|
@ -13,13 +13,12 @@ import { Flex, Menu } from "@webpack/common";
|
||||||
const DefaultEngines = {
|
const DefaultEngines = {
|
||||||
Google: "https://www.google.com/search?q=",
|
Google: "https://www.google.com/search?q=",
|
||||||
DuckDuckGo: "https://duckduckgo.com/",
|
DuckDuckGo: "https://duckduckgo.com/",
|
||||||
|
Brave: "https://search.brave.com/search?q=",
|
||||||
Bing: "https://www.bing.com/search?q=",
|
Bing: "https://www.bing.com/search?q=",
|
||||||
Yahoo: "https://search.yahoo.com/search?p=",
|
Yahoo: "https://search.yahoo.com/search?p=",
|
||||||
GitHub: "https://github.com/search?q=",
|
|
||||||
Kagi: "https://kagi.com/search?q=",
|
|
||||||
Yandex: "https://yandex.com/search/?text=",
|
Yandex: "https://yandex.com/search/?text=",
|
||||||
AOL: "https://search.aol.com/aol/search?q=",
|
GitHub: "https://github.com/search?q=",
|
||||||
Baidu: "https://www.baidu.com/s?wd=",
|
Reddit: "https://www.reddit.com/search?q=",
|
||||||
Wikipedia: "https://wikipedia.org/w/index.php?search=",
|
Wikipedia: "https://wikipedia.org/w/index.php?search=",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ function makeSearchItem(src: string) {
|
||||||
key="search-text"
|
key="search-text"
|
||||||
id="vc-search-text"
|
id="vc-search-text"
|
||||||
>
|
>
|
||||||
{Object.keys(Engines).map((engine, i) => {
|
{Object.keys(Engines).map(engine => {
|
||||||
const key = "vc-search-content-" + engine;
|
const key = "vc-search-content-" + engine;
|
||||||
return (
|
return (
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
|
@ -70,7 +69,7 @@ function makeSearchItem(src: string) {
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
height={16}
|
height={16}
|
||||||
width={16}
|
width={16}
|
||||||
src={`https://www.google.com/s2/favicons?domain=${Engines[engine]}`}
|
src={`https://www.google.com/s2/favicons?domain=${Engines[engine]}&sz=64`}
|
||||||
/>
|
/>
|
||||||
{engine}
|
{engine}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { cl } from "../utils";
|
||||||
import ReviewComponent from "./ReviewComponent";
|
import ReviewComponent from "./ReviewComponent";
|
||||||
import ReviewsView, { ReviewsInputComponent } from "./ReviewsView";
|
import ReviewsView, { ReviewsInputComponent } from "./ReviewsView";
|
||||||
|
|
||||||
function Modal({ modalProps, discordId, name }: { modalProps: any; discordId: string; name: string; }) {
|
function Modal({ modalProps, modalKey, discordId, name }: { modalProps: any; modalKey: string, discordId: string; name: string; }) {
|
||||||
const [data, setData] = useState<Response>();
|
const [data, setData] = useState<Response>();
|
||||||
const [signal, refetch] = useForceUpdater(true);
|
const [signal, refetch] = useForceUpdater(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
@ -76,6 +76,7 @@ function Modal({ modalProps, discordId, name }: { modalProps: any; discordId: st
|
||||||
discordId={discordId}
|
discordId={discordId}
|
||||||
name={name}
|
name={name}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
|
modalKey={modalKey}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!!reviewCount && (
|
{!!reviewCount && (
|
||||||
|
@ -95,11 +96,14 @@ function Modal({ modalProps, discordId, name }: { modalProps: any; discordId: st
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openReviewsModal(discordId: string, name: string) {
|
export function openReviewsModal(discordId: string, name: string) {
|
||||||
|
const modalKey = "vc-rdb-modal-" + Date.now();
|
||||||
|
|
||||||
openModal(props => (
|
openModal(props => (
|
||||||
<Modal
|
<Modal
|
||||||
|
modalKey={modalKey}
|
||||||
modalProps={props}
|
modalProps={props}
|
||||||
discordId={discordId}
|
discordId={discordId}
|
||||||
name={name}
|
name={name}
|
||||||
/>
|
/>
|
||||||
));
|
), { modalKey });
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,9 @@ function ReviewList({ refetch, reviews, hideOwnReview, profileId }: { refetch():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function ReviewsInputComponent({ discordId, isAuthor, refetch, name }: { discordId: string, name: string; isAuthor: boolean; refetch(): void; }) {
|
export function ReviewsInputComponent(
|
||||||
|
{ discordId, isAuthor, refetch, name, modalKey }: { discordId: string, name: string; isAuthor: boolean; refetch(): void; modalKey?: string; }
|
||||||
|
) {
|
||||||
const { token } = Auth;
|
const { token } = Auth;
|
||||||
const editorRef = useRef<any>(null);
|
const editorRef = useRef<any>(null);
|
||||||
const inputType = ChatInputTypes.FORM;
|
const inputType = ChatInputTypes.FORM;
|
||||||
|
@ -148,6 +150,7 @@ export function ReviewsInputComponent({ discordId, isAuthor, refetch, name }: {
|
||||||
type={inputType}
|
type={inputType}
|
||||||
disableThemedBackground={true}
|
disableThemedBackground={true}
|
||||||
setEditorRef={ref => editorRef.current = ref}
|
setEditorRef={ref => editorRef.current = ref}
|
||||||
|
parentModalKey={modalKey}
|
||||||
textValue=""
|
textValue=""
|
||||||
onSubmit={
|
onSubmit={
|
||||||
async res => {
|
async res => {
|
||||||
|
|
|
@ -21,10 +21,12 @@ import "./style.css";
|
||||||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { ExpandableHeader } from "@components/ExpandableHeader";
|
import { ExpandableHeader } from "@components/ExpandableHeader";
|
||||||
import { OpenExternalIcon } from "@components/Icons";
|
import { NotesIcon, OpenExternalIcon } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { Alerts, Menu, Parser, useState } from "@webpack/common";
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
import { Alerts, Button, Menu, Parser, TooltipContainer, useState } from "@webpack/common";
|
||||||
import { Guild, User } from "discord-types/general";
|
import { Guild, User } from "discord-types/general";
|
||||||
|
|
||||||
import { Auth, initAuth, updateAuth } from "./auth";
|
import { Auth, initAuth, updateAuth } from "./auth";
|
||||||
|
@ -35,6 +37,9 @@ import { getCurrentUserInfo, readNotification } from "./reviewDbApi";
|
||||||
import { settings } from "./settings";
|
import { settings } from "./settings";
|
||||||
import { showToast } from "./utils";
|
import { showToast } from "./utils";
|
||||||
|
|
||||||
|
const PopoutClasses = findByPropsLazy("container", "scroller", "list");
|
||||||
|
const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "text");
|
||||||
|
|
||||||
const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild, onClose(): void; }) => {
|
const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild, onClose(): void; }) => {
|
||||||
if (!guild) return;
|
if (!guild) return;
|
||||||
children.push(
|
children.push(
|
||||||
|
@ -69,7 +74,8 @@ export default definePlugin({
|
||||||
"guild-header-popout": guildPopoutPatch,
|
"guild-header-popout": guildPopoutPatch,
|
||||||
"guild-context": guildPopoutPatch,
|
"guild-context": guildPopoutPatch,
|
||||||
"user-context": userContextPatch,
|
"user-context": userContextPatch,
|
||||||
"user-profile-actions": userContextPatch
|
"user-profile-actions": userContextPatch,
|
||||||
|
"user-profile-overflow-menu": userContextPatch
|
||||||
},
|
},
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -79,6 +85,13 @@ export default definePlugin({
|
||||||
match: /user:(\i),setNote:\i,canDM.+?\}\)/,
|
match: /user:(\i),setNote:\i,canDM.+?\}\)/,
|
||||||
replace: "$&,$self.getReviewsComponent($1)"
|
replace: "$&,$self.getReviewsComponent($1)"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".VIEW_FULL_PROFILE,",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=\.BITE_SIZE,children:\[)\(0,\i\.jsx\)\(\i\.\i,\{user:(\i),/,
|
||||||
|
replace: "$self.BiteSizeReviewsButton({user:$1}),$&"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -159,5 +172,22 @@ export default definePlugin({
|
||||||
/>
|
/>
|
||||||
</ExpandableHeader>
|
</ExpandableHeader>
|
||||||
);
|
);
|
||||||
}, { message: "Failed to render Reviews" })
|
}, { message: "Failed to render Reviews" }),
|
||||||
|
|
||||||
|
BiteSizeReviewsButton: ErrorBoundary.wrap(({ user }: { user: User; }) => {
|
||||||
|
return (
|
||||||
|
<TooltipContainer text="View Reviews">
|
||||||
|
<Button
|
||||||
|
onClick={() => openReviewsModal(user.id, user.username)}
|
||||||
|
look={Button.Looks.FILLED}
|
||||||
|
size={Button.Sizes.NONE}
|
||||||
|
color={RoleButtonClasses.color}
|
||||||
|
className={classes(RoleButtonClasses.button, RoleButtonClasses.banner)}
|
||||||
|
innerClassName={classes(RoleButtonClasses.buttonInner, RoleButtonClasses.banner)}
|
||||||
|
>
|
||||||
|
<NotesIcon height={16} width={16} />
|
||||||
|
</Button>
|
||||||
|
</TooltipContainer>
|
||||||
|
);
|
||||||
|
}, { noop: true })
|
||||||
});
|
});
|
||||||
|
|
|
@ -211,7 +211,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".BITE_SIZE,onOpenProfile",
|
find: /\.BITE_SIZE,onOpenProfile:\i,usernameIcon:/,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /currentUser:\i,guild:\i,onOpenProfile:.+?}\)(?=])(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
match: /currentUser:\i,guild:\i,onOpenProfile:.+?}\)(?=])(?<=user:(\i),bio:null==(\i)\?.+?)/,
|
||||||
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })"
|
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })"
|
||||||
|
|
|
@ -105,6 +105,15 @@ export default definePlugin({
|
||||||
replace: "=[]"
|
replace: "=[]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// empty 2nd word filter
|
||||||
|
{
|
||||||
|
find: '"pepe","nude"',
|
||||||
|
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
|
||||||
|
replacement: {
|
||||||
|
match: /\?\["pepe",.+?\]/,
|
||||||
|
replace: "?[]",
|
||||||
|
},
|
||||||
|
},
|
||||||
// patch request that queries if term is allowed
|
// patch request that queries if term is allowed
|
||||||
{
|
{
|
||||||
find: ".GUILD_DISCOVERY_VALID_TERM",
|
find: ".GUILD_DISCOVERY_VALID_TERM",
|
||||||
|
|
|
@ -66,12 +66,16 @@ export default definePlugin({
|
||||||
|
|
||||||
const { nick } = author;
|
const { nick } = author;
|
||||||
const prefix = withMentionPrefix ? "@" : "";
|
const prefix = withMentionPrefix ? "@" : "";
|
||||||
if (username === nick || isRepliedMessage && !settings.store.inReplies)
|
|
||||||
|
if (isRepliedMessage && !settings.store.inReplies || username === nick.toLowerCase())
|
||||||
return <>{prefix}{nick}</>;
|
return <>{prefix}{nick}</>;
|
||||||
|
|
||||||
if (settings.store.mode === "user-nick")
|
if (settings.store.mode === "user-nick")
|
||||||
return <>{prefix}{username} <span className="vc-smyn-suffix">{nick}</span></>;
|
return <>{prefix}{username} <span className="vc-smyn-suffix">{nick}</span></>;
|
||||||
|
|
||||||
if (settings.store.mode === "nick-user")
|
if (settings.store.mode === "nick-user")
|
||||||
return <>{prefix}{nick} <span className="vc-smyn-suffix">{username}</span></>;
|
return <>{prefix}{nick} <span className="vc-smyn-suffix">{username}</span></>;
|
||||||
|
|
||||||
return <>{prefix}{username}</>;
|
return <>{prefix}{username}</>;
|
||||||
} catch {
|
} catch {
|
||||||
return <>{author?.nick}</>;
|
return <>{author?.nick}</>;
|
||||||
|
|
|
@ -74,9 +74,9 @@ const SilentMessageToggle: ChatBarButton = ({ isMainChat }) => {
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
style={{ scale: "1.2" }}
|
style={{ scale: "1.2" }}
|
||||||
>
|
>
|
||||||
<path fill="currentColor" mask="url(#_)" d="M18 10.7101C15.1085 9.84957 13 7.17102 13 4c0-.30736.0198-.6101.0582-.907C12.7147 3.03189 12.3611 3 12 3 8.686 3 6 5.686 6 9v5c0 1.657-1.344 3-3 3v1h18v-1c-1.656 0-3-1.343-3-3v-3.2899ZM8.55493 19c.693 1.19 1.96897 2 3.44497 2s2.752-.81 3.445-2H8.55493ZM18.2624 5.50209 21 2.5V1h-4.9651v1.49791h2.4411L16 5.61088V7h5V5.50209h-2.7376Z" />
|
<path fill="currentColor" mask="url(#vc-silent-msg-mask)" d="M18 10.7101C15.1085 9.84957 13 7.17102 13 4c0-.30736.0198-.6101.0582-.907C12.7147 3.03189 12.3611 3 12 3 8.686 3 6 5.686 6 9v5c0 1.657-1.344 3-3 3v1h18v-1c-1.656 0-3-1.343-3-3v-3.2899ZM8.55493 19c.693 1.19 1.96897 2 3.44497 2s2.752-.81 3.445-2H8.55493ZM18.2624 5.50209 21 2.5V1h-4.9651v1.49791h2.4411L16 5.61088V7h5V5.50209h-2.7376Z" />
|
||||||
{!enabled && <>
|
{!enabled && <>
|
||||||
<mask id="_">
|
<mask id="vc-silent-msg-mask">
|
||||||
<path fill="#fff" d="M0 0h24v24H0Z" />
|
<path fill="#fff" d="M0 0h24v24H0Z" />
|
||||||
<path stroke="#000" stroke-width="5.99068" d="M0 24 24 0" />
|
<path stroke="#000" stroke-width="5.99068" d="M0 24 24 0" />
|
||||||
</mask>
|
</mask>
|
||||||
|
|
|
@ -98,8 +98,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".popularApplicationCommandIds,",
|
find: ".popularApplicationCommandIds,",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /applicationId:\i\.id}\),(?=.{0,50}setNote:\i)/,
|
match: /(?<=,)(?=!\i&&!\i&&.{0,50}setNote:)/,
|
||||||
replace: "$&$self.patchPopout(arguments[0]),",
|
replace: "$self.patchPopout(arguments[0]),",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// below username
|
// below username
|
||||||
|
|
|
@ -33,6 +33,7 @@ export let Card: t.Card;
|
||||||
export let Button: t.Button;
|
export let Button: t.Button;
|
||||||
export let Switch: t.Switch;
|
export let Switch: t.Switch;
|
||||||
export let Tooltip: t.Tooltip;
|
export let Tooltip: t.Tooltip;
|
||||||
|
export let TooltipContainer: t.TooltipContainer;
|
||||||
export let TextInput: t.TextInput;
|
export let TextInput: t.TextInput;
|
||||||
export let TextArea: t.TextArea;
|
export let TextArea: t.TextArea;
|
||||||
export let Text: t.Text;
|
export let Text: t.Text;
|
||||||
|
@ -66,6 +67,7 @@ waitFor(["FormItem", "Button"], m => {
|
||||||
Button,
|
Button,
|
||||||
FormSwitch: Switch,
|
FormSwitch: Switch,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
TooltipContainer,
|
||||||
TextInput,
|
TextInput,
|
||||||
TextArea,
|
TextArea,
|
||||||
Text,
|
Text,
|
||||||
|
|
44
src/webpack/common/types/components.d.ts
vendored
44
src/webpack/common/types/components.d.ts
vendored
|
@ -101,6 +101,28 @@ export type Tooltip = ComponentType<{
|
||||||
|
|
||||||
export type TooltipPositions = Record<"BOTTOM" | "CENTER" | "LEFT" | "RIGHT" | "TOP" | "WINDOW_CENTER", string>;
|
export type TooltipPositions = Record<"BOTTOM" | "CENTER" | "LEFT" | "RIGHT" | "TOP" | "WINDOW_CENTER", string>;
|
||||||
|
|
||||||
|
export type TooltipContainer = ComponentType<PropsWithChildren<{
|
||||||
|
text: ReactNode;
|
||||||
|
element?: "div" | "span";
|
||||||
|
"aria-label"?: string | false;
|
||||||
|
|
||||||
|
delay?: number;
|
||||||
|
/** Tooltip.Colors.BLACK */
|
||||||
|
color?: string;
|
||||||
|
/** TooltipPositions.TOP */
|
||||||
|
position?: string;
|
||||||
|
spacing?: number;
|
||||||
|
|
||||||
|
className?: string;
|
||||||
|
tooltipClassName?: string | null;
|
||||||
|
tooltipContentClassName?: string | null;
|
||||||
|
|
||||||
|
allowOverflow?: boolean;
|
||||||
|
forceOpen?: boolean;
|
||||||
|
hideOnClick?: boolean;
|
||||||
|
disableTooltipPointerEvents?: boolean;
|
||||||
|
}>>;
|
||||||
|
|
||||||
export type Card = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement> & {
|
export type Card = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement> & {
|
||||||
editable?: boolean;
|
editable?: boolean;
|
||||||
outline?: boolean;
|
outline?: boolean;
|
||||||
|
@ -110,6 +132,26 @@ export type Card = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement> & {
|
||||||
Types: Record<"BRAND" | "CUSTOM" | "DANGER" | "PRIMARY" | "SUCCESS" | "WARNING", string>;
|
Types: Record<"BRAND" | "CUSTOM" | "DANGER" | "PRIMARY" | "SUCCESS" | "WARNING", string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ComboboxPopout = ComponentType<PropsWithChildren<{
|
||||||
|
value: Set<any>;
|
||||||
|
placeholder: string;
|
||||||
|
children(query: string): ReactNode[];
|
||||||
|
|
||||||
|
onChange(value: any): void;
|
||||||
|
itemToString?: (item: any) => string;
|
||||||
|
onClose?(): void;
|
||||||
|
|
||||||
|
className?: string;
|
||||||
|
listClassName?: string;
|
||||||
|
|
||||||
|
|
||||||
|
autoFocus?: boolean;
|
||||||
|
multiSelect?: boolean;
|
||||||
|
maxVisibleItems?: number;
|
||||||
|
showScrollbar?: boolean;
|
||||||
|
|
||||||
|
}>>;
|
||||||
|
|
||||||
export type Button = ComponentType<PropsWithChildren<Omit<HTMLProps<HTMLButtonElement>, "size"> & {
|
export type Button = ComponentType<PropsWithChildren<Omit<HTMLProps<HTMLButtonElement>, "size"> & {
|
||||||
/** Button.Looks.FILLED */
|
/** Button.Looks.FILLED */
|
||||||
look?: string;
|
look?: string;
|
||||||
|
@ -375,7 +417,7 @@ export type Popout = ComponentType<{
|
||||||
Animation: typeof PopoutAnimation;
|
Animation: typeof PopoutAnimation;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Dialog = ComponentType<PropsWithChildren<any>>;
|
export type Dialog = ComponentType<JSX.IntrinsicElements["div"]>;
|
||||||
|
|
||||||
type Resolve = (data: { theme: "light" | "dark", saturation: number; }) => {
|
type Resolve = (data: { theme: "light" | "dark", saturation: number; }) => {
|
||||||
hex(): string;
|
hex(): string;
|
||||||
|
|
Loading…
Reference in a new issue