-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Disable faulty plugins to prevent unrecoverable loop #3094
base: main
Are you sure you want to change the base?
Conversation
I change my mind, I think this is the best way :v |
in its current state this is kinda awful because it will completely overwrite your settings and force you to reenable everything |
it doesn't override settings, it just disables plugins. they can easily be re-enabled and that's why there's a simple button to copy any disabled plugins. and again, this is really only triggered in the worst-case scenario (i.e. when a user cannot disable faulty plugins & they need to access discord). for example, in the latest episode of "vencord broke plz help", (almost) all plugins were broken due to a few changes Discord made. people could not open servers (if they had but as this mentioned, it could probably save the state, although i'm not sure how it would know to re-enable it (maybe by checking new commits? not sure) |
sorry but you cannot "easily re-enable" 100 plugins 😭 if you actually want to make this better, you should not do any disabling and instead add a safe mode functionality that skips starting non essential plugins and such without needing to modify any settings this safe mode could then be used to disable plugins / update / whatever |
doing so would be fairly trivial. you just need to add a new safeMode setting and edit this function: Lines 45 to 51 in 48a9aef
new code would look something like this export function isPluginEnabled(p: string) {
return (
Plugins[p]?.required ||
Plugins[p]?.isDependency ||
(settings[p]?.enabled && !settings.safeMode)
) ?? false;
} |
fair point, i'm coming from the perspective of only having like 4-5 plugins but if you're a power-user then yeah you're right. i'll change this back to a draft and work on it a bit more! |
i'll take a look, ty! |
what I am thinking of: when an unrecoverable crash happens, it should show a popup notifying the user of such and offer them the option to restart in safe mode. now vencord will set the safeMode setting to true and restart the app. once Vencord finished initialising, it should automatically change the setting back to false so the next time the user opens the app it will be normal mode again a command line toggle |
I just saw this! I love your idea, I'll try it that way instead :) |
@Vendicated 👋 As requested, I went ahead and did what you suggested instead, which is as follows:
I think this is much better than what I originally had in mind, let me know what you think! |
why are you overengineering this so much? you just need to edit the isPluginEnabled function, that's it |
in my testing this did not stop it from being loaded, hence why i tapped into addPatch directly (it could be a skill issue/my machine only, but i'm pretty sure it isn't?) |
it is all you have to do |
i took another look, turns out i was wrong! i fixed the isPluginEnabled function & i only run this after the isPluginEnabled check is ran (rather than modifying addPatch/startPlugin): // Disable safe-mode after check is ran
if (settings[p.name].safeMode) settings[p.name].safeMode = false; |
I pushed a fix to this PR since you didn't seem to have understood what I was trying to say and were still vastly overengineering this |
An issue a lot of people have when Discord updates is their plugins break. Sometimes, the update is so significant that Vencord itself is broken (i.e. cannot manually disable plugins). I experienced this issue myself, and so I created a pretty decent solution.
When the user enters an "unrecoverable loop" (this is triggered when Vencord crashes 2x in <1s), we disable all plugins EXCEPT for plugins that are API related (i.e.
CommandsAPI
), plugins that are marked asrequired
(such asNoTrack
), or plugins that are already disabled (why would you disable an already disabled plugin?) & create a notification that lets the user copy the plugins that were disabled (so they can go ahead and re-enable them when Vencord is fixed).This PR is currently a draft as I could probably make the copying part a bit better, but let me know! :)