fix PinDMs & DisableCallIdle; remove some legacy code

This commit is contained in:
Vendicated 2026-02-05 23:45:29 +01:00
parent 3d4cf25659
commit e40189e365
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
13 changed files with 28 additions and 78 deletions

View file

@ -55,7 +55,8 @@ export default definePlugin({
{
// ...children: p?.name
match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/,
replace: "$1.plugin||($&)"
replace: "$1.plugin||($&)",
noWarn: true // TODO: remove legacy compatibility code in the future
},
{
match: /children:(?=\i\?\?\i\?\.name)(?<=command:(\i),.+?)/,

View file

@ -15,10 +15,6 @@ export default definePlugin({
{
find: "renderHeaderContent(){",
replacement: [
{
match: /(?<="state",{resultType:)null/,
replace: '"Favorites"'
},
{
match: /(?<=state={resultType:)null/,
replace: '"Favorites"'

View file

@ -148,10 +148,6 @@ export default definePlugin({
{
find: "is not a valid locale.",
replacement: [
{
match: /\i\.error(?=\(""\.concat\(\i," is not a valid locale."\)\))/,
replace: "$self.Noop"
},
{
match: /\i\.error(?=\(`\$\{\i\} is not a valid locale.`)/,
replace: "$self.Noop"
@ -167,16 +163,10 @@ export default definePlugin({
},
{
find: "RPCServer:WSS",
replacement: [
{
match: /\i\.error\("Error: "\.concat\((\i)\.message/,
replace: '!$1.message.includes("EADDRINUSE")&&$&'
},
{
match: /\i\.error\(`Error: \$\{(\i)\.message\}/,
replace: '!$1.message.includes("EADDRINUSE")&&$&'
}
]
replacement: {
match: /\i\.error\(`Error: \$\{(\i)\.message\}/,
replace: '!$1.message.includes("EADDRINUSE")&&$&'
}
},
{
find: "Tried getting Dispatch instance before instantiated",
@ -195,10 +185,6 @@ export default definePlugin({
{
find: "failed to send analytics events",
replacement: [
{
match: /console\.error\("\[analytics\] failed to send analytics events query: "\.concat\(\i\)\)/,
replace: ""
},
{
match: /console\.error\(`\[analytics\] failed to send analytics events query: \$\{\i\}`\)/,
replace: ""

View file

@ -25,18 +25,20 @@ export default definePlugin({
authors: [Devs.Nuckyz],
patches: [
{
find: "#{intl::BOT_CALL_IDLE_DISCONNECT_2}",
find: "this.idleTimeout.start(",
replacement: {
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
replace: ";return;"
match: /this\.idleTimeout\.(start|stop)/g,
replace: "$self.noop"
}
},
{
find: "handleIdleUpdate(){",
replacement: {
match: /(?<=_initialize\(\){)/,
replace: "return;"
match: "handleIdleUpdate(){",
replace: "handleIdleUpdate(){return;"
}
}
]
],
noop() { }
});

View file

@ -49,16 +49,10 @@ export default definePlugin({
patches: [{
find: ".USER_MENTION)",
replacement: [
{
match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/,
replace: "children:$self.renderUsername({username:$1,user:$2})"
},
{
match: /children:`@\$\{(\i\?\?\i)\}`(?<=\.useName\((\i)\).+?)/,
replace: "children:$self.renderUsername({username:$1,user:$2})"
}
]
replacement: {
match: /children:`@\$\{(\i\?\?\i)\}`(?<=\.useName\((\i)\).+?)/,
replace: "children:$self.renderUsername({username:$1,user:$2})"
}
},
{
find: ".ROLE_MENTION)",

View file

@ -24,7 +24,7 @@ interface ColorPickerWithSwatchesProps {
const ColorPickerWithSwatches = findComponentByCodeLazy<ColorPickerWithSwatchesProps>('id:"color-picker"');
export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/);
export const requireSettingsModal = extractAndLoadChunksLazy(['type:"USER_SETTINGS_MODAL_OPEN"']);
const cl = classNameFactory("vc-pindms-modal-");
@ -119,7 +119,7 @@ export function NewCategoryModal({ categoryId, modalProps, initialChannelId }: P
export const openCategoryModal = (categoryId: string | null, channelId: string | null) =>
openModalLazy(async () => {
await requireSettingsMenu();
await requireSettingsModal();
return modalProps => <NewCategoryModal categoryId={categoryId} modalProps={modalProps} initialChannelId={channelId} />;
});

View file

@ -16,11 +16,6 @@ export interface Category {
collapsed?: boolean;
}
const CATEGORY_BASE_KEY = "PinDMsCategories-";
const CATEGORY_MIGRATED_PINDMS_KEY = "PinDMsMigratedPinDMs";
const CATEGORY_MIGRATED_KEY = "PinDMsMigratedOldCategories";
const OLD_CATEGORY_KEY = "BetterPinDMsCategories-";
let forceUpdateDms: (() => void) | undefined = undefined;
export let currentUserCategories: Category[] = [];

View file

@ -16,7 +16,7 @@ import { findCssClassesLazy, findStoreLazy } from "@webpack";
import { Clickable, ContextMenuApi, FluxDispatcher, Menu, React } from "@webpack/common";
import { contextMenus } from "./components/contextMenu";
import { openCategoryModal, requireSettingsMenu } from "./components/CreateCategoryModal";
import { openCategoryModal, requireSettingsModal } from "./components/CreateCategoryModal";
import { DEFAULT_CHUNK_SIZE } from "./constants";
import { canMoveCategory, canMoveCategoryInDirection, Category, categoryLen, collapseCategory, getAllUncollapsedChannels, getCategoryByIndex, getSections, init, isPinned, moveCategory, removeCategory, usePinnedDms } from "./data";
@ -173,7 +173,7 @@ export default definePlugin({
categoryLen,
getSections,
getAllUncollapsedChannels,
requireSettingsMenu,
requireSettingsMenu: requireSettingsModal,
makeProps(instance, { sections }: { sections: number[]; }) {
this._instance = instance;

View file

@ -329,13 +329,6 @@ export default definePlugin({
match: /\i>0(?=&&!\i&&!\i)/,
replace: m => `($self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)?true:${m})`
},
{
// Show only the plus text without overflowed children amount
// if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen
match: /(?<="\+"\.concat\()\i/,
replace: overflowTextAmount => "" +
`$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&(${overflowTextAmount}-1)<=0?"":${overflowTextAmount}`
},
{
// Show only the plus text without overflowed children amount
// if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen

View file

@ -41,10 +41,6 @@ export default definePlugin({
{
find: "#{intl::LABEL_WITH_ONLINE_STATUS}",
replacement: [
{
match: /src:null!=\i\?(\i).{1,50}"aria-hidden":!0/,
replace: "$&,style:$self.getAvatarStyles($1)"
},
{
match: /src:(\i)\?\?void 0.{1,50}"aria-hidden":!0/,
replace: "$&,style:$self.getAvatarStyles($1)"

View file

@ -47,7 +47,8 @@ export default definePlugin({
replacement: [
{
match: /constructor\(\)\{\i\(this,"_channelCaches",new Map\)/,
replace: "$&;$self.setReplyStore(this);"
replace: "$&;$self.setReplyStore(this);",
noWarn: true // TODO: remove legacy compatibility code in the future
},
{
match: /_channelCaches=new Map;/,

View file

@ -206,16 +206,10 @@ export default definePlugin({
// Banners
{
find: 'backgroundColor:"COMPLETE"',
replacement: [
{
match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?"url\("\.concat\(\2,)/,
replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,`
},
{
match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?`url\(\$\{\2\}\))/,
replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,`
}
]
replacement: {
match: /(overflow:"visible",.{0,125}?!1\),)style:{(?=.+?backgroundImage:null!=(\i)\?`url\(\$\{\2\}\))/,
replace: (_, rest, bannerSrc) => `${rest}onClick:()=>${bannerSrc}!=null&&$self.openBanner(${bannerSrc}),style:{cursor:${bannerSrc}!=null?"pointer":void 0,`
}
},
// Group DMs top small & large icon
{

View file

@ -17,10 +17,6 @@ export default definePlugin({
{
find: "x-google-max-bitrate",
replacement: [
{
match: /"x-google-max-bitrate=".concat\(\i\)/,
replace: '"x-google-max-bitrate=".concat("80_000")'
},
{
match: /`x-google-max-bitrate=\$\{\i\}`/,
replace: '"x-google-max-bitrate=80_000"'
@ -29,10 +25,6 @@ export default definePlugin({
match: ";level-asymmetry-allowed=1",
replace: ";b=AS:800000;level-asymmetry-allowed=1"
},
{
match: /;usedtx=".concat\((\i)\?"0":"1"\)/,
replace: '$&.concat($1?";stereo=1;sprop-stereo=1":"")'
},
{
match: /;usedtx=\$\{(\i)\?"0":"1"\}/,
replace: '$&${$1?";stereo=1;sprop-stereo=1":""}'