Merge branch 'refs/heads/main' into plugin/memberListActivities

This commit is contained in:
D3SOX 2024-04-18 07:59:57 +02:00
commit 04cf952fe3
No known key found for this signature in database
GPG key ID: 39EC1673FC37B048
10 changed files with 27 additions and 90 deletions

View file

@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
"version": "1.7.6",
"version": "1.7.8",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {

View file

@ -45,14 +45,14 @@ export default definePlugin({
replacement: {
get match() {
switch (Settings.plugins.Settings.settingsLocation) {
case "top": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.USER_SETTINGS\}/;
case "aboveNitro": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.BILLING_SETTINGS\}/;
case "belowNitro": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.APP_SETTINGS\}/;
case "top": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.USER_SETTINGS/;
case "aboveNitro": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.BILLING_SETTINGS/;
case "belowNitro": return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.APP_SETTINGS/;
case "belowActivity": return /(?<=\{section:(\i\.\i)\.DIVIDER},)\{section:"changelog"/;
case "bottom": return /\{section:(\i\.\i)\.CUSTOM,\s*element:.+?}/;
case "aboveActivity":
default:
return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.ACTIVITY_SETTINGS\}/;
return /\{section:(\i\.\i)\.HEADER,\s*label:(\i)\.\i\.Messages\.ACTIVITY_SETTINGS/;
}
},
replace: "...$self.makeSettingsCategories($1),$&"

View file

@ -22,12 +22,12 @@ import { Devs } from "@utils/constants";
import { isTruthy } from "@utils/guards";
import { useAwaiter } from "@utils/react";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { ApplicationAssetUtils, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common";
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
const ActivityClassName = findByPropsLazy("activity", "buttonColor");
const Colors = findByPropsLazy("profileColors");
async function getApplicationAsset(key: string): Promise<string> {
if (/https?:\/\/(cdn|media)\.discordapp\.(com|net)\/attachments\//.test(key)) return "mp:" + key.replace(/https?:\/\/(cdn|media)\.discordapp\.(com|net)\//, "");
@ -393,6 +393,8 @@ export default definePlugin({
settingsAboutComponent: () => {
const activity = useAwaiter(createActivity);
const { profileThemeStyle } = useProfileThemeStyle({});
return (
<>
<Forms.FormText>
@ -406,7 +408,7 @@ export default definePlugin({
If you want to use image link, download your image and reupload the image to <Link href="https://imgur.com">Imgur</Link> and get the image link by right-clicking the image and select "Copy image address".
</Forms.FormText>
<Forms.FormDivider />
<div style={{ width: "284px" }} className={Colors.profileColors}>
<div style={{ width: "284px", ...profileThemeStyle }}>
{activity[0] && <ActivityComponent activity={activity[0]} className={ActivityClassName.activity} channelId={SelectedChannelStore.getChannelId()}
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
application={{ id: settings.store.appID }}

View file

@ -83,6 +83,6 @@ export default definePlugin({
if (!aIsFavorite && bIsFavorite) return 1;
return 0;
}).slice(0, query.results.emojis.sliceTo ?? 10);
}).slice(0, query.results.emojis.sliceTo ?? Infinity);
}
});

View file

@ -337,12 +337,12 @@ export default definePlugin({
{
// Attachment renderer
// Module 96063
find: ".removeAttachmentHoverButton",
find: ".removeMosaicItemHoverButton",
group: true,
replacement: [
{
match: /(className:\i,attachment:\i),/,
replace: "$1,attachment: {deleted},"
match: /(className:\i,item:\i),/,
replace: "$1,item: deleted,"
},
{
match: /\[\i\.obscured\]:.+?,/,

View file

@ -5,15 +5,9 @@
*/
import { definePluginSettings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import style from "./styles.css?managed";
const MAX_WIDTH = 550;
const MAX_HEIGHT = 350;
const settings = definePluginSettings({
inlineVideo: {
description: "Play videos without carousel modal",
@ -33,15 +27,11 @@ export default definePlugin({
patches: [
{
find: ".oneByTwoLayoutThreeGrid",
replacement: [{
match: /mediaLayoutType:\i\.\i\.MOSAIC/,
replace: "mediaLayoutType:'RESPONSIVE'",
},
{
match: /null!==\(\i=\i\.get\(\i\)\)&&void 0!==\i\?\i:"INVALID"/,
replace: '"INVALID"',
}]
find: "isGroupableMedia:function()",
replacement: {
match: /=>"IMAGE"===\i\|\|"VIDEO"===\i;/,
replace: "=>false;"
}
},
{
find: "renderAttachments(",
@ -51,52 +41,5 @@ export default definePlugin({
replace: "$&$1.content_type?.startsWith('image/')&&"
}
},
{
find: "Messages.REMOVE_ATTACHMENT_TOOLTIP_TEXT",
replacement: [{
match: /\i===\i\.\i\.MOSAIC/,
replace: "true"
},
{
match: /\i!==\i\.\i\.MOSAIC/,
replace: "false"
}]
},
{
find: ".messageAttachment,",
replacement: {
match: /\{width:\i,height:\i\}=(\i).*?(?=className:\i\(\)\(\i\.messageAttachment,)/,
replace: "$&style:$self.style($1),"
}
}
],
style({ width, height }) {
if (!width || !height) return {};
if (width > MAX_WIDTH || height > MAX_HEIGHT) {
if (width / height > MAX_WIDTH / MAX_HEIGHT) {
height = Math.ceil(MAX_WIDTH / (width / height));
width = MAX_WIDTH;
} else {
width = Math.ceil(MAX_HEIGHT * (width / height));
height = MAX_HEIGHT;
}
}
return {
maxWidth: width,
width: "100%",
aspectRatio: `${width} / ${height}`
};
},
start() {
enableStyle(style);
},
stop() {
disableStyle(style);
}
]
});

View file

@ -1,8 +0,0 @@
[class^="nonMediaAttachmentsContainer_"] [class*="messageAttachment_"] {
position: relative;
}
[class^="nonMediaAttachmentsContainer_"],
[class^="nonMediaAttachmentItem_"]:has([class^="messageAttachment_"][style^="max-width"]) {
width: 100%;
}

View file

@ -10,7 +10,7 @@ import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { React, Tooltip } from "@webpack/common";
import { Tooltip } from "@webpack/common";
const settings = definePluginSettings({
loop: {
@ -28,9 +28,9 @@ export default definePlugin({
settings,
patches: [
{
find: ".nonMediaAttachment]",
find: ".nonMediaMosaicItem]",
replacement: {
match: /\.nonMediaAttachment\]:!(\i).{0,10}children:\[(\S)/,
match: /\.nonMediaMosaicItem\]:!(\i).{0,10}children:\[(\S)/,
replace: "$&,$1&&$2&&$self.renderPiPButton(),"
},
},

View file

@ -94,7 +94,7 @@ export default definePlugin({
find: "renderPrioritySpeaker",
replacement: [
{
match: /renderName\(\).{0,100}speaking:.{50,100}jsx.{5,10}{/,
match: /renderName\(\).{0,100}speaking:.{50,150}"div",{/,
replace: "$&...$self.getVoiceProps(this.props),"
}
],

View file

@ -35,7 +35,7 @@ const Section = findComponentByCodeLazy(".lastSection", "children:");
const ThemeStore = findStoreLazy("ThemeStore");
const platformHooks: { useLegacyPlatformType(platform: string): string; } = findByPropsLazy("useLegacyPlatformType");
const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl");
const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"');
const getProfileThemeProps = findByCodeLazy(".getPreviewThemeColors", "primaryColor:");
const enum Spacing {
COMPACT,
@ -74,8 +74,8 @@ interface ConnectionPlatform {
icon: { lightSVG: string, darkSVG: string; };
}
const profilePopoutComponent = ErrorBoundary.wrap(({ user, displayProfile }: { user: User, displayProfile; }) =>
<ConnectionsComponent id={user.id} theme={getTheme(user, displayProfile).profileTheme} />
const profilePopoutComponent = ErrorBoundary.wrap((props: { user: User, displayProfile; }) =>
<ConnectionsComponent id={props.user.id} theme={getProfileThemeProps(props).theme} />
);
const profilePanelComponent = ErrorBoundary.wrap(({ id }: { id: string; }) =>