Fix plugins on stable

This commit is contained in:
Nuckyz 2024-06-18 17:13:57 -03:00
parent 098124175f
commit db6b1f5aaf
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -19,6 +19,7 @@
import { registerCommand, unregisterCommand } from "@api/Commands";
import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu";
import { Settings } from "@api/Settings";
import { onceDefined } from "@shared/onceDefined";
import { Logger } from "@utils/Logger";
import { canonicalizeFind } from "@utils/patches";
import { Patch, Plugin, ReporterTestable, StartAt } from "@utils/types";
@ -33,7 +34,7 @@ const logger = new Logger("PluginManager", "#a6d189");
export const PMLogger = logger;
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 */
let enabledPluginsSubscribedFlux = false;
@ -53,7 +54,6 @@ const forceDisabled = new Set([
"NoPendingCount"
]);
export function isPluginEnabled(p: string) {
if (forceDisabled.has(p)) return false;
return (
Plugins[p]?.required ||
Plugins[p]?.isDependency ||
@ -133,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) {
logger.info(`Starting plugins (stage ${target})`);
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))) {
const p = Plugins[name];