Skip to content

Commit

Permalink
Fix BlurNSFW
Browse files Browse the repository at this point in the history
- Fixes #698
- Fixes #674
- Closes #684
  • Loading branch information
zerebos committed Apr 16, 2023
1 parent 7e5cba3 commit 24e3501
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Plugins/BlurNSFW/BlurNSFW.plugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @name BlurNSFW
* @description Blurs images and videos until you hover over them.
* @version 1.0.2
* @version 1.0.3
* @author Zerebos
* @authorId 249746236008169473
* @website https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW
Expand Down Expand Up @@ -41,7 +41,7 @@ const config = {
twitter_username: "ZackRauen"
}
],
version: "1.0.2",
version: "1.0.3",
description: "Blurs images and videos until you hover over them.",
github: "https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW",
github_raw: "https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js"
Expand All @@ -51,7 +51,8 @@ const config = {
title: "What's New?",
type: "fixed",
items: [
"Can join voice channels without causing loading issues!"
"Account switching no longer causes crashes.",
"Blur/unblur status should be remembered better between reloads."
]
}
],
Expand Down Expand Up @@ -216,18 +217,21 @@ module.exports = !global.ZeresPluginLibrary ? Dummy : (([Plugin, Api]) => {
addBlur(channel) {
this.blurredChannels.add(channel.id);
Dispatcher.emit("blur");
BdApi.saveData(this.meta.name, "blurred", this.blurredChannels);
}

removeBlur(channel) {
this.blurredChannels.delete(channel.id);
Dispatcher.emit("blur");
BdApi.saveData(this.meta.name, "blurred", this.blurredChannels);
}

channelChange() {
const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (this.seenChannels.has(channel.id)) return;
if (!channel?.id || this.seenChannels.has(channel.id)) return;

this.seenChannels.add(channel.id);
BdApi.saveData(this.meta.name, "seen", this.seenChannels);
if (this.settings.blurNSFW && channel.nsfw) this.addBlur(channel);
}

Expand Down
5 changes: 3 additions & 2 deletions src/plugins/BlurNSFW/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"github_username": "rauenzi",
"twitter_username": "ZackRauen"
}],
"version": "1.0.2",
"version": "1.0.3",
"description": "Blurs images and videos until you hover over them.",
"github": "https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW",
"github_raw": "https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js"
Expand All @@ -17,7 +17,8 @@
"title": "What's New?",
"type": "fixed",
"items": [
"Can join voice channels without causing loading issues!"
"Account switching no longer causes crashes.",
"Blur/unblur status should be remembered better between reloads."
]
}
],
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/BlurNSFW/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,21 @@ module.exports = (Plugin, Api) => {
addBlur(channel) {
this.blurredChannels.add(channel.id);
Dispatcher.emit("blur");
BdApi.saveData(this.meta.name, "blurred", this.blurredChannels);
}

removeBlur(channel) {
this.blurredChannels.delete(channel.id);
Dispatcher.emit("blur");
BdApi.saveData(this.meta.name, "blurred", this.blurredChannels);
}

channelChange() {
const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (this.seenChannels.has(channel.id)) return;
if (!channel?.id || this.seenChannels.has(channel.id)) return;

this.seenChannels.add(channel.id);
BdApi.saveData(this.meta.name, "seen", this.seenChannels);
if (this.settings.blurNSFW && channel.nsfw) this.addBlur(channel);
}

Expand Down

0 comments on commit 24e3501

Please sign in to comment.