From ecd97c7018767264e1e8287f71fdfb49168aa7b3 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Thu, 7 May 2026 15:45:51 +0200 Subject: [PATCH] feat: detach Sidebar patches as they causes crash on settings page on newest alpha --- plugins/Commands/index.ts | 27 ---------- plugins/Commands/settings/settings.tsx | 4 +- plugins/multi-scrobbler/src/index.tsx | 52 +------------------ .../multi-scrobbler/src/ui/pages/Settings.tsx | 1 + 4 files changed, 4 insertions(+), 80 deletions(-) diff --git a/plugins/Commands/index.ts b/plugins/Commands/index.ts index 9294235..6329f73 100644 --- a/plugins/Commands/index.ts +++ b/plugins/Commands/index.ts @@ -26,7 +26,6 @@ import { friendInviteRevokeCommand, } from "./src/commands/friendinvites"; import settings from "./settings/settings"; -import patchSidebar from "./sidebar"; if (!storage.factSettings) { storage.factSettings = { @@ -77,10 +76,6 @@ if (!storage.hiddenSettings) { konochanBypassNsfw: false, }; } -// sidebar enabled setting -if (storage.sidebarEnabled === undefined) { - storage.sidebarEnabled = true; -} const commandMap = { catfact: catFactCommand, @@ -107,22 +102,11 @@ const commandMap = { }; let commands: Array<() => void> = []; -let sidebarUnpatch: (() => void) | undefined; export default { onLoad: () => { console.log("[Commands Plugin] Loading..."); - // Patch sidebar if enabled - if (storage.sidebarEnabled !== false) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Commands Plugin] Sidebar patched successfully"); - } catch (error) { - console.error("[Commands Plugin] Failed to patch sidebar:", error); - } - } - // Register commands for (const [key, command] of Object.entries(commandMap)) { if (storage.enabledCommands[key]) { @@ -150,17 +134,6 @@ export default { } }); commands = []; - - // Unpatch sidebar - if (sidebarUnpatch) { - try { - sidebarUnpatch(); - sidebarUnpatch = undefined; - console.log("[Commands Plugin] Sidebar unpatched"); - } catch (error) { - console.error("[Commands Plugin] Failed to unpatch sidebar:", error); - } - } }, settings, }; diff --git a/plugins/Commands/settings/settings.tsx b/plugins/Commands/settings/settings.tsx index a64359d..5a4a814 100644 --- a/plugins/Commands/settings/settings.tsx +++ b/plugins/Commands/settings/settings.tsx @@ -71,8 +71,8 @@ storage.hiddenSettings ??= { konochanBypassNsfw: false, }; -// Sidebar setting (enabled by default) -storage.sidebarEnabled ??= true; +// Sidebar setting +storage.sidebarEnabled ??= false; // MAIN SETTINGS COMPONENT export default function Settings() { diff --git a/plugins/multi-scrobbler/src/index.tsx b/plugins/multi-scrobbler/src/index.tsx index 873b497..0fec2f7 100644 --- a/plugins/multi-scrobbler/src/index.tsx +++ b/plugins/multi-scrobbler/src/index.tsx @@ -8,7 +8,6 @@ import { UserStore } from "./modules"; import { serviceFactory } from "./services/ServiceFactory"; import Settings from "./ui/pages/Settings"; -import patchSidebar from "./sidebar"; export const pluginState = { pluginStopped: false, @@ -22,8 +21,6 @@ export const pluginState = { lastTrackUrl?: string; }; -let sidebarUnpatch: (() => void) | undefined; - // Initialize default settings const defaultSettings: LFMSettings = Constants.DEFAULT_SETTINGS; Object.keys(defaultSettings).forEach((key) => { @@ -31,8 +28,6 @@ Object.keys(defaultSettings).forEach((key) => { plugin.storage[key] ?? defaultSettings[key as keyof typeof defaultSettings]; }); -plugin.storage.addToSidebar ??= false; - export const currentSettings = new Proxy(plugin.storage, { get(target, prop: string) { return target[prop]; @@ -124,16 +119,6 @@ export default { console.log("[Multi-Scrobbler] Loading..."); pluginState.pluginStopped = false; - // Patch sidebar if enabled - if (currentSettings.addToSidebar !== false) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Multi-Scrobbler] Sidebar patched successfully"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to patch sidebar:", error); - } - } - validateAndInitialize(); }, @@ -141,50 +126,15 @@ export default { console.log("[Multi-Scrobbler] Unloading..."); pluginState.pluginStopped = true; - // Unpatch sidebar - if (sidebarUnpatch) { - try { - sidebarUnpatch(); - sidebarUnpatch = undefined; - console.log("[Multi-Scrobbler] Sidebar unpatched"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", error); - } - } - stop(); }, async onSettingsUpdate(newSettings: any) { const oldService = currentSettings.service; const newService = newSettings.service; - const oldSidebar = currentSettings.addToSidebar; - const newSidebar = newSettings.addToSidebar; Object.assign(currentSettings, newSettings); - // Check if sidebar setting changed - if (oldSidebar !== newSidebar) { - if (newSidebar) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Multi-Scrobbler] Sidebar enabled"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to enable sidebar:", error); - } - } else { - if (sidebarUnpatch) { - try { - sidebarUnpatch(); - } catch (e) { - console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", e); - } - sidebarUnpatch = undefined; - console.log("[Multi-Scrobbler] Sidebar disabled"); - } - } - } - if (oldService !== newService && newService) { console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`); try { @@ -212,4 +162,4 @@ export default { }, settings: Settings, -}; \ No newline at end of file +}; diff --git a/plugins/multi-scrobbler/src/ui/pages/Settings.tsx b/plugins/multi-scrobbler/src/ui/pages/Settings.tsx index c716a27..f633b27 100644 --- a/plugins/multi-scrobbler/src/ui/pages/Settings.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/Settings.tsx @@ -283,6 +283,7 @@ export default function Settings() { setStorage("addToSidebar", value); forceUpdate(); }} + disabled={true} />