fix: fucked plugins

This commit is contained in:
kmmiio99o 2026-05-24 16:35:16 +02:00
parent 6b5ff87d66
commit 576299f2c7
No known key found for this signature in database
GPG key ID: AC9D7747D423B9BF
3 changed files with 63 additions and 185 deletions

View file

@ -113,7 +113,16 @@ export default {
onLoad: () => { onLoad: () => {
console.log("[Commands Plugin] Loading..."); console.log("[Commands Plugin] Loading...");
<<<<<<< HEAD // 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 // Register commands
for (const [key, command] of Object.entries(commandMap)) { for (const [key, command] of Object.entries(commandMap)) {
if (storage.enabledCommands[key]) { if (storage.enabledCommands[key]) {
@ -127,35 +136,11 @@ export default {
); );
} }
} }
=======
// 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]) {
try {
commands.push(registerCommand(command as any));
console.log(`[Commands Plugin] Registered command: ${key}`);
} catch (error) {
console.error(
`[Commands Plugin] Failed to register command ${key}:`,
error,
);
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)
} }
}, },
onUnload: () => { onUnload: () => {
console.log("[Commands Plugin] Unloading..."); console.log("[Commands Plugin] Unloading...");
<<<<<<< HEAD
// Unregister commands // Unregister commands
commands.forEach((unregister) => { commands.forEach((unregister) => {
try { try {
@ -165,30 +150,17 @@ export default {
} }
}); });
commands = []; 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, settings,
=======
// Unregister commands
commands.forEach((unregister) => {
try {
unregister();
} catch (error) {
// Ignore errors during cleanup
}
});
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,
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)
}; };

View file

@ -124,97 +124,67 @@ export default {
console.log("[Multi-Scrobbler] Loading..."); console.log("[Multi-Scrobbler] Loading...");
pluginState.pluginStopped = false; pluginState.pluginStopped = false;
<<<<<<< HEAD // 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(); validateAndInitialize();
}, },
=======
// 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();
},
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)
onUnload() { onUnload() {
console.log("[Multi-Scrobbler] Unloading..."); console.log("[Multi-Scrobbler] Unloading...");
pluginState.pluginStopped = true; pluginState.pluginStopped = true;
<<<<<<< HEAD // Unpatch sidebar
=======
// 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) { if (sidebarUnpatch) {
try { try {
sidebarUnpatch(); sidebarUnpatch();
} catch (e) { sidebarUnpatch = undefined;
console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", e); console.log("[Multi-Scrobbler] Sidebar unpatched");
} } catch (error) {
sidebarUnpatch = undefined; console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", error);
console.log("[Multi-Scrobbler] Sidebar disabled"); }
} }
}
}
if (oldService !== newService && newService) {
console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`);
try {
await switchService(newService);
} catch (e) {
console.error("[Multi-Scrobbler] Failed to switch service:", e);
}
} else if (!pluginState.pluginStopped && currentSettings.service) {
tryInitialize();
} else if (!currentSettings.service) {
console.log("[Multi-Scrobbler] Service unselected, stopping plugin...");
try {
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)
stop(); stop();
}, },
async onSettingsUpdate(newSettings: any) { async onSettingsUpdate(newSettings: any) {
const oldService = currentSettings.service; const oldService = currentSettings.service;
const newService = newSettings.service; const newService = newSettings.service;
const oldSidebar = currentSettings.addToSidebar;
const newSidebar = newSettings.addToSidebar;
<<<<<<< HEAD
Object.assign(currentSettings, newSettings); 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) { if (oldService !== newService && newService) {
console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`); console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`);
try { try {
@ -243,7 +213,3 @@ export default {
settings: Settings, settings: Settings,
}; };
=======
settings: Settings,
};
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)

View file

@ -229,7 +229,6 @@ export default function Settings() {
/> />
</TableRowGroup> </TableRowGroup>
<<<<<<< HEAD
{/* Plugin Configuration */} {/* Plugin Configuration */}
<TableRowGroup title="Plugin Configuration"> <TableRowGroup title="Plugin Configuration">
<TableRow <TableRow
@ -284,67 +283,8 @@ export default function Settings() {
setStorage("addToSidebar", value); setStorage("addToSidebar", value);
forceUpdate(); forceUpdate();
}} }}
disabled={true}
/> />
</TableRowGroup> </TableRowGroup>
=======
{/* Plugin Configuration */}
<TableRowGroup title="Plugin Configuration">
<TableRow
label="Display Settings"
subLabel="Customize app name and update interval"
trailing={<TableRow.Arrow />}
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Display Settings",
render: DisplaySettingsPage,
})
}
/>
<TableRow
label="RPC Customization"
subLabel="Customize Discord rich presence display options"
trailing={<TableRow.Arrow />}
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "RPC Customization",
render: RPCCustomizationSettingsPage,
})
}
/>
<TableRow
label="Ignore List"
subLabel="Configure apps that should hide your status"
trailing={<TableRow.Arrow />}
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Ignore List Settings",
render: IgnoreListSettingsPage,
})
}
/>
<TableRow
label="Logging Settings"
subLabel="Configure logging and debugging options"
trailing={<TableRow.Arrow />}
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Logging Settings",
render: LoggingSettingsPage,
})
}
/>
<TableSwitchRow
label="Add to Sidebar"
subLabel="Show plugin in Discord settings"
value={getStorage("addToSidebar", false)}
onValueChange={(value: boolean) => {
setStorage("addToSidebar", value);
forceUpdate();
}}
/>
</TableRowGroup>
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)
{/* About */} {/* About */}
<TableRowGroup title="About"> <TableRowGroup title="About">