Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Seaswimmer 2024-12-12 16:06:48 -05:00
commit b9806f56b9
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
23 changed files with 98 additions and 111 deletions

View file

@ -17,7 +17,7 @@
*/ */
import { onceDefined } from "@shared/onceDefined"; import { onceDefined } from "@shared/onceDefined";
import electron, { app, BrowserWindowConstructorOptions, Menu, nativeTheme } from "electron"; import electron, { app, BrowserWindowConstructorOptions, Menu } from "electron";
import { dirname, join } from "path"; import { dirname, join } from "path";
import { initIpc } from "./ipcMain"; import { initIpc } from "./ipcMain";
@ -100,19 +100,6 @@ if (!IS_VANILLA) {
super(options); super(options);
initIpc(this); initIpc(this);
// Workaround for https://github.com/electron/electron/issues/43367. Vesktop also has its own workaround
// @TODO: Remove this when the issue is fixed
if (IS_DISCORD_DESKTOP) {
this.webContents.on("devtools-opened", () => {
if (!nativeTheme.shouldUseDarkColors) return;
nativeTheme.themeSource = "light";
setTimeout(() => {
nativeTheme.themeSource = "dark";
}, 100);
});
}
} else super(options); } else super(options);
} }
} }

View file

@ -159,7 +159,7 @@ export default definePlugin({
] ]
}, },
{ {
find: ".FOLDER_ITEM_GUILD_ICON_MARGIN);", find: ".expandedFolderBackground,",
predicate: () => settings.store.sidebar, predicate: () => settings.store.sidebar,
replacement: [ replacement: [
// We use arguments[0] to access the isBetterFolders variable in this nested folder component (the parent exports all the props so we don't have to patch it) // We use arguments[0] to access the isBetterFolders variable in this nested folder component (the parent exports all the props so we don't have to patch it)
@ -185,7 +185,7 @@ export default definePlugin({
{ {
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar // Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always, predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
match: /(?<=\.wrapper,children:\[)/, match: /(?<=\.isExpanded\),children:\[)/,
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&" replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&"
}, },
{ {

View file

@ -75,10 +75,11 @@ export default definePlugin({
patches: [{ patches: [{
find: "renderConnectionStatus(){", find: "renderConnectionStatus(){",
replacement: { replacement: {
match: /(?<=renderConnectionStatus\(\)\{.+\.channel,children:)\i/, match: /(?<=renderConnectionStatus\(\){.+\.channel,children:).+?}\):\i(?=}\))/,
replace: "[$&, $self.renderTimer(this.props.channel.id)]" replace: "[$&, $self.renderTimer(this.props.channel.id)]"
} }
}], }],
renderTimer(channelId: string) { renderTimer(channelId: string) {
return <ErrorBoundary noop> return <ErrorBoundary noop>
<this.Timer channelId={channelId} /> <this.Timer channelId={channelId} />

View file

@ -67,9 +67,16 @@ export default definePlugin({
patches: [ patches: [
{ {
find: 'react-spring: The "interpolate" function', find: "https://github.com/highlightjs/highlight.js/issues/2277",
replacement: { replacement: {
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/, match: /(?<=&&\()console.log\(`Deprecated.+?`\),/,
replace: ""
}
},
{
find: 'The "interpolate" function is deprecated in v10 (use "to" instead)',
replacement: {
match: /,console.warn\(\i\+'The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
replace: "" replace: ""
} }
}, },
@ -126,7 +133,7 @@ export default definePlugin({
{ {
find: "Slow dispatch on", find: "Slow dispatch on",
replacement: { replacement: {
match: /\i\.totalTime>100&&\i\.verbose\("Slow dispatch on ".+?\)\);/, match: /\i\.totalTime>\i&&\i\.verbose\("Slow dispatch on ".+?\)\);/,
replace: "" replace: ""
} }
}, },

View file

@ -16,11 +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 { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("DisableCallIdle", "DisableDMCallIdle");
export default definePlugin({ export default definePlugin({
name: "DisableCallIdle", name: "DisableCallIdle",
description: "Disables automatically getting kicked from a DM voice call after 3 minutes and being moved to an AFK voice channel.", description: "Disables automatically getting kicked from a DM voice call after 3 minutes and being moved to an AFK voice channel.",

View file

@ -207,8 +207,8 @@ function makeBypassPatches(): Omit<Patch, "plugin"> {
return { return {
find: "canUseCustomStickersEverywhere:", find: "canUseCustomStickersEverywhere:",
replacement: mapping.map(({ func, predicate }) => ({ replacement: mapping.map(({ func, predicate }) => ({
match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`), match: new RegExp(String.raw`(?<=${func}:)\i`),
replace: "return true;", replace: "() => true",
predicate predicate
})) }))
}; };
@ -297,8 +297,8 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// Overwrite incoming connection settings proto with our local settings // Overwrite incoming connection settings proto with our local settings
match: /CONNECTION_OPEN:function\((\i)\){/, match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/,
replace: (m, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`
}, },
{ {
// Overwrite non local proto changes with our local settings // Overwrite non local proto changes with our local settings

View file

@ -57,7 +57,7 @@ export default definePlugin({
{ {
// https://regex101.com/r/x2mobQ/1 // https://regex101.com/r/x2mobQ/1
// searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length) // searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length)
match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(\i-\i\.length)\)/, match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2})\)/,
// ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis) // ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis)
replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)" replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)"
} }

View file

@ -346,35 +346,35 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// Add deleted=true to all target messages in the MESSAGE_DELETE event // Add deleted=true to all target messages in the MESSAGE_DELETE event
match: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
replace: replace:
"MESSAGE_DELETE:function($1){" + "function $1($2){" +
" var cache = $2getOrCreate($1.channelId);" + " var cache = $3getOrCreate($2.channelId);" +
" cache = $self.handleDelete(cache, $1, false);" + " cache = $self.handleDelete(cache, $2, false);" +
" $2commit(cache);" + " $3commit(cache);" +
"}," "}"
}, },
{ {
// Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event // Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event
match: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/, match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/,
replace: replace:
"MESSAGE_DELETE_BULK:function($1){" + "function $1($2){" +
" var cache = $2getOrCreate($1.channelId);" + " var cache = $3getOrCreate($2.channelId);" +
" cache = $self.handleDelete(cache, $1, true);" + " cache = $self.handleDelete(cache, $2, true);" +
" $2commit(cache);" + " $3commit(cache);" +
"}," "}"
}, },
{ {
// Add current cached content + new edit time to cached message's editHistory // Add current cached content + new edit time to cached message's editHistory
match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/, match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/,
replace: "$1" + replace: "$1" +
".update($3,m =>" + ".update($4,m =>" +
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message, true)) ? m :" + " (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" +
" $2.message.edited_timestamp && $2.message.content !== m.content ?" + " $3.message.edited_timestamp && $3.message.content !== m.content ?" +
" m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" + " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" +
" m" + " m" +
")" + ")" +
".update($3" ".update($4"
}, },
{ {
// fix up key (edit last message) attempting to edit a deleted message // fix up key (edit last message) attempting to edit a deleted message
@ -488,12 +488,12 @@ export default definePlugin({
find: '"ReferencedMessageStore"', find: '"ReferencedMessageStore"',
replacement: [ replacement: [
{ {
match: /MESSAGE_DELETE:function\((\i)\).+?},/, match: /MESSAGE_DELETE:\i,/,
replace: "MESSAGE_DELETE:function($1){}," replace: "MESSAGE_DELETE:()=>{},"
}, },
{ {
match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/, match: /MESSAGE_DELETE_BULK:\i,/,
replace: "MESSAGE_DELETE_BULK:function($1){}," replace: "MESSAGE_DELETE_BULK:()=>{},"
} }
] ]
}, },

View file

@ -183,8 +183,8 @@ export default definePlugin({
{ {
find: ".ORIGINAL_POSTER=", find: ".ORIGINAL_POSTER=",
replacement: { replacement: {
match: /\((\i)=\{\}\)\)\[(\i)\.BOT/, match: /(?=(\i)\[\i\.BOT)/,
replace: "($1=$self.getTagTypes()))[$2.BOT" replace: "$self.genTagTypes($1);"
} }
}, },
{ {
@ -280,8 +280,7 @@ export default definePlugin({
.filter(Boolean); .filter(Boolean);
}, },
getTagTypes() { genTagTypes(obj) {
const obj = {};
let i = 100; let i = 100;
tags.forEach(({ name }) => { tags.forEach(({ name }) => {
obj[name] = ++i; obj[name] = ++i;
@ -291,7 +290,6 @@ export default definePlugin({
obj[`${name}-OP`] = ++i; obj[`${name}-OP`] = ++i;
obj[i] = `${name}-OP`; obj[i] = `${name}-OP`;
}); });
return obj;
}, },
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]), isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),

View file

@ -20,7 +20,7 @@ import {
findGroupChildrenByChildId, findGroupChildrenByChildId,
NavContextMenuPatchCallback NavContextMenuPatchCallback
} from "@api/ContextMenu"; } from "@api/ContextMenu";
import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { CogWheel } from "@components/Icons"; 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";
@ -115,8 +115,6 @@ function applyDefaultSettings(guildId: string | null) {
} }
} }
migratePluginSettings("NewGuildSettings", "MuteNewGuild");
export default definePlugin({ export default definePlugin({
name: "NewGuildSettings", name: "NewGuildSettings",
description: "Automatically mute new servers and change various other settings upon joining", description: "Automatically mute new servers and change various other settings upon joining",

View file

@ -54,8 +54,8 @@ export default definePlugin({
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true, predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
replacement: [ replacement: [
{ {
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
replace: (_, props) => `if($self.isBlocked(${props}.message))return;` replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;`
} }
] ]
})) }))

View file

@ -74,10 +74,10 @@ export default definePlugin({
// This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests) // This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests)
// In short, only the red badge is hidden. Button visibility behavior isn't changed. // In short, only the red badge is hidden. Button visibility behavior isn't changed.
{ {
find: ".getSpamChannelsCount()", find: ".getSpamChannelsCount();return",
predicate: () => settings.store.hideMessageRequestsCount, predicate: () => settings.store.hideMessageRequestsCount,
replacement: { replacement: {
match: /(?<=getSpamChannelsCount\(\),\i=)\i\.getMessageRequestsCount\(\)/, match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/,
replace: "$self.getRealMessageRequestCount()" replace: "$self.getRealMessageRequestCount()"
} }
}, },

View file

@ -16,20 +16,27 @@
* 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 { getUserSettingLazy } from "@api/UserSettings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
const DisableStreamPreviews = getUserSettingLazy<boolean>("voiceAndVideo", "disableStreamPreviews")!;
// @TODO: Delete this plugin in the future
export default definePlugin({ export default definePlugin({
name: "NoScreensharePreview", name: "NoScreensharePreview",
description: "Disables screenshare previews from being sent.", description: "Disables screenshare previews from being sent.",
authors: [Devs.Nuckyz], authors: [Devs.Nuckyz],
patches: [
{ start() {
find: '"ApplicationStreamPreviewUploadManager"', if (!DisableStreamPreviews.getSetting()) {
replacement: { DisableStreamPreviews.updateSetting(true);
match: /await \i\.\i\.(makeChunkedRequest\(|post\(\{url:)\i\.\i\.STREAM_PREVIEW.+?\}\)/g, }
replace: "0" },
stop() {
if (DisableStreamPreviews.getSetting()) {
DisableStreamPreviews.updateSetting(false);
} }
} }
]
}); });

View file

@ -16,7 +16,7 @@
* 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, migratePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType, ReporterTestable } from "@utils/types"; import definePlugin, { OptionType, ReporterTestable } from "@utils/types";
import { FluxDispatcher } from "@webpack/common"; import { FluxDispatcher } from "@webpack/common";
@ -41,7 +41,6 @@ const settings = definePluginSettings({
}, },
}); });
migratePluginSettings("PartyMode", "Party mode 🎉");
export default definePlugin({ export default definePlugin({
name: "PartyMode", name: "PartyMode",
description: "Allows you to use party mode cause the party never ends ✨", description: "Allows you to use party mode cause the party never ends ✨",

View file

@ -5,7 +5,6 @@
*/ */
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { Menu } from "@webpack/common"; import { Menu } from "@webpack/common";
@ -25,7 +24,6 @@ const Patch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild;
); );
}; };
migratePluginSettings("ServerInfo", "ServerProfile"); // what was I thinking with this name lmao
export default definePlugin({ export default definePlugin({
name: "ServerInfo", name: "ServerInfo",
description: "Allows you to view info about a server", description: "Allows you to view info about a server",

View file

@ -168,7 +168,7 @@ export default definePlugin({
}, },
// Add the hidden eye icon if the channel is hidden // Add the hidden eye icon if the channel is hidden
{ {
match: /\.name\),.{0,120}\.children.+?:null(?<=,channel:(\i).+?)/, match: /\.name,{.{0,140}\.children.+?:null(?<=,channel:(\i).+?)/,
replace: (m, channel) => `${m},$self.isHiddenChannel(${channel})?$self.HiddenChannelIcon():null` replace: (m, channel) => `${m},$self.isHiddenChannel(${channel})?$self.HiddenChannelIcon():null`
}, },
// Make voice channels also appear as muted if they are muted // Make voice channels also appear as muted if they are muted

View file

@ -16,7 +16,7 @@
* 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, migratePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType, PluginSettingDef } from "@utils/types"; import definePlugin, { OptionType, PluginSettingDef } from "@utils/types";
@ -35,7 +35,6 @@ const settings = definePluginSettings({
disableDisallowedDiscoveryFilters: opt("Disable filters in Server Discovery search that hide NSFW & disallowed servers."), disableDisallowedDiscoveryFilters: opt("Disable filters in Server Discovery search that hide NSFW & disallowed servers."),
}); });
migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
export default definePlugin({ export default definePlugin({
name: "ShowHiddenThings", name: "ShowHiddenThings",
tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"], tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],

View file

@ -163,7 +163,7 @@ export default definePlugin({
{ {
find: "UNREAD_IMPORTANT:", find: "UNREAD_IMPORTANT:",
replacement: { replacement: {
match: /\.name\),.{0,120}\.children.+?:null(?<=,channel:(\i).+?)/, match: /\.name,{.{0,140}\.children.+?:null(?<=,channel:(\i).+?)/,
replace: "$&,$self.TypingIndicator($1.id,$1.getGuildId())" replace: "$&,$self.TypingIndicator($1.id,$1.getGuildId())"
} }
}, },

View file

@ -91,34 +91,31 @@ export default definePlugin({
name: "TypingTweaks", name: "TypingTweaks",
description: "Show avatars and role colours in the typing indicator", description: "Show avatars and role colours in the typing indicator",
authors: [Devs.zt], authors: [Devs.zt],
settings,
patches: [ patches: [
{
find: "#{intl::THREE_USERS_TYPING}",
replacement: [
{
// Style the indicator and add function call to modify the children before rendering // Style the indicator and add function call to modify the children before rendering
{ match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i(?<=guildId:(\i).+?)/,
find: "getCooldownTextStyle", replace: "$self.mutateChildren($2,$1,$&),style:$self.TYPING_TEXT_STYLE"
replacement: {
match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i/,
replace: "$self.mutateChildren(this.props, $1, $&), style: $self.TYPING_TEXT_STYLE"
}
}, },
{
// Changes the indicator to keep the user object when creating the list of typing users // Changes the indicator to keep the user object when creating the list of typing users
{ match: /\.map\((\i)=>\i\.\i\.getName\(\i,\i\.id,\1\)\)/,
find: "getCooldownTextStyle", replace: ""
replacement: {
match: /(?<=map\(\i=>)\i\.\i\.getName\(\i,this\.props\.channel\.id,(\i)\)/,
replace: "$1"
}
}, },
{
// Adds the alternative formatting for several users typing // Adds the alternative formatting for several users typing
{ match: /(,{a:(\i),b:(\i),c:\i}\):\i\.length>3&&\(\i=)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/,
find: "getCooldownTextStyle", replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })`,
replacement: {
match: /(,{a:(\i),b:(\i),c:\i}\):)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/,
replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })`
},
predicate: () => settings.store.alternativeFormatting predicate: () => settings.store.alternativeFormatting
} }
]
}
], ],
settings,
TYPING_TEXT_STYLE: { TYPING_TEXT_STYLE: {
display: "grid", display: "grid",
@ -128,7 +125,7 @@ export default definePlugin({
buildSeveralUsers, buildSeveralUsers,
mutateChildren(props: any, users: User[], children: any) { mutateChildren(guildId: any, users: User[], children: any) {
try { try {
if (!Array.isArray(children)) { if (!Array.isArray(children)) {
return children; return children;
@ -138,7 +135,7 @@ export default definePlugin({
return children.map(c => return children.map(c =>
c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c)) c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c))
? <TypingUser {...props} user={users[element++]} /> ? <TypingUser guildId={guildId} user={users[element++]} />
: c : c
); );
} catch (e) { } catch (e) {

View file

@ -94,7 +94,7 @@ export default definePlugin({
find: "AudioContextSettingsMigrated", find: "AudioContextSettingsMigrated",
replacement: [ replacement: [
{ {
match: /(?<=isLocalMute\(\i,\i\),volume:.+?volume:)\i(?=})/, match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/,
replace: "$&>200?200:$&" replace: "$&>200?200:$&"
}, },
{ {
@ -109,7 +109,7 @@ export default definePlugin({
}, },
// Prevent the MediaEngineStore from overwriting our LocalVolumes above 200 with the ones the Discord Audio Context Settings sync sends // Prevent the MediaEngineStore from overwriting our LocalVolumes above 200 with the ones the Discord Audio Context Settings sync sends
{ {
find: '"MediaEngineStore"', find: '="MediaEngineStore",',
replacement: [ replacement: [
{ {
match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/, match: /(\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/,

View file

@ -164,8 +164,8 @@ export default definePlugin({
find: 'getElementById("slate-toolbar"', find: 'getElementById("slate-toolbar"',
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: { replacement: {
match: /(?<=handleContextMenu\(\i\)\{.{0,200}isPlatformEmbedded)\?/, match: /(?<=handleContextMenu\(\i\)\{.{0,200}isPlatformEmbedded)\)/,
replace: "||true?" replace: "||true)"
} }
}, },
{ {

View file

@ -113,8 +113,8 @@ export default definePlugin({
{ {
find: '"MessageReactionsStore"', find: '"MessageReactionsStore"',
replacement: { replacement: {
match: /(?<=CONNECTION_OPEN:function\(\){)(\i)={}/, match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/,
replace: "$&;$self.reactions=$1" replace: "$&;$self.reactions=$2;"
} }
}, },
{ {

View file

@ -4,12 +4,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
// The entire code of this plugin can be found in native.ts // The entire code of this plugin can be found in native.ts
migratePluginSettings("YoutubeAdblock", "WatchTogetherAdblock");
export default definePlugin({ export default definePlugin({
name: "YoutubeAdblock", name: "YoutubeAdblock",
description: "Block ads in YouTube embeds and the WatchTogether activity via AdGuard", description: "Block ads in YouTube embeds and the WatchTogether activity via AdGuard",