This commit is contained in:
Mirco Wittrien 2023-10-21 13:22:27 +02:00
parent 839ae89395
commit 8d267be7d2
6 changed files with 18 additions and 18 deletions

View File

@ -2,7 +2,7 @@
* @name FriendNotifications
* @author DevilBro
* @authorId 278543574059057154
* @version 1.9.5
* @version 1.9.6
* @description Shows a Notification when a Friend or a User, you choose to observe, changes their Status
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -692,7 +692,7 @@ module.exports = (_ => {
});
else BDFDB.LibraryRequires.fs.readFile(source, "", (error, buffer) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch File, please make sure the File exists", {type: "danger"});
else successSavedAudio(key, source, `data:audio/mpeg;base64,${btoa((new TextDecoder()).decode(buffer))}`);
else successSavedAudio(key, source, `data:audio/mpeg;base64,${btoa(BDFDB.DiscordUtils.bufferToString(buffer))}`);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.SAVE

View File

@ -2,7 +2,7 @@
* @name NotificationSounds
* @author DevilBro
* @authorId 278543574059057154
* @version 3.8.3
* @version 3.8.4
* @description Allows you to replace the native Sounds with custom Sounds
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -424,7 +424,7 @@ module.exports = (_ => {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
style: {marginBottom: 1},
onClick: _ => {
for (let input of settingsPanel.props._node.querySelectorAll(".input-newsound " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new sound", {type: "danger"});
for (let input of settingsPanel.props._node.querySelectorAll(".input-newsound " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all Fields to add a new Sound", {type: "danger"});
let category = settingsPanel.props._node.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
let sound = settingsPanel.props._node.querySelector(".input-sound " + BDFDB.dotCN.input).value.trim();
let source = settingsPanel.props._node.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
@ -436,8 +436,8 @@ module.exports = (_ => {
BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source, they usually end on something like .mp3, .mp4 or .wav", {type: "danger"});
});
else BDFDB.LibraryRequires.fs.readFile(source, "", (error, buffer) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists", {type: "danger"});
else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${btoa((new TextDecoder()).decode(buffer))}`});
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists.", {type: "danger"});
else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${btoa(BDFDB.DiscordUtils.bufferToString(buffer))}`});
});
},
children: BDFDB.LanguageUtils.LanguageStrings.SAVE

View File

@ -2,7 +2,7 @@
* @name PluginRepo
* @author DevilBro
* @authorId 278543574059057154
* @version 2.5.2
* @version 2.5.3
* @description Allows you to download all Plugins from BD's Website within Discord
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -492,7 +492,7 @@ module.exports = (_ => {
loadingToast.close();
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
}
else BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()), (new TextDecoder()).decode(buffer), error2 => {
else BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()), BDFDB.DiscordUtils.bufferToString(buffer), error2 => {
delete this.props.downloading;
loadingToast.close();
if (error2) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
@ -761,7 +761,7 @@ module.exports = (_ => {
BDFDB.DiscordUtils.requestFileData(plugin.rawSourceUrl, (error, buffer) => {
if (error || !buffer) plugin.failed = true;
else {
let body = (new TextDecoder()).decode(buffer);
let body = BDFDB.DiscordUtils.bufferToString(buffer);
if (body && body.indexOf("404: Not Found") != 0) {
const META = body.split("*/")[0];
plugin.name = BDFDB.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.name || "");

View File

@ -2,7 +2,7 @@
* @name ServerFolders
* @author DevilBro
* @authorId 278543574059057154
* @version 7.1.8
* @version 7.1.9
* @description Changes Discord's Folders, Servers open in a new Container, also adds extra Features to more easily organize, customize and manage your Folders
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -318,7 +318,7 @@ module.exports = (_ => {
checkImage(base64OrUrl, callback) {
if (base64OrUrl.indexOf("https://") == 0 || base64OrUrl.indexOf("http://") == 0) BDFDB.LibraryRequires.request(base64OrUrl.trim(), {agentOptions: {rejectUnauthorized: false}, headers: {"Content-Type": "application/json"}}, (error, response, body) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1 && response.headers["content-type"] != "image/gif") {
this.resizeImage("data:" + response.headers["content-type"] + ";base64," + btoa((new TextDecoder()).decode(body)), callback);
this.resizeImage("data:" + response.headers["content-type"] + ";base64," + btoa(BDFDB.DiscordUtils.bufferToString(body)), callback);
}
else callback(base64OrUrl);
});

View File

@ -2,7 +2,7 @@
* @name SpellCheck
* @author DevilBro
* @authorId 278543574059057154
* @version 1.6.7
* @version 1.6.8
* @description Adds a Spell Check to all Message Inputs. Select a Word and Right Click it to add it to your Dictionary
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -365,7 +365,7 @@ module.exports = (_ => {
};
if (this.settings.general.downloadDictionary && BDFDB.LibraryRequires.fs.existsSync(filePath)) BDFDB.LibraryRequires.fs.readFile(filePath, "", (error, buffer) => {
parse(error, buffer, (new TextDecoder()).decode(buffer), false);
parse(error, buffer, BDFDB.DiscordUtils.bufferToString(buffer), false);
});
else BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/SpellCheck/dic/" + lang + ".dic", (error, response, body) => {
parse(error, response, body, this.settings.general.downloadDictionary);

View File

@ -2,7 +2,7 @@
* @name ThemeRepo
* @author DevilBro
* @authorId 278543574059057154
* @version 2.5.1
* @version 2.5.2
* @description Allows you to download all Themes from BD's Website within Discord
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -638,7 +638,7 @@ module.exports = (_ => {
loadingToast.close();
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Theme "${this.props.data.name}"`), {type: "danger"});
}
else list.createThemeFile(this.props.data.name, this.props.data.rawSourceUrl.split("/").pop(), (new TextDecoder()).decode(buffer), autoloadKey).then(error2 => {
else list.createThemeFile(this.props.data.name, this.props.data.rawSourceUrl.split("/").pop(), BDFDB.DiscordUtils.bufferToString(buffer), autoloadKey).then(error2 => {
delete this.props.downloading;
loadingToast.close();
if (!error2) {
@ -886,7 +886,7 @@ module.exports = (_ => {
}
BDFDB.DiscordUtils.requestFileData("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/_res/GeneratorList.txt", (error, buffer) => {
let body = !error && buffer && (new TextDecoder()).decode(buffer);
let body = !error && buffer && BDFDB.DiscordUtils.bufferToString(buffer);
if (body) for (let id of body.replace(/[\r\t]/g, "").split(" ").map(n => parseInt(n)).filter(n => n != null)) {
let theme = grabbedThemes.find(t => t.id == id);
if (theme) generatorThemes.push(theme);
@ -894,7 +894,7 @@ module.exports = (_ => {
});
BDFDB.DiscordUtils.requestFileData(document.querySelector("head link[rel='stylesheet'][integrity]").href, (error, buffer) => {
let nativeCSS = !error && buffer && (new TextDecoder()).decode(buffer);
let nativeCSS = !error && buffer && BDFDB.DiscordUtils.bufferToString(buffer);
if (nativeCSS) {
let theme = BDFDB.DiscordUtils.getTheme();
let vars = (nativeCSS.split(`.${theme}{`)[1] || "").split("}")[0];
@ -922,7 +922,7 @@ module.exports = (_ => {
BDFDB.DiscordUtils.requestFileData(theme.rawSourceUrl, (error, buffer) => {
if (error || !buffer) theme.failed = true;
else {
let body = (new TextDecoder()).decode(buffer);
let body = BDFDB.DiscordUtils.bufferToString(buffer);
if (body && body.indexOf("404: Not Found") != 0) {
const META = body.split("*/")[0];
theme.name = BDFDB.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || theme.name || "");