mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
Merge branch 'dev' into main
This commit is contained in:
commit
c3af902ace
8 changed files with 196 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
||||||
# BetterRoleContext
|
# BetterRoleContext
|
||||||
|
|
||||||
Adds options to copy role color and edit role when right clicking roles in the user profile
|
Adds options to copy role color, edit role and view role icon when right clicking roles in the user profile
|
||||||
|
|
||||||
![](https://github.com/Vendicated/Vencord/assets/45497981/d1765e9e-7db2-4a3c-b110-139c59235326)
|
![](https://github.com/Vendicated/Vencord/assets/45497981/354220a4-09f3-4c5f-a28e-4b19ca775190)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import { ImageIcon } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { getCurrentGuild } from "@utils/discord";
|
import { getCurrentGuild, openImageModal } from "@utils/discord";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { Clipboard, GuildStore, Menu, PermissionStore, TextAndImagesSettingsStores } from "@webpack/common";
|
import { Clipboard, GuildStore, Menu, PermissionStore, TextAndImagesSettingsStores } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -34,10 +36,34 @@ function AppearanceIcon() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
roleIconFileFormat: {
|
||||||
|
type: OptionType.SELECT,
|
||||||
|
description: "File format to use when viewing role icons",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "png",
|
||||||
|
value: "png",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "webp",
|
||||||
|
value: "webp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "jpg",
|
||||||
|
value: "jpg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "BetterRoleContext",
|
name: "BetterRoleContext",
|
||||||
description: "Adds options to copy role color / edit role when right clicking roles in the user profile",
|
description: "Adds options to copy role color / edit role / view role icon when right clicking roles in the user profile",
|
||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven, Devs.goodbee],
|
||||||
|
|
||||||
|
settings,
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
// DeveloperMode needs to be enabled for the context menu to be shown
|
// DeveloperMode needs to be enabled for the context menu to be shown
|
||||||
|
@ -63,6 +89,20 @@ export default definePlugin({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (role.icon) {
|
||||||
|
children.push(
|
||||||
|
<Menu.MenuItem
|
||||||
|
id="vc-view-role-icon"
|
||||||
|
label="View Role Icon"
|
||||||
|
action={() => {
|
||||||
|
openImageModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`);
|
||||||
|
}}
|
||||||
|
icon={ImageIcon}
|
||||||
|
/>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (PermissionStore.getGuildPermissionProps(guild).canManageRoles) {
|
if (PermissionStore.getGuildPermissionProps(guild).canManageRoles) {
|
||||||
children.push(
|
children.push(
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
|
|
3
src/plugins/fakeProfileThemes/index.css
Normal file
3
src/plugins/fakeProfileThemes/index.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.vc-fpt-preview * {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
|
@ -17,13 +17,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// This plugin is a port from Alyxia's Vendetta plugin
|
// This plugin is a port from Alyxia's Vendetta plugin
|
||||||
|
import "./index.css";
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { copyWithToast } from "@utils/misc";
|
import { classes, copyWithToast } from "@utils/misc";
|
||||||
|
import { useAwaiter } from "@utils/react";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Button, Forms } from "@webpack/common";
|
import { extractAndLoadChunksLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
|
import { Button, Flex, Forms, React, Text, UserProfileStore, UserStore, useState } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
import virtualMerge from "virtual-merge";
|
import virtualMerge from "virtual-merge";
|
||||||
|
|
||||||
|
@ -81,6 +85,34 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
interface ColorPickerProps {
|
||||||
|
color: number | null;
|
||||||
|
label: React.ReactElement;
|
||||||
|
showEyeDropper?: boolean;
|
||||||
|
suggestedColors?: string[];
|
||||||
|
onChange(value: number | null): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
// I can't be bothered to figure out the semantics of this component. The
|
||||||
|
// functions surely get some event argument sent to them and they likely aren't
|
||||||
|
// all required. If anyone who wants to use this component stumbles across this
|
||||||
|
// code, you'll have to do the research yourself.
|
||||||
|
interface ProfileModalProps {
|
||||||
|
user: User;
|
||||||
|
pendingThemeColors: [number, number];
|
||||||
|
onAvatarChange: () => void;
|
||||||
|
onBannerChange: () => void;
|
||||||
|
canUsePremiumCustomization: boolean;
|
||||||
|
hideExampleButton: boolean;
|
||||||
|
hideFakeActivity: boolean;
|
||||||
|
isTryItOutFlow: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
||||||
|
const ProfileModal = findComponentByCodeLazy<ProfileModalProps>('"ProfileCustomizationPreview"');
|
||||||
|
|
||||||
|
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",
|
||||||
description: "Allows profile theming by hiding the colors in your bio thanks to invisible 3y3 encoding",
|
description: "Allows profile theming by hiding the colors in your bio thanks to invisible 3y3 encoding",
|
||||||
|
@ -101,21 +133,98 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settingsAboutComponent: () => (
|
settingsAboutComponent: () => {
|
||||||
<Forms.FormSection>
|
const existingColors = decode(
|
||||||
<Forms.FormTitle tag="h3">Usage</Forms.FormTitle>
|
UserProfileStore.getUserProfile(UserStore.getCurrentUser().id).bio
|
||||||
<Forms.FormText>
|
) ?? [0, 0];
|
||||||
After enabling this plugin, you will see custom colors in the profiles of other people using compatible plugins. <br />
|
const [color1, setColor1] = useState(existingColors[0]);
|
||||||
To set your own colors:
|
const [color2, setColor2] = useState(existingColors[1]);
|
||||||
<ul>
|
|
||||||
<li>• go to your profile settings</li>
|
const [, , loadingColorPickerChunk] = useAwaiter(requireColorPicker);
|
||||||
<li>• choose your own colors in the Nitro preview</li>
|
|
||||||
<li>• click the "Copy 3y3" button</li>
|
return (
|
||||||
<li>• paste the invisible text anywhere in your bio</li>
|
<Forms.FormSection>
|
||||||
</ul><br />
|
<Forms.FormTitle tag="h3">Usage</Forms.FormTitle>
|
||||||
<b>Please note:</b> if you are using a theme which hides nitro ads, you should disable it temporarily to set colors.
|
<Forms.FormText>
|
||||||
</Forms.FormText>
|
After enabling this plugin, you will see custom colors in
|
||||||
</Forms.FormSection>),
|
the profiles of other people using compatible plugins.{" "}
|
||||||
|
<br />
|
||||||
|
To set your own colors:
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
• use the color pickers below to choose your colors
|
||||||
|
</li>
|
||||||
|
<li>• click the "Copy 3y3" button</li>
|
||||||
|
<li>• paste the invisible text anywhere in your bio</li>
|
||||||
|
</ul><br />
|
||||||
|
<Forms.FormDivider
|
||||||
|
className={classes(Margins.top8, Margins.bottom8)}
|
||||||
|
/>
|
||||||
|
<Forms.FormTitle tag="h3">Color pickers</Forms.FormTitle>
|
||||||
|
{!loadingColorPickerChunk && (
|
||||||
|
<Flex
|
||||||
|
direction={Flex.Direction.HORIZONTAL}
|
||||||
|
style={{ gap: "1rem" }}
|
||||||
|
>
|
||||||
|
<ColorPicker
|
||||||
|
color={color1}
|
||||||
|
label={
|
||||||
|
<Text
|
||||||
|
variant={"text-xs/normal"}
|
||||||
|
style={{ marginTop: "4px" }}
|
||||||
|
>
|
||||||
|
Primary
|
||||||
|
</Text>
|
||||||
|
}
|
||||||
|
onChange={(color: number) => {
|
||||||
|
setColor1(color);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ColorPicker
|
||||||
|
color={color2}
|
||||||
|
label={
|
||||||
|
<Text
|
||||||
|
variant={"text-xs/normal"}
|
||||||
|
style={{ marginTop: "4px" }}
|
||||||
|
>
|
||||||
|
Accent
|
||||||
|
</Text>
|
||||||
|
}
|
||||||
|
onChange={(color: number) => {
|
||||||
|
setColor2(color);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
const colorString = encode(color1, color2);
|
||||||
|
copyWithToast(colorString);
|
||||||
|
}}
|
||||||
|
color={Button.Colors.PRIMARY}
|
||||||
|
size={Button.Sizes.XLARGE}
|
||||||
|
>
|
||||||
|
Copy 3y3
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
<Forms.FormDivider
|
||||||
|
className={classes(Margins.top8, Margins.bottom8)}
|
||||||
|
/>
|
||||||
|
<Forms.FormTitle tag="h3">Preview</Forms.FormTitle>
|
||||||
|
<div className="vc-fpt-preview">
|
||||||
|
<ProfileModal
|
||||||
|
user={UserStore.getCurrentUser()}
|
||||||
|
pendingThemeColors={[color1, color2]}
|
||||||
|
onAvatarChange={() => { }}
|
||||||
|
onBannerChange={() => { }}
|
||||||
|
canUsePremiumCustomization={true}
|
||||||
|
hideExampleButton={true}
|
||||||
|
hideFakeActivity={true}
|
||||||
|
isTryItOutFlow={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Forms.FormText>
|
||||||
|
</Forms.FormSection>);
|
||||||
|
},
|
||||||
settings,
|
settings,
|
||||||
colorDecodeHook(user: UserProfile) {
|
colorDecodeHook(user: UserProfile) {
|
||||||
if (user) {
|
if (user) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
.emoji,
|
.emoji,
|
||||||
[data-type="sticker"],
|
[data-type="sticker"],
|
||||||
iframe,
|
iframe,
|
||||||
.messagelogger-deleted-attachment,
|
.messagelogger-deleted-attachment:not([class*="hiddenAttachment_"]),
|
||||||
[class|="inlineMediaEmbed"]
|
[class|="inlineMediaEmbed"]
|
||||||
) {
|
) {
|
||||||
filter: grayscale(1) !important;
|
filter: grayscale(1) !important;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBi
|
||||||
import { Message } from "discord-types/general";
|
import { Message } from "discord-types/general";
|
||||||
|
|
||||||
const Kangaroo = findByPropsLazy("jumpToMessage");
|
const Kangaroo = findByPropsLazy("jumpToMessage");
|
||||||
|
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
|
||||||
|
|
||||||
const isMac = navigator.platform.includes("Mac"); // bruh
|
const isMac = navigator.platform.includes("Mac"); // bruh
|
||||||
let replyIdx = -1;
|
let replyIdx = -1;
|
||||||
|
@ -139,6 +140,10 @@ function getNextMessage(isUp: boolean, isReply: boolean) {
|
||||||
messages = messages.filter(m => m.author.id === meId);
|
messages = messages.filter(m => m.author.id === meId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Vencord.Plugins.isPluginEnabled("NoBlockedMessages")) {
|
||||||
|
messages = messages.filter(m => !RelationshipStore.isBlocked(m.author.id));
|
||||||
|
}
|
||||||
|
|
||||||
const mutate = (i: number) => isUp
|
const mutate = (i: number) => isUp
|
||||||
? Math.min(messages.length - 1, i + 1)
|
? Math.min(messages.length - 1, i + 1)
|
||||||
: Math.max(-1, i - 1);
|
: Math.max(-1, i - 1);
|
||||||
|
|
|
@ -80,11 +80,19 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "auto_removed:",
|
find: "prod_discoverable_guilds",
|
||||||
predicate: () => settings.store.disableDiscoveryFilters,
|
predicate: () => settings.store.disableDiscoveryFilters,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /filters:\i\.join\(" AND "\),facets:\[/,
|
match: /\{"auto_removed:.*?\}/,
|
||||||
replace: "facets:["
|
replace: "{}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "MINIMUM_MEMBER_COUNT:",
|
||||||
|
predicate: () => settings.store.disableDiscoveryFilters,
|
||||||
|
replacement: {
|
||||||
|
match: /MINIMUM_MEMBER_COUNT:function\(\)\{return \i}/,
|
||||||
|
replace: "MINIMUM_MEMBER_COUNT:() => \">0\""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -498,6 +498,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "ScattrdBlade",
|
name: "ScattrdBlade",
|
||||||
id: 678007540608532491n
|
id: 678007540608532491n
|
||||||
},
|
},
|
||||||
|
goodbee: {
|
||||||
|
name: "goodbee",
|
||||||
|
id: 658968552606400512n
|
||||||
|
},
|
||||||
Moxxie: {
|
Moxxie: {
|
||||||
name: "Moxxie",
|
name: "Moxxie",
|
||||||
id: 712653921692155965n,
|
id: 712653921692155965n,
|
||||||
|
|
Loading…
Reference in a new issue