Fake Nitro Transform Stickers option and other stuff (#683)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Nuckyz 2023-04-05 00:06:04 -03:00 committed by GitHub
parent 99391a4f0e
commit 12ffb9d642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 269 additions and 76 deletions

View file

@ -43,6 +43,7 @@ const settings = definePluginSettings({
let crashCount: number = 0;
let lastCrashTimestamp: number = 0;
let shouldAttemptNextHandle = false;
export default definePlugin({
name: "CrashHandler",
@ -72,6 +73,10 @@ export default definePlugin({
],
handleCrash(_this: ReactElement & { forceUpdate: () => void; }) {
if (Date.now() - lastCrashTimestamp <= 1_000 && !shouldAttemptNextHandle) return true;
shouldAttemptNextHandle = false;
if (++crashCount > 5) {
try {
showNotification({
@ -151,6 +156,7 @@ export default definePlugin({
}
try {
shouldAttemptNextHandle = true;
_this.forceUpdate();
} catch (err) {
CrashHandlerLogger.debug("Failed to update crash handler component.", err);