mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-23 23:15:10 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
60f1416789
26 changed files with 135 additions and 105 deletions
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
|
@ -1,9 +1,6 @@
|
||||||
name: test
|
name: test
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"[typescript]": {
|
"[typescript]": {
|
||||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
|
|
|
@ -137,7 +137,7 @@ 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/icons/1015060230222131221/6101cff21e241cebb60c4a01563d0c01.webp?size=512",
|
avatar_url: "https://cdn.discordapp.com/avatars/1017176847865352332/c312b6b44179ae6817de7e4b09e9c6af.webp?size=512",
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: "Bad Patches",
|
title: "Bad Patches",
|
||||||
|
@ -211,9 +211,12 @@ page.on("console", async e => {
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case "WebpackInterceptor:":
|
case "WebpackInterceptor:":
|
||||||
|
const patchFailMatch = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/)!;
|
||||||
|
if (!patchFailMatch) break;
|
||||||
|
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
|
|
||||||
const [, plugin, type, id, regex] = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/)!;
|
const [, plugin, type, id, regex] = patchFailMatch;
|
||||||
report.badPatches.push({
|
report.badPatches.push({
|
||||||
plugin,
|
plugin,
|
||||||
type,
|
type,
|
||||||
|
@ -253,7 +256,7 @@ page.on("console", async e => {
|
||||||
).then(a => a.join(" ").trim());
|
).then(a => a.join(" ").trim());
|
||||||
|
|
||||||
|
|
||||||
if (text.length && !text.startsWith("Failed to load resource: the server responded with a status of") && !text.includes("found no module Filter:")) {
|
if (text.length && !text.startsWith("Failed to load resource: the server responded with a status of") && !text.includes("Webpack")) {
|
||||||
console.error("[Unexpected Error]", text);
|
console.error("[Unexpected Error]", text);
|
||||||
report.otherErrors.push(text);
|
report.otherErrors.push(text);
|
||||||
}
|
}
|
||||||
|
@ -293,6 +296,7 @@ function runTime(token: string) {
|
||||||
p.patches?.forEach(patch => {
|
p.patches?.forEach(patch => {
|
||||||
patch.plugin = p.name;
|
patch.plugin = p.name;
|
||||||
delete patch.predicate;
|
delete patch.predicate;
|
||||||
|
delete patch.group;
|
||||||
|
|
||||||
if (!Array.isArray(patch.replacement))
|
if (!Array.isArray(patch.replacement))
|
||||||
patch.replacement = [patch.replacement];
|
patch.replacement = [patch.replacement];
|
||||||
|
@ -335,32 +339,34 @@ function runTime(token: string) {
|
||||||
await (wreq as any).el(sym);
|
await (wreq as any).el(sym);
|
||||||
delete Object.prototype[sym];
|
delete Object.prototype[sym];
|
||||||
|
|
||||||
const validChunksEntryPoints = [] as string[];
|
const validChunksEntryPoints = new Set<string>();
|
||||||
const validChunks = [] as string[];
|
const validChunks = new Set<string>();
|
||||||
const invalidChunks = [] as string[];
|
const invalidChunks = new Set<string>();
|
||||||
|
|
||||||
if (!chunks) throw new Error("Failed to get chunks");
|
if (!chunks) throw new Error("Failed to get chunks");
|
||||||
|
|
||||||
chunksLoop:
|
|
||||||
for (const entryPoint in chunks) {
|
for (const entryPoint in chunks) {
|
||||||
const chunkIds = chunks[entryPoint];
|
const chunkIds = chunks[entryPoint];
|
||||||
|
let invalidEntryPoint = false;
|
||||||
|
|
||||||
for (const id of chunkIds) {
|
for (const id of chunkIds) {
|
||||||
if (!wreq.u(id)) continue;
|
if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue;
|
||||||
|
|
||||||
const isWasm = await fetch(wreq.p + wreq.u(id))
|
const isWasm = await fetch(wreq.p + wreq.u(id))
|
||||||
.then(r => r.text())
|
.then(r => r.text())
|
||||||
.then(t => t.includes(".module.wasm") || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
|
.then(t => t.includes(".module.wasm") || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
|
||||||
|
|
||||||
if (isWasm) {
|
if (isWasm) {
|
||||||
invalidChunks.push(id);
|
invalidChunks.add(id);
|
||||||
continue chunksLoop;
|
invalidEntryPoint = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
validChunks.push(id);
|
validChunks.add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
validChunksEntryPoints.push(entryPoint);
|
if (!invalidEntryPoint)
|
||||||
|
validChunksEntryPoints.add(entryPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const entryPoint of validChunksEntryPoints) {
|
for (const entryPoint of validChunksEntryPoints) {
|
||||||
|
@ -370,10 +376,23 @@ function runTime(token: string) {
|
||||||
} catch (err) { }
|
} catch (err) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
const allChunks = Function("return " + (wreq.u.toString().match(/(?<=\()\{.+?\}/s)?.[0] ?? "null"))() as Record<string | number, string[]> | null;
|
// Matches "id" or id:
|
||||||
if (!allChunks) throw new Error("Failed to get all chunks");
|
const chunkIdRegex = /(?:"(\d+?)")|(?:(\d+?):)/g;
|
||||||
const chunksLeft = Object.keys(allChunks).filter(id => {
|
const wreqU = wreq.u.toString();
|
||||||
return !(validChunks.includes(id) || invalidChunks.includes(id));
|
|
||||||
|
const allChunks = [] as string[];
|
||||||
|
let currentMatch: RegExpExecArray | null;
|
||||||
|
|
||||||
|
while ((currentMatch = chunkIdRegex.exec(wreqU)) != null) {
|
||||||
|
const id = currentMatch[1] ?? currentMatch[2];
|
||||||
|
if (id == null) continue;
|
||||||
|
|
||||||
|
allChunks.push(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allChunks.length === 0) throw new Error("Failed to get all chunks");
|
||||||
|
const chunksLeft = allChunks.filter(id => {
|
||||||
|
return !(validChunks.has(id) || invalidChunks.has(id));
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const id of chunksLeft) {
|
for (const id of chunksLeft) {
|
||||||
|
|
|
@ -18,14 +18,13 @@
|
||||||
|
|
||||||
import { mergeDefaults } from "@utils/misc";
|
import { mergeDefaults } from "@utils/misc";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { SnowflakeUtils } from "@webpack/common";
|
import { MessageActions, SnowflakeUtils } from "@webpack/common";
|
||||||
import { Message } from "discord-types/general";
|
import { Message } from "discord-types/general";
|
||||||
import type { PartialDeep } from "type-fest";
|
import type { PartialDeep } from "type-fest";
|
||||||
|
|
||||||
import { Argument } from "./types";
|
import { Argument } from "./types";
|
||||||
|
|
||||||
const MessageCreator = findByPropsLazy("createBotMessage");
|
const MessageCreator = findByPropsLazy("createBotMessage");
|
||||||
const MessageSender = findByPropsLazy("receiveMessage");
|
|
||||||
|
|
||||||
export function generateId() {
|
export function generateId() {
|
||||||
return `-${SnowflakeUtils.fromTimestamp(Date.now())}`;
|
return `-${SnowflakeUtils.fromTimestamp(Date.now())}`;
|
||||||
|
@ -40,7 +39,7 @@ export function generateId() {
|
||||||
export function sendBotMessage(channelId: string, message: PartialDeep<Message>): Message {
|
export function sendBotMessage(channelId: string, message: PartialDeep<Message>): Message {
|
||||||
const botMessage = MessageCreator.createBotMessage({ channelId, content: "", embeds: [] });
|
const botMessage = MessageCreator.createBotMessage({ channelId, content: "", embeds: [] });
|
||||||
|
|
||||||
MessageSender.receiveMessage(channelId, mergeDefaults(message, botMessage));
|
MessageActions.receiveMessage(channelId, mergeDefaults(message, botMessage));
|
||||||
|
|
||||||
return message as Message;
|
return message as Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,13 @@ import { classNameFactory } from "@api/Styles";
|
||||||
import { Flex } from "@components/Flex";
|
import { Flex } from "@components/Flex";
|
||||||
import { DeleteIcon } from "@components/Icons";
|
import { DeleteIcon } from "@components/Icons";
|
||||||
import { Link } from "@components/Link";
|
import { Link } from "@components/Link";
|
||||||
|
import { openInviteModal } from "@utils/discord";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import { showItemInFolder } from "@utils/native";
|
import { showItemInFolder } from "@utils/native";
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import { findByPropsLazy, findLazy } from "@webpack";
|
import { findByPropsLazy, findLazy } from "@webpack";
|
||||||
import { Button, Card, FluxDispatcher, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
import { Button, Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
||||||
import { UserThemeHeader } from "main/themes";
|
import { UserThemeHeader } from "main/themes";
|
||||||
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
||||||
|
|
||||||
|
@ -125,15 +126,7 @@ function ThemeCard({ theme, enabled, onChange, onDelete }: ThemeCardProps) {
|
||||||
href={`https://discord.gg/${theme.invite}`}
|
href={`https://discord.gg/${theme.invite}`}
|
||||||
onClick={async e => {
|
onClick={async e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const { invite } = await InviteActions.resolveInvite(theme.invite, "Desktop Modal");
|
theme.invite != null && openInviteModal(theme.invite).catch(() => showToast("Invalid or expired invite"));
|
||||||
if (!invite) return showToast("Invalid or expired invite");
|
|
||||||
|
|
||||||
FluxDispatcher.dispatch({
|
|
||||||
type: "INVITE_MODAL_OPEN",
|
|
||||||
invite,
|
|
||||||
code: theme.invite,
|
|
||||||
context: "APP"
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Discord Server
|
Discord Server
|
||||||
|
|
|
@ -46,6 +46,14 @@ export default definePlugin({
|
||||||
match: /(?<=\.activityEmoji,.+?animate:)\i/,
|
match: /(?<=\.activityEmoji,.+?animate:)\i/,
|
||||||
replace: "!0"
|
replace: "!0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Guild Banner
|
||||||
|
find: ".animatedBannerHoverLayer,onMouseEnter:",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=guildBanner:\i,animate:)\i(?=}\))/,
|
||||||
|
replace: "!0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,8 +45,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".embedWrapper,embed",
|
find: ".embedWrapper,embed",
|
||||||
replacement: [{
|
replacement: [{
|
||||||
match: /\.embedWrapper/g,
|
match: /\.embedWrapper(?=.+?channel_id:(\i)\.id)/g,
|
||||||
replace: "$&+(this.props.channel.nsfw?' vc-nsfw-img':'')"
|
replace: "$&+($1.nsfw?' vc-nsfw-img':'')"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -147,7 +147,7 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
// patch componentDidMount to replace embed thumbnail and title
|
// patch componentDidMount to replace embed thumbnail and title
|
||||||
{
|
{
|
||||||
match: /render\(\)\{let\{embed:/,
|
match: /render\(\)\{.{0,30}let\{embed:/,
|
||||||
replace: "componentDidMount=$self.embedDidMount;$&"
|
replace: "componentDidMount=$self.embedDidMount;$&"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
// Separate patch for allowing using custom app icons
|
// Separate patch for allowing using custom app icons
|
||||||
{
|
{
|
||||||
find: "location:\"AppIconHome\"",
|
find: ".FreemiumAppIconIds.DEFAULT&&(",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\i\.\i\.isPremium\(\i\.\i\.getCurrentUser\(\)\)/,
|
match: /\i\.\i\.isPremium\(\i\.\i\.getCurrentUser\(\)\)/,
|
||||||
replace: "true"
|
replace: "true"
|
||||||
|
@ -787,7 +787,14 @@ export default definePlugin({
|
||||||
if (sticker.available !== false && (canUseStickers || sticker.guild_id === guildId))
|
if (sticker.available !== false && (canUseStickers || sticker.guild_id === guildId))
|
||||||
break stickerBypass;
|
break stickerBypass;
|
||||||
|
|
||||||
const link = this.getStickerLink(sticker.id);
|
// [12/12/2023]
|
||||||
|
// Work around an annoying bug where getStickerLink will return StickerType.GIF,
|
||||||
|
// but will give us a normal non animated png for no reason
|
||||||
|
// TODO: Remove this workaround when it's not needed anymore
|
||||||
|
let link = this.getStickerLink(sticker.id);
|
||||||
|
if (sticker.format_type === StickerType.GIF && link.includes(".png")) {
|
||||||
|
link = link.replace(".png", ".gif");
|
||||||
|
}
|
||||||
if (sticker.format_type === StickerType.APNG) {
|
if (sticker.format_type === StickerType.APNG) {
|
||||||
this.sendAnimatedSticker(link, sticker.id, channelId);
|
this.sendAnimatedSticker(link, sticker.id, channelId);
|
||||||
return { cancel: true };
|
return { cancel: true };
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a Discord client mod
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "FixImagesQuality",
|
|
||||||
description: "Fixes the quality of images in the chat being horrible.",
|
|
||||||
authors: [Devs.Nuckyz],
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: "handleImageLoad=",
|
|
||||||
replacement: [
|
|
||||||
{
|
|
||||||
match: /(?<=getSrc\(\i\){.+?return )\i\.SUPPORTS_WEBP.+?:(?=\i&&\(\i="png"\))/,
|
|
||||||
replace: ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
|
@ -16,10 +16,11 @@
|
||||||
* 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 { definePluginSettings } from "@api/Settings";
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
import { disableStyle, enableStyle } from "@api/Styles";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findComponentByCodeLazy } from "@webpack";
|
import { findComponentByCodeLazy } from "@webpack";
|
||||||
import { StatusSettingsStores } from "@webpack/common";
|
import { StatusSettingsStores } from "@webpack/common";
|
||||||
|
|
||||||
|
@ -28,20 +29,30 @@ import style from "./style.css?managed";
|
||||||
const Button = findComponentByCodeLazy("Button.Sizes.NONE,disabled:");
|
const Button = findComponentByCodeLazy("Button.Sizes.NONE,disabled:");
|
||||||
|
|
||||||
function makeIcon(showCurrentGame?: boolean) {
|
function makeIcon(showCurrentGame?: boolean) {
|
||||||
|
const { oldIcon } = settings.use(["oldIcon"]);
|
||||||
|
|
||||||
|
const redLinePath = !oldIcon
|
||||||
|
? "M22.7 2.7a1 1 0 0 0-1.4-1.4l-20 20a1 1 0 1 0 1.4 1.4Z"
|
||||||
|
: "M23 2.27 21.73 1 1 21.73 2.27 23 23 2.27Z";
|
||||||
|
|
||||||
|
const maskBlackPath = !oldIcon
|
||||||
|
? "M23.27 4.73 19.27 .73 -.27 20.27 3.73 24.27Z"
|
||||||
|
: "M23.27 4.54 19.46.73 .73 19.46 4.54 23.27 23.27 4.54Z";
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg width="20" height="20" viewBox="0 0 24 24">
|
||||||
width="20"
|
<path
|
||||||
height="20"
|
fill={!showCurrentGame && !oldIcon ? "var(--status-danger)" : "currentColor"}
|
||||||
viewBox="0 0 24 24"
|
mask={!showCurrentGame ? "url(#gameActivityMask)" : void 0}
|
||||||
>
|
d="M3.06 20.4q-1.53 0-2.37-1.065T.06 16.74l1.26-9q.27-1.8 1.605-2.97T6.06 3.6h11.88q1.8 0 3.135 1.17t1.605 2.97l1.26 9q.21 1.53-.63 2.595T20.94 20.4q-.63 0-1.17-.225T18.78 19.5l-2.7-2.7H7.92l-2.7 2.7q-.45.45-.99.675t-1.17.225Zm14.94-7.2q.51 0 .855-.345T19.2 12q0-.51-.345-.855T18 10.8q-.51 0-.855.345T16.8 12q0 .51.345 .855T18 13.2Zm-2.4-3.6q.51 0 .855-.345T16.8 8.4q0-.51-.345-.855T15.6 7.2q-.51 0-.855.345T14.4 8.4q0 .51.345 .855T15.6 9.6ZM6.9 13.2h1.8v-2.1h2.1v-1.8h-2.1v-2.1h-1.8v2.1h-2.1v1.8h2.1v2.1Z"
|
||||||
<path fill="currentColor" mask="url(#gameActivityMask)" d="M3.06 20.4q-1.53 0-2.37-1.065T.06 16.74l1.26-9q.27-1.8 1.605-2.97T6.06 3.6h11.88q1.8 0 3.135 1.17t1.605 2.97l1.26 9q.21 1.53-.63 2.595T20.94 20.4q-.63 0-1.17-.225T18.78 19.5l-2.7-2.7H7.92l-2.7 2.7q-.45.45-.99.675t-1.17.225Zm14.94-7.2q.51 0 .855-.345T19.2 12q0-.51-.345-.855T18 10.8q-.51 0-.855.345T16.8 12q0 .51.345 .855T18 13.2Zm-2.4-3.6q.51 0 .855-.345T16.8 8.4q0-.51-.345-.855T15.6 7.2q-.51 0-.855.345T14.4 8.4q0 .51.345 .855T15.6 9.6ZM6.9 13.2h1.8v-2.1h2.1v-1.8h-2.1v-2.1h-1.8v2.1h-2.1v1.8h2.1v2.1Z" />
|
/>
|
||||||
{!showCurrentGame && <>
|
{!showCurrentGame && <>
|
||||||
<mask id="gameActivityMask" >
|
<path fill="var(--status-danger)" d={redLinePath} />
|
||||||
|
<mask id="gameActivityMask">
|
||||||
<rect fill="white" x="0" y="0" width="24" height="24" />
|
<rect fill="white" x="0" y="0" width="24" height="24" />
|
||||||
<path fill="black" d="M23.27 4.54 19.46.73 .73 19.46 4.54 23.27 23.27 4.54Z" />
|
<path fill="black" d={maskBlackPath} />
|
||||||
</mask>
|
</mask>
|
||||||
<path fill="var(--status-danger)" d="M23 2.27 21.73 1 1 21.73 2.27 23 23 2.27Z" />
|
|
||||||
</>}
|
</>}
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
@ -62,10 +73,19 @@ function GameActivityToggleButton() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
oldIcon: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Use the old icon style before Discord icon redesign",
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "GameActivityToggle",
|
name: "GameActivityToggle",
|
||||||
description: "Adds a button next to the mic and deafen button to toggle game activity.",
|
description: "Adds a button next to the mic and deafen button to toggle game activity.",
|
||||||
authors: [Devs.Nuckyz, Devs.RuukuLada],
|
authors: [Devs.Nuckyz, Devs.RuukuLada],
|
||||||
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,10 +18,9 @@
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { MessageActions } from "@utils/discord";
|
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { ContextMenuApi, FluxDispatcher, Menu } from "@webpack/common";
|
import { ContextMenuApi, FluxDispatcher, Menu, MessageActions } from "@webpack/common";
|
||||||
import { Channel, Message } from "discord-types/general";
|
import { Channel, Message } from "discord-types/general";
|
||||||
|
|
||||||
interface Sticker {
|
interface Sticker {
|
||||||
|
|
|
@ -328,6 +328,7 @@ export default definePlugin({
|
||||||
// Attachment renderer
|
// Attachment renderer
|
||||||
// Module 96063
|
// Module 96063
|
||||||
find: ".removeAttachmentHoverButton",
|
find: ".removeAttachmentHoverButton",
|
||||||
|
group: true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(className:\i,attachment:\i),/,
|
match: /(className:\i,attachment:\i),/,
|
||||||
|
|
|
@ -27,8 +27,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".nsfwAllowed=null",
|
find: ".nsfwAllowed=null",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(\w+)\.nsfwAllowed=/,
|
match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/,
|
||||||
replace: "$1.nsfwAllowed=true;",
|
replace: "!0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -28,7 +28,8 @@ export default definePlugin({
|
||||||
start() {
|
start() {
|
||||||
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
|
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
|
||||||
.then(x => x.text())
|
.then(x => x.text())
|
||||||
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif"))
|
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
|
||||||
|
.replace("(isReducedMotion)", "(false)"))
|
||||||
.then(eval);
|
.then(eval);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,13 @@ const Icons = {
|
||||||
};
|
};
|
||||||
type Platform = keyof typeof Icons;
|
type Platform = keyof typeof Icons;
|
||||||
|
|
||||||
const StatusUtils = findByPropsLazy("getStatusColor", "StatusTypes");
|
const StatusUtils = findByPropsLazy("useStatusFillColor", "StatusTypes");
|
||||||
|
|
||||||
const PlatformIcon = ({ platform, status, small }: { platform: Platform, status: string; small: boolean; }) => {
|
const PlatformIcon = ({ platform, status, small }: { platform: Platform, status: string; small: boolean; }) => {
|
||||||
const tooltip = platform[0].toUpperCase() + platform.slice(1);
|
const tooltip = platform[0].toUpperCase() + platform.slice(1);
|
||||||
const Icon = Icons[platform] ?? Icons.desktop;
|
const Icon = Icons[platform] ?? Icons.desktop;
|
||||||
|
|
||||||
return <Icon color={`var(--${StatusUtils.getStatusColor(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];
|
const getStatus = (id: string): Record<Platform, string> => PresenceStore.getState()?.clientStatuses?.[id];
|
||||||
|
|
|
@ -18,27 +18,28 @@
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
import { React } from "@webpack/common";
|
||||||
|
|
||||||
let ERROR_CODES: any;
|
let ERROR_CODES: any;
|
||||||
const CODES_URL =
|
|
||||||
"https://raw.githubusercontent.com/facebook/react/17.0.2/scripts/error-codes/codes.json";
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ReactErrorDecoder",
|
name: "ReactErrorDecoder",
|
||||||
description: 'Replaces "Minifed React Error" with the actual error.',
|
description: 'Replaces "Minifed React Error" with the actual error.',
|
||||||
authors: [Devs.Cyn],
|
authors: [Devs.Cyn, Devs.maisymoe],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '"https://reactjs.org/docs/error-decoder.html?invariant="',
|
find: '"https://reactjs.org/docs/error-decoder.html?invariant="',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(function .\(.\)){(for\(var .="https:\/\/reactjs\.org\/docs\/error-decoder\.html\?invariant="\+.,.=1;.<arguments\.length;.\+\+\).\+="&args\[\]="\+encodeURIComponent\(arguments\[.\]\);return"Minified React error #"\+.\+"; visit "\+.\+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.")}/,
|
match: /(function .\(.\)){(for\(var .="https:\/\/reactjs\.org\/docs\/error-decoder\.html\?invariant="\+.,.=1;.<arguments\.length;.\+\+\).\+="&args\[\]="\+encodeURIComponent\(arguments\[.\]\);return"Minified React error #"\+.\+"; visit "\+.\+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.")}/,
|
||||||
replace: (_, func, original) =>
|
replace: (_, func, original) =>
|
||||||
`${func}{var decoded=Vencord.Plugins.plugins.ReactErrorDecoder.decodeError.apply(null, arguments);if(decoded)return decoded;${original}}`,
|
`${func}{var decoded=$self.decodeError.apply(null, arguments);if(decoded)return decoded;${original}}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
const CODES_URL = `https://raw.githubusercontent.com/facebook/react/v${React.version}/scripts/error-codes/codes.json`;
|
||||||
|
|
||||||
ERROR_CODES = await fetch(CODES_URL)
|
ERROR_CODES = await fetch(CODES_URL)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.catch(e => console.error("[ReactErrorDecoder] Failed to fetch React error codes\n", e));
|
.catch(e => console.error("[ReactErrorDecoder] Failed to fetch React error codes\n", e));
|
||||||
|
|
|
@ -33,6 +33,7 @@ import { VerifiedIcon } from "./VerifiedIcon";
|
||||||
|
|
||||||
const Section = findComponentByCodeLazy(".lastSection", "children:");
|
const Section = findComponentByCodeLazy(".lastSection", "children:");
|
||||||
const ThemeStore = findStoreLazy("ThemeStore");
|
const ThemeStore = findStoreLazy("ThemeStore");
|
||||||
|
const platformHooks: { useLegacyPlatformType(platform: string): string; } = findByPropsLazy("useLegacyPlatformType");
|
||||||
const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl");
|
const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl");
|
||||||
const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"');
|
const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"');
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) {
|
function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) {
|
||||||
const platform = platforms.get(connection.type);
|
const platform = platforms.get(platformHooks.useLegacyPlatformType(connection.type));
|
||||||
const url = platform.getPlatformUserUrl?.(connection);
|
const url = platform.getPlatformUserUrl?.(connection);
|
||||||
|
|
||||||
const img = (
|
const img = (
|
||||||
|
|
|
@ -77,7 +77,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
// Do not check for unreads when selecting the render level if the channel is hidden
|
// Do not check for unreads when selecting the render level if the channel is hidden
|
||||||
{
|
{
|
||||||
match: /(?=!\(0,\i\.getHasImportantUnread\)\(this\.record\))/,
|
match: /(?<=&&)(?=!\i\.\i\.hasUnread\(this\.record\.id\))/,
|
||||||
replace: "$self.isHiddenChannel(this.record)||"
|
replace: "$self.isHiddenChannel(this.record)||"
|
||||||
},
|
},
|
||||||
// Make channels we dont have access to be the same level as normal ones
|
// Make channels we dont have access to be the same level as normal ones
|
||||||
|
@ -334,12 +334,12 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
||||||
match: /"more-options-popout"\)\),(?<=let{channel:(\i).+?inCall:(\i).+?)/,
|
match: /"more-options-popout"\)\),(?<=channel:(\i).+?inCall:(\i).+?)/,
|
||||||
replace: (m, channel, inCall) => `${m}${inCall}||!$self.isHiddenChannel(${channel},true)&&`
|
replace: (m, channel, inCall) => `${m}${inCall}||!$self.isHiddenChannel(${channel},true)&&`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Remove invite users button for the HiddenChannelLockScreen
|
// Remove invite users button for the HiddenChannelLockScreen
|
||||||
match: /"popup".{0,100}?if\((?<=let{channel:(\i).+?inCall:(\i).+?)/,
|
match: /"popup".{0,100}?if\((?<=channel:(\i).+?inCall:(\i).+?)/,
|
||||||
replace: (m, channel, inCall) => `${m}(${inCall}||!$self.isHiddenChannel(${channel},true))&&`
|
replace: (m, channel, inCall) => `${m}(${inCall}||!$self.isHiddenChannel(${channel},true))&&`
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,10 +18,9 @@
|
||||||
|
|
||||||
import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
|
import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { MessageActions } from "@utils/discord";
|
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { FluxDispatcher } from "@webpack/common";
|
import { FluxDispatcher, MessageActions } from "@webpack/common";
|
||||||
|
|
||||||
interface Album {
|
interface Album {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findExportedComponentLazy, findStoreLazy } from "@webpack";
|
import { findExportedComponentLazy, findStoreLazy } from "@webpack";
|
||||||
import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||||
|
|
||||||
import { buildSeveralUsers } from "../typingTweaks";
|
import { buildSeveralUsers } from "../typingTweaks";
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
||||||
return oldKeys.length === currentKeys.length && currentKeys.every(key => old[key] != null);
|
return oldKeys.length === currentKeys.length && currentKeys.every(key => old[key] != null);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const currentChannelId: string = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
|
||||||
const guildId = ChannelStore.getChannel(channelId).guild_id;
|
const guildId = ChannelStore.getChannel(channelId).guild_id;
|
||||||
|
|
||||||
if (!settings.store.includeMutedChannels) {
|
if (!settings.store.includeMutedChannels) {
|
||||||
|
@ -55,6 +55,10 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
||||||
if (isChannelMuted) return null;
|
if (isChannelMuted) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!settings.store.includeCurrentChannel) {
|
||||||
|
if (currentChannelId === channelId) return null;
|
||||||
|
}
|
||||||
|
|
||||||
const myId = UserStore.getCurrentUser()?.id;
|
const myId = UserStore.getCurrentUser()?.id;
|
||||||
|
|
||||||
const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
|
const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
|
||||||
|
@ -101,6 +105,11 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
|
includeCurrentChannel: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Whether to show the typing indicator for the currently selected channel",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
includeMutedChannels: {
|
includeMutedChannels: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to show the typing indicator for muted channels.",
|
description: "Whether to show the typing indicator for muted channels.",
|
||||||
|
|
|
@ -21,13 +21,12 @@ import "./styles.css";
|
||||||
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
||||||
import { Microphone } from "@components/Icons";
|
import { Microphone } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { MessageActions } from "@utils/discord";
|
|
||||||
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
|
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
|
||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { chooseFile } from "@utils/web";
|
import { chooseFile } from "@utils/web";
|
||||||
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||||
import { Button, FluxDispatcher, Forms, lodash, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
import { Button, FluxDispatcher, Forms, lodash, Menu, MessageActions, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
||||||
import { ComponentType } from "react";
|
import { ComponentType } from "react";
|
||||||
|
|
||||||
import { VoiceRecorderDesktop } from "./DesktopRecorder";
|
import { VoiceRecorderDesktop } from "./DesktopRecorder";
|
||||||
|
|
|
@ -399,6 +399,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "Korbo",
|
name: "Korbo",
|
||||||
id: 455856406420258827n
|
id: 455856406420258827n
|
||||||
},
|
},
|
||||||
|
maisymoe: {
|
||||||
|
name: "maisy",
|
||||||
|
id: 257109471589957632n,
|
||||||
|
},
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
// iife so #__PURE__ works correctly
|
// iife so #__PURE__ works correctly
|
||||||
|
|
|
@ -17,18 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { MessageObject } from "@api/MessageEvents";
|
import { MessageObject } from "@api/MessageEvents";
|
||||||
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
import { ChannelStore, ComponentDispatch, FluxDispatcher, GuildStore, InviteActions, MaskedLink, MessageActions, ModalImageClasses, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
||||||
import { ChannelStore, ComponentDispatch, FluxDispatcher, GuildStore, MaskedLink, ModalImageClasses, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
|
||||||
import { Guild, Message, User } from "discord-types/general";
|
import { Guild, Message, User } from "discord-types/general";
|
||||||
|
|
||||||
import { ImageModal, ModalRoot, ModalSize, openModal } from "./modal";
|
import { ImageModal, ModalRoot, ModalSize, openModal } from "./modal";
|
||||||
|
|
||||||
export const MessageActions = findByPropsLazy("editMessage", "sendMessage");
|
|
||||||
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
|
|
||||||
export const InviteActions = findByPropsLazy("resolveInvite");
|
|
||||||
|
|
||||||
const InviteModalStore = findStoreLazy("InviteModalStore");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the invite modal
|
* Open the invite modal
|
||||||
* @param code The invite code
|
* @param code The invite code
|
||||||
|
|
|
@ -133,3 +133,7 @@ export const zustandCreate: typeof import("zustand").default = findByCodeLazy("w
|
||||||
|
|
||||||
const persistFilter = filters.byCode("[zustand persist middleware]");
|
const persistFilter = filters.byCode("[zustand persist middleware]");
|
||||||
export const { persist: zustandPersist }: typeof import("zustand/middleware") = findLazy(m => m.persist && persistFilter(m.persist));
|
export const { persist: zustandPersist }: typeof import("zustand/middleware") = findLazy(m => m.persist && persistFilter(m.persist));
|
||||||
|
|
||||||
|
export const MessageActions = findByPropsLazy("editMessage", "sendMessage");
|
||||||
|
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
|
||||||
|
export const InviteActions = findByPropsLazy("resolveInvite");
|
||||||
|
|
|
@ -58,6 +58,9 @@ if (window[WEBPACK_CHUNK]) {
|
||||||
// normally, this is populated via webpackGlobal.push, which we patch below.
|
// normally, this is populated via webpackGlobal.push, which we patch below.
|
||||||
// However, Discord has their .m prepopulated.
|
// However, Discord has their .m prepopulated.
|
||||||
// Thus, we use this hack to immediately access their wreq.m and patch all already existing factories
|
// Thus, we use this hack to immediately access their wreq.m and patch all already existing factories
|
||||||
|
//
|
||||||
|
// Update: Discord now has TWO webpack instances. Their normal one and sentry
|
||||||
|
// Sentry does not push chunks to the global at all, so this same patch now also handles their sentry modules
|
||||||
Object.defineProperty(Function.prototype, "m", {
|
Object.defineProperty(Function.prototype, "m", {
|
||||||
set(v: any) {
|
set(v: any) {
|
||||||
// When using react devtools or other extensions, we may also catch their webpack here.
|
// When using react devtools or other extensions, we may also catch their webpack here.
|
||||||
|
@ -65,8 +68,6 @@ if (window[WEBPACK_CHUNK]) {
|
||||||
if (new Error().stack?.includes("discord.com")) {
|
if (new Error().stack?.includes("discord.com")) {
|
||||||
logger.info("Found webpack module factory");
|
logger.info("Found webpack module factory");
|
||||||
patchFactories(v);
|
patchFactories(v);
|
||||||
|
|
||||||
delete (Function.prototype as any).m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperty(this, "m", {
|
Object.defineProperty(this, "m", {
|
||||||
|
@ -142,7 +143,7 @@ function patchFactories(factories: Record<string | number, (module: { exports: a
|
||||||
|
|
||||||
// There are (at the time of writing) 11 modules exporting the window
|
// There are (at the time of writing) 11 modules exporting the window
|
||||||
// Make these non enumerable to improve webpack search performance
|
// Make these non enumerable to improve webpack search performance
|
||||||
if (exports === window) {
|
if (exports === window && require.c) {
|
||||||
Object.defineProperty(require.c, id, {
|
Object.defineProperty(require.c, id, {
|
||||||
value: require.c[id],
|
value: require.c[id],
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue