Merge branch 'dev' into modules-proxy-patches
This commit is contained in:
commit
9595f75a9a
|
@ -182,7 +182,7 @@ export default definePlugin({
|
||||||
patchedSettings: new WeakSet(),
|
patchedSettings: new WeakSet(),
|
||||||
|
|
||||||
addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) {
|
addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) {
|
||||||
if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return;
|
if (this.patchedSettings.has(elements)) return;
|
||||||
|
|
||||||
this.patchedSettings.add(elements);
|
this.patchedSettings.add(elements);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ async function embedDidMount(this: Component<Props>) {
|
||||||
|
|
||||||
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
||||||
embed.dearrow.oldTitle = embed.rawTitle;
|
embed.dearrow.oldTitle = embed.rawTitle;
|
||||||
embed.rawTitle = titles[0].title.replace(/ >(\S)/g, " $1");
|
embed.rawTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
import { registerCommand, unregisterCommand } from "@api/Commands";
|
import { registerCommand, unregisterCommand } from "@api/Commands";
|
||||||
import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu";
|
import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu";
|
||||||
import { Settings } from "@api/Settings";
|
import { Settings } from "@api/Settings";
|
||||||
|
import { onceDefined } from "@shared/onceDefined";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { canonicalizeFind } from "@utils/patches";
|
import { canonicalizeFind } from "@utils/patches";
|
||||||
import { Patch, Plugin, ReporterTestable, StartAt } from "@utils/types";
|
import { Patch, Plugin, ReporterTestable, StartAt } from "@utils/types";
|
||||||
|
@ -33,7 +34,7 @@ const logger = new Logger("PluginManager", "#a6d189");
|
||||||
|
|
||||||
export const PMLogger = logger;
|
export const PMLogger = logger;
|
||||||
export const plugins = Plugins;
|
export const plugins = Plugins;
|
||||||
export const patches = [] as Patch[];
|
export let patches = [] as Patch[];
|
||||||
|
|
||||||
/** Whether we have subscribed to flux events of all the enabled plugins when FluxDispatcher was ready */
|
/** Whether we have subscribed to flux events of all the enabled plugins when FluxDispatcher was ready */
|
||||||
let enabledPluginsSubscribedFlux = false;
|
let enabledPluginsSubscribedFlux = false;
|
||||||
|
@ -42,6 +43,16 @@ const subscribedFluxEventsPlugins = new Set<string>();
|
||||||
const pluginsValues = Object.values(Plugins);
|
const pluginsValues = Object.values(Plugins);
|
||||||
const settings = Settings.plugins;
|
const settings = Settings.plugins;
|
||||||
|
|
||||||
|
const forceDisabled = new Set([
|
||||||
|
"MessageLogger",
|
||||||
|
"ShowHiddenChannels",
|
||||||
|
"MoreUserTags",
|
||||||
|
"Decor",
|
||||||
|
"IgnoreActivities",
|
||||||
|
"NoBlockedMessages",
|
||||||
|
"BetterFolders",
|
||||||
|
"NoPendingCount"
|
||||||
|
]);
|
||||||
export function isPluginEnabled(p: string) {
|
export function isPluginEnabled(p: string) {
|
||||||
return (
|
return (
|
||||||
Plugins[p]?.required ||
|
Plugins[p]?.required ||
|
||||||
|
@ -122,9 +133,17 @@ for (const p of pluginsValues) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onceDefined(window, "GLOBAL_ENV", v => {
|
||||||
|
if (v.SENTRY_TAGS.buildId !== "366c746173a6ca0a801e9f4a4d7b6745e6de45d4") {
|
||||||
|
patches = patches.filter(p => !forceDisabled.has(p.plugin));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins(target: StartAt) {
|
export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins(target: StartAt) {
|
||||||
logger.info(`Starting plugins (stage ${target})`);
|
logger.info(`Starting plugins (stage ${target})`);
|
||||||
for (const name in Plugins) {
|
for (const name in Plugins) {
|
||||||
|
if (window.GLOBAL_ENV?.SENTRY_TAGS.buildId !== "366c746173a6ca0a801e9f4a4d7b6745e6de45d4" && forceDisabled.has(name)) continue;
|
||||||
|
|
||||||
if (isPluginEnabled(name) && (!IS_REPORTER || isReporterTestable(Plugins[name], ReporterTestable.Start))) {
|
if (isPluginEnabled(name) && (!IS_REPORTER || isReporterTestable(Plugins[name], ReporterTestable.Start))) {
|
||||||
const p = Plugins[name];
|
const p = Plugins[name];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue