mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48:32 +00:00
Merge upstream changes
This commit is contained in:
commit
a90bafd31b
10 changed files with 35 additions and 44 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vencord",
|
||||
"private": "true",
|
||||
"version": "1.7.8",
|
||||
"version": "1.8.0",
|
||||
"description": "The cutest Discord client mod",
|
||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||
"bugs": {
|
||||
|
|
|
@ -209,7 +209,7 @@ export default definePlugin({
|
|||
predicate: () => settings.store.closeAllHomeButton,
|
||||
replacement: {
|
||||
// Close all folders when clicking the home button
|
||||
match: /(?<=onClick:\(\)=>{)(?=.{0,200}"discodo")/,
|
||||
match: /(?<=onClick:\(\)=>{)(?=.{0,300}"discodo")/,
|
||||
replace: "$self.closeFolders();"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import { getCurrentGuild } from "@utils/discord";
|
|||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
||||
import { Alerts, ChannelStore, EmojiStore, FluxDispatcher, Forms, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||
import { Alerts, ChannelStore, EmojiStore, FluxDispatcher, Forms, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||
import type { CustomEmoji } from "@webpack/types";
|
||||
import type { Message } from "discord-types/general";
|
||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||
|
@ -900,7 +900,7 @@ export default definePlugin({
|
|||
|
||||
const emojiString = `<${emoji.animated ? "a" : ""}:${emoji.originalName || emoji.name}:${emoji.id}>`;
|
||||
|
||||
const url = new URL(emoji.url);
|
||||
const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize }));
|
||||
url.searchParams.set("size", s.emojiSize.toString());
|
||||
url.searchParams.set("name", emoji.name);
|
||||
|
||||
|
@ -933,7 +933,7 @@ export default definePlugin({
|
|||
|
||||
hasBypass = true;
|
||||
|
||||
const url = new URL(emoji.url);
|
||||
const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize }));
|
||||
url.searchParams.set("size", s.emojiSize.toString());
|
||||
url.searchParams.set("name", emoji.name);
|
||||
|
||||
|
|
|
@ -7,22 +7,12 @@
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import { makeLazy } from "@utils/lazy";
|
||||
import definePlugin from "@utils/types";
|
||||
import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { React, RelationshipStore } from "@webpack/common";
|
||||
|
||||
const { Heading, Text } = findByPropsLazy("Heading", "Text");
|
||||
// Workaround for module differing on stable & canary
|
||||
// FIXME: remove once merged into stable
|
||||
const getMemberSinceContainer = makeLazy(() => {
|
||||
for (const name of ["memberSinceWrapper", "memberSinceContainer"]) {
|
||||
const mod = find(filters.byProps(name), { isIndirect: true });
|
||||
if (mod) return mod[name];
|
||||
}
|
||||
handleModuleNotFound("findByProps", "memberSinceWrapper/memberSinceContainer");
|
||||
return "";
|
||||
});
|
||||
const container = findByPropsLazy("memberSinceWrapper");
|
||||
const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate");
|
||||
const clydeMoreInfo = findByPropsLazy("clydeMoreInfo");
|
||||
const locale = findByPropsLazy("getLocale");
|
||||
|
@ -59,7 +49,7 @@ export default definePlugin({
|
|||
Friends Since
|
||||
</Heading>
|
||||
|
||||
<div className={getMemberSinceContainer()}>
|
||||
<div className={container.memberSinceWrapper}>
|
||||
{!!getCurrentChannel()?.guild_id && (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
|
|
|
@ -151,20 +151,25 @@ export default definePlugin({
|
|||
// OP 8 Request Guild Members allows 100 user IDs at a time
|
||||
const ignore = new Set(toRequest);
|
||||
const relationships = RelationshipStore.getRelationships();
|
||||
const callback = ({ nonce, members }) => {
|
||||
if (nonce !== sentNonce) return;
|
||||
members.forEach(member => {
|
||||
ignore.delete(member.user.id);
|
||||
});
|
||||
const callback = ({ chunks }) => {
|
||||
for (const chunk of chunks) {
|
||||
const { nonce, members } = chunk;
|
||||
if (nonce !== sentNonce) return;
|
||||
members.forEach(member => {
|
||||
ignore.delete(member.user.id);
|
||||
});
|
||||
|
||||
nonFriendAffinities.map(id => UserStore.getUser(id)).filter(user => user && !ignore.has(user.id)).forEach(user => relationships[user.id] = 5);
|
||||
RelationshipStore.emitChange();
|
||||
if (--count === 0) {
|
||||
FluxDispatcher.unsubscribe("GUILD_MEMBERS_CHUNK", callback);
|
||||
nonFriendAffinities.map(id => UserStore.getUser(id)).filter(user => user && !ignore.has(user.id)).forEach(user => relationships[user.id] = 5);
|
||||
RelationshipStore.emitChange();
|
||||
if (--count === 0) {
|
||||
// @ts-ignore
|
||||
FluxDispatcher.unsubscribe("GUILD_MEMBERS_CHUNK_BATCH", callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FluxDispatcher.subscribe("GUILD_MEMBERS_CHUNK", callback);
|
||||
// @ts-ignore
|
||||
FluxDispatcher.subscribe("GUILD_MEMBERS_CHUNK_BATCH", callback);
|
||||
for (let i = 0; i < toRequest.length; i += 100) {
|
||||
FluxDispatcher.dispatch({
|
||||
type: "GUILD_MEMBERS_REQUEST",
|
||||
|
|
|
@ -217,7 +217,9 @@ export default definePlugin({
|
|||
ignoreChannels.includes(message.channel_id) ||
|
||||
ignoreChannels.includes(ChannelStore.getChannel(message.channel_id)?.parent_id) ||
|
||||
(isEdit ? !logEdits : !logDeletes) ||
|
||||
ignoreGuilds.includes(ChannelStore.getChannel(message.channel_id)?.guild_id);
|
||||
ignoreGuilds.includes(ChannelStore.getChannel(message.channel_id)?.guild_id) ||
|
||||
// Ignore Venbot in the support channel
|
||||
(message.channel_id === "1026515880080842772" && message.author?.id === "1017176847865352332");
|
||||
},
|
||||
|
||||
// Based on canary 63b8f1b4f2025213c5cf62f0966625bee3d53136
|
||||
|
|
|
@ -198,7 +198,8 @@ export default definePlugin({
|
|||
replacement: [
|
||||
// make the tag show the right text
|
||||
{
|
||||
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.BOT_TAG_BOT/,
|
||||
// FIXME: Remove the BOT_TAG_BOT variant when the change arrives in stable
|
||||
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.(?:APP_TAG|BOT_TAG_BOT)/,
|
||||
replace: (_, origSwitch, variant, tags, displayedText, strings) =>
|
||||
`${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}], ${strings})}`
|
||||
},
|
||||
|
@ -321,19 +322,20 @@ export default definePlugin({
|
|||
|
||||
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),
|
||||
|
||||
// FIXME: Remove the BOT_TAG_BOT variants from strings when the change arrives in stable
|
||||
getTagText(passedTagName: string, strings: Record<string, string>) {
|
||||
if (!passedTagName) return strings.BOT_TAG_BOT;
|
||||
if (!passedTagName) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
|
||||
const [tagName, variant] = passedTagName.split("-");
|
||||
const tag = tags.find(({ name }) => tagName === name);
|
||||
if (!tag) return strings.BOT_TAG_BOT;
|
||||
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.BOT_TAG_BOT;
|
||||
if (!tag) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
|
||||
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
|
||||
|
||||
const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName;
|
||||
switch (variant) {
|
||||
case "OP":
|
||||
return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER} • ${tagText}`;
|
||||
case "BOT":
|
||||
return `${strings.BOT_TAG_BOT} • ${tagText}`;
|
||||
return `${strings.APP_TAG ?? strings.BOT_TAG_BOT} • ${tagText}`;
|
||||
default:
|
||||
return tagText;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ export default definePlugin({
|
|||
find: ".pronouns,children",
|
||||
replacement: [
|
||||
{
|
||||
match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i;/,
|
||||
match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i.*?;(?=return)/,
|
||||
replace: "$&let vcPronounSource;[$2,vcPronounSource]=$self.useProfilePronouns($1.id);"
|
||||
},
|
||||
PRONOUN_TOOLTIP_PATCH
|
||||
|
|
|
@ -23,7 +23,6 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
|||
import ExpandableHeader from "@components/ExpandableHeader";
|
||||
import { OpenExternalIcon } from "@components/Icons";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Alerts, Menu, Parser, useState } from "@webpack/common";
|
||||
import { Guild, User } from "discord-types/general";
|
||||
|
@ -75,13 +74,6 @@ export default definePlugin({
|
|||
const s = settings.store;
|
||||
const { lastReviewId, notifyReviews } = s;
|
||||
|
||||
const legacy = s as any as { token?: string; };
|
||||
if (legacy.token) {
|
||||
await updateAuth({ token: legacy.token });
|
||||
legacy.token = undefined;
|
||||
new Logger("ReviewDB").info("Migrated legacy settings");
|
||||
}
|
||||
|
||||
await initAuth();
|
||||
|
||||
setTimeout(async () => {
|
||||
|
|
|
@ -94,7 +94,7 @@ export default definePlugin({
|
|||
find: "renderPrioritySpeaker",
|
||||
replacement: [
|
||||
{
|
||||
match: /renderName\(\).{0,100}speaking:.{50,200}"div",{/,
|
||||
match: /renderName\(\).{0,100}speaking:.+?\.clanTag.+?"div",{/,
|
||||
replace: "$&...$self.getVoiceProps(this.props),"
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue