diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 69c6f41ca9..76d5d1ebf6 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -2,7 +2,7 @@ * @name BDFDB * @author DevilBro * @authorId 278543574059057154 - * @version 3.3.9 + * @version 3.4.0 * @description Required Library for DevilBro's Plugins * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -4327,6 +4327,11 @@ module.exports = (_ => { if (typeof callback != "function") return; getFileData(url).then(buffer => callback(null, buffer)).catch(error => callback(error, null)); }; + BDFDB.DiscordUtils.bufferToString = function (u8a) { + let CHUNK_SZ = 0x8000, c = []; + for (let i = 0; i < u8a.length; i += CHUNK_SZ) c.push(String.fromCharCode.apply(null, u8a.subarray(i, i + CHUNK_SZ))); + return c.join(""); + }; BDFDB.DiscordUtils.getSetting = function (category, key) { if (!category || !key) return; return BDFDB.LibraryStores.UserSettingsProtoStore && BDFDB.LibraryStores.UserSettingsProtoStore.settings[category] && BDFDB.LibraryStores.UserSettingsProtoStore.settings[category][key] && BDFDB.LibraryStores.UserSettingsProtoStore.settings[category][key].value; @@ -6169,7 +6174,7 @@ module.exports = (_ => { onChange: e => { let file = e.currentTarget.files[0]; if (this.refInput && file && (!filter.length || filter.some(n => file.type.indexOf(n) == 0))) { - this.refInput.props.value = this.props.searchFolders ? file.path.split(file.name).slice(0, -1).join(file.name) : `${this.props.mode == "url" ? "url('" : ""}${(this.props.useFilePath) ? file.path : `data:${file.type};base64,${btoa((new TextDecoder()).decode(Internal.LibraryRequires.fs.readFileSync(file.path, "")))}`}${this.props.mode ? "')" : ""}`; + this.refInput.props.value = this.props.searchFolders ? file.path.split(file.name).slice(0, -1).join(file.name) : `${this.props.mode == "url" ? "url('" : ""}${(this.props.useFilePath) ? file.path : `data:${file.type};base64,${btoa(BDFDB.DiscordUtils.bufferToString(Internal.LibraryRequires.fs.readFileSync(file.path, "")))}`}${this.props.mode ? "')" : ""}`; BDFDB.ReactUtils.forceUpdate(this.refInput); this.refInput.handleChange(this.refInput.props.value); }