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: () => {
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
for (const [key, command] of Object.entries(commandMap)) {
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: () => {
console.log("[Commands Plugin] Unloading...");
<<<<<<< HEAD
// Unregister commands
commands.forEach((unregister) => {
try {
@ -165,30 +150,17 @@ 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,
=======
// 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...");
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();
},
=======
// 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() {
console.log("[Multi-Scrobbler] Unloading...");
pluginState.pluginStopped = true;
<<<<<<< HEAD
=======
// 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 {
// Unpatch sidebar
if (sidebarUnpatch) {
try {
sidebarUnpatch();
} catch (e) {
console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", e);
}
sidebarUnpatch = undefined;
console.log("[Multi-Scrobbler] Sidebar disabled");
try {
sidebarUnpatch();
sidebarUnpatch = undefined;
console.log("[Multi-Scrobbler] Sidebar unpatched");
} catch (error) {
console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", error);
}
}
}
}
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();
},
async onSettingsUpdate(newSettings: any) {
const oldService = currentSettings.service;
const newService = newSettings.service;
const oldSidebar = currentSettings.addToSidebar;
const newSidebar = newSettings.addToSidebar;
<<<<<<< HEAD
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 {
@ -243,7 +213,3 @@ export default {
settings: Settings,
};
=======
settings: Settings,
};
>>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they)

View file

@ -229,7 +229,6 @@ export default function Settings() {
/>
</TableRowGroup>
<<<<<<< HEAD
{/* Plugin Configuration */}
<TableRowGroup title="Plugin Configuration">
<TableRow
@ -284,67 +283,8 @@ export default function Settings() {
setStorage("addToSidebar", value);
forceUpdate();
}}
disabled={true}
/>
</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 */}
<TableRowGroup title="About">