diff --git a/Plugins/1XenoLib.plugin.js b/Plugins/1XenoLib.plugin.js index f69f2d7..1509292 100644 --- a/Plugins/1XenoLib.plugin.js +++ b/Plugins/1XenoLib.plugin.js @@ -1315,13 +1315,11 @@ var XenoLib = (() => { 'div', { className: 'xenoLib-notification-content', - style: - { - backdropFilter: LibrarySettings.notifications.backdrop ? 'blur(5px)' : undefined, - background: ColorConverter.int2rgba(ColorConverter.hex2int(LibrarySettings.notifications.backdropColor), LibrarySettings.notifications.backdrop ? 0.3 : 1.0), - border: LibrarySettings.notifications.backdrop ? 'none' : undefined - } - , + style: { + backdropFilter: LibrarySettings.notifications.backdrop ? 'blur(5px)' : undefined, + background: ColorConverter.int2rgba(ColorConverter.hex2int(LibrarySettings.notifications.backdropColor), LibrarySettings.notifications.backdrop ? 0.3 : 1.0), + border: LibrarySettings.notifications.backdrop ? 'none' : undefined + }, ref: e => { if (!LibrarySettings.notifications.backdrop || !e) return; e.style.setProperty('backdrop-filter', e.style.backdropFilter, 'important'); @@ -1603,7 +1601,7 @@ var XenoLib = (() => { c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library', d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`, e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - f = BdApi.findModuleByProps('Sizes', 'Weights'), + f = BdApi.findModuleByDisplayName('Text'), g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), h = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null)); if (!e || !g || !f) return h(); @@ -1639,7 +1637,7 @@ var XenoLib = (() => { Object.assign( { header: c, - children: [BdApi.React.createElement(f, { color: f.Colors.PRIMARY, children: [`${d} Please click Download Now to download it.`] })], + children: [BdApi.React.createElement(f, { size: f.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel', diff --git a/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js b/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js index 3c76627..bf1f406 100644 --- a/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js +++ b/Plugins/BetterTypingUsers/BetterTypingUsers.plugin.js @@ -172,7 +172,7 @@ var BetterTypingUsers = (() => { */ return class BetterTypingUsers extends Plugin { constructor() { - super(); + super(); try { ModalStack.popWithKey(`${this.name}_DEP_MODAL`); } catch (e) {} @@ -338,7 +338,7 @@ var BetterTypingUsers = (() => { if (global.BdApi && 'function' == typeof BdApi.getPlugin) { const a = (c, a) => ((c = c.split('.').map(b => parseInt(b))), (a = a.split('.').map(b => parseInt(b))), !!(a[0] > c[0])) || !!(a[0] == c[0] && a[1] > c[1]) || !!(a[0] == c[0] && a[1] == c[1] && a[2] > c[2]), b = BdApi.getPlugin('ZeresPluginLibrary'); - ((b, c) => b && b._config && b._config.info && b._config.info.version && a(b._config.info.version, c))(b, '1.2.11') && (ZeresPluginLibraryOutdated = !0); + ((b, c) => b && b._config && b._config.info && b._config.info.version && a(b._config.info.version, c))(b, '1.2.14') && (ZeresPluginLibraryOutdated = !0); } } catch (e) { console.error('Error checking if ZeresPluginLibrary is out of date', e); @@ -348,6 +348,7 @@ var BetterTypingUsers = (() => { ? class { constructor() { this._config = config; + this.start = this.load = this.handleMissingLib; } getName() { return this.name.replace(/\s+/g, ''); @@ -359,19 +360,19 @@ var BetterTypingUsers = (() => { return this.version; } getDescription() { - return this.description; + return this.description + ' You are missing ZeresPluginLibrary for this plugin, please enable the plugin and click Download Now.'; } stop() {} - load() { - const a = BdApi.findModuleByProps('isModalOpen'); - if (a && a.isModalOpen(`${this.name}_DEP_MODAL`)) return; + handleMissingLib() { + const a = BdApi.findModuleByProps('isModalOpenWithKey'); + if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; const b = !global.ZeresPluginLibrary, c = ZeresPluginLibraryOutdated ? 'Outdated Library' : 'Missing Library', d = `The Library ZeresPluginLibrary required for ${this.name} is ${ZeresPluginLibraryOutdated ? 'outdated' : 'missing'}.`, e = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - f = BdApi.findModuleByProps('Sizes', 'Weights'), + f = BdApi.findModuleByDisplayName('Text'), g = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), - h = () => BdApi.getCore().alert(c, `${d}
Due to a slight mishap however, you'll have to download the libraries yourself.
${b || ZeresPluginLibraryOutdated ? '
Click here to download ZeresPluginLibrary' : ''}`); + h = () => BdApi.alert(c, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, d), `Due to a slight mishap however, you'll have to download the libraries yourself.`, b || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null)); if (!e || !g || !f) return h(); class i extends BdApi.React.PureComponent { constructor(a) { @@ -405,7 +406,7 @@ var BetterTypingUsers = (() => { Object.assign( { header: c, - children: [BdApi.React.createElement(f, { color: f.Colors.PRIMARY, children: [`${d} Please click Download Now to download it.`] })], + children: [BdApi.React.createElement(f, { size: f.Sizes.SIZE_16, children: [`${d} Please click Download Now to download it.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel', @@ -415,7 +416,7 @@ var BetterTypingUsers = (() => { const a = require('request'), b = require('fs'), c = require('path'); - a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, d, e) => (a ? h() : void b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), e, () => {}))); + a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, d, f) => (a || 200 !== d.statusCode ? (e.popWithKey(l), h()) : void b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}))); } }, a @@ -426,8 +427,6 @@ var BetterTypingUsers = (() => { `${this.name}_DEP_MODAL` ); } - - start() {} get [Symbol.toStringTag]() { return 'Plugin'; } diff --git a/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js b/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js index f508e6c..e9b007b 100644 --- a/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js +++ b/Plugins/BetterUnavailableGuilds/BetterUnavailableGuilds.plugin.js @@ -403,8 +403,26 @@ var BetterUnavailableGuilds = (() => { /* Finalize */ - return !global.ZeresPluginLibrary || !global.XenoLib + let ZeresPluginLibraryOutdated = false; + let XenoLibOutdated = false; + try { + if (global.BdApi && 'function' == typeof BdApi.getPlugin) { + const i = (i, n) => ((i = i.split('.').map(i => parseInt(i))), (n = n.split('.').map(i => parseInt(i))), !!(n[0] > i[0]) || !!(n[0] == i[0] && n[1] > i[1]) || !!(n[0] == i[0] && n[1] == i[1] && n[2] > i[2])), + n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), + e = BdApi.getPlugin('ZeresPluginLibrary'), + o = BdApi.getPlugin('XenoLib'); + n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.17') && (XenoLibOutdated = !0); + } + } catch (i) { + console.error('Error checking if libraries are out of date', i); + } + + return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated ? class { + constructor() { + this._XL_PLUGIN = true; + this.start = this.load = this.handleMissingLib; + } getName() { return this.name.replace(/\s+/g, ''); } @@ -415,126 +433,84 @@ var BetterUnavailableGuilds = (() => { return this.version; } getDescription() { - return this.description; + return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.'; } stop() {} - load() { - const XenoLibMissing = !global.XenoLib; - const zlibMissing = !global.ZeresPluginLibrary; - const bothLibsMissing = XenoLibMissing && zlibMissing; - const header = `Missing ${(bothLibsMissing && 'Libraries') || 'Library'}`; - const content = `The ${(bothLibsMissing && 'Libraries') || 'Library'} ${(zlibMissing && 'ZeresPluginLibrary') || ''} ${(XenoLibMissing && (zlibMissing ? 'and XenoLib' : 'XenoLib')) || ''} required for ${this.name} ${(bothLibsMissing && 'are') || 'is'} missing.`; - const ModalStack = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'); - const TextElement = BdApi.findModuleByProps('Sizes', 'Weights'); - const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal'); - const onFail = () => BdApi.getCore().alert(header, `${content}
Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.
${(zlibMissing && '
Click here to download ZeresPluginLibrary') || ''}${(zlibMissing && '
Click here to download XenoLib') || ''}`); - if (!ModalStack || !ConfirmationModal || !TextElement) return onFail(); - class TempErrorBoundary extends BdApi.React.PureComponent { - constructor(props) { - super(props); - this.state = { hasError: false }; + handleMissingLib() { + const a = BdApi.findModuleByProps('isModalOpenWithKey'); + if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; + const b = !global.XenoLib, + c = !global.ZeresPluginLibrary, + d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), + e = (() => { + let a = ''; + return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a; + })(), + f = (() => { + let a = `The ${d ? 'libraries' : 'library'} `; + return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; + })(), + g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), + h = BdApi.findModuleByDisplayName('Text'), + i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), + j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); + if (!g || !i || !h) return j(); + class k extends BdApi.React.PureComponent { + constructor(a) { + super(a), (this.state = { hasError: !1 }); } - componentDidCatch(err, inf) { - console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`); - this.setState({ hasError: true }); - if (typeof this.props.onError === 'function') this.props.onError(err); + componentDidCatch(a) { + console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a); } render() { - if (this.state.hasError) return null; - return this.props.children; + return this.state.hasError ? null : this.props.children; } } - let modalId; - const onHeckWouldYouLookAtThat = (() => { - if (!global.pluginModule || !global.BDEvents) return; - if (XenoLibMissing) { - const listener = () => { - BDEvents.off('xenolib-loaded', listener); - ModalStack.popWithKey(modalId); /* make it easier on the user */ - pluginModule.reloadPlugin(this.name); - }; - BDEvents.on('xenolib-loaded', listener); - return () => BDEvents.off('xenolib-loaded', listener); - } else { - const onLoaded = e => { - if (e !== 'ZeresPluginLibrary') return; - BDEvents.off('plugin-loaded', onLoaded); - ModalStack.popWithKey(modalId); /* make it easier on the user */ - pluginModule.reloadPlugin(this.name); - }; - BDEvents.on('plugin-loaded', onLoaded); - return () => BDEvents.off('plugin-loaded', onLoaded); + class l extends i { + submitModal() { + this.props.onConfirm(); } - })(); - modalId = ModalStack.push(props => { - return BdApi.React.createElement( - TempErrorBoundary, - { - label: 'missing dependency modal', - onError: () => { - ModalStack.popWithKey(modalId); /* smh... */ - onFail(); - } - }, + } + let m = !1; + const n = g.push( + a => BdApi.React.createElement( - ConfirmationModal, - Object.assign( - { - header, - children: [BdApi.React.createElement(TextElement, { color: TextElement.Colors.PRIMARY, children: [`${content} Please click Download Now to install ${(bothLibsMissing && 'them') || 'it'}.`] })], - red: false, - confirmText: 'Download Now', - cancelText: 'Cancel', - onConfirm: () => { - onHeckWouldYouLookAtThat(); - const request = require('request'); - const fs = require('fs'); - const path = require('path'); - const waitForLibLoad = callback => { - if (!global.BDEvents) return callback(); - const onLoaded = e => { - if (e !== 'ZeresPluginLibrary') return; - BDEvents.off('plugin-loaded', onLoaded); - callback(); - }; - BDEvents.on('plugin-loaded', onLoaded); - }; - const onDone = () => { - if (!global.pluginModule || (!global.BDEvents && !global.XenoLib)) return; - if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name); - else { - const listener = () => { - BDEvents.off('xenolib-loaded', listener); - pluginModule.reloadPlugin(this.name); + k, + { + label: 'missing dependency modal', + onError: () => { + g.popWithKey(n), j(); + } + }, + BdApi.React.createElement( + l, + Object.assign( + { + header: e, + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + red: !1, + confirmText: 'Download Now', + cancelText: 'Cancel', + onConfirm: () => { + if (m) return; + m = !0; + const a = require('request'), + b = require('fs'), + c = require('path'), + d = () => { + (global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); }; - BDEvents.on('xenolib-loaded', listener); - } - }; - const downloadXenoLib = () => { - if (global.XenoLib) return onDone(); - request('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (error, response, body) => { - if (error) return onFail(); - onDone(); - fs.writeFile(path.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), body, () => {}); - }); - }; - if (!global.ZeresPluginLibrary) { - request('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (error, response, body) => { - if (error) return onFail(); - waitForLibLoad(downloadXenoLib); - fs.writeFile(path.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), body, () => {}); - }); - } else downloadXenoLib(); - } - }, - props + !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); + } + }, + a + ) ) - ) - ); - }); + ), + void 0, + `${this.name}_DEP_MODAL` + ); } - - start() {} get [Symbol.toStringTag]() { return 'Plugin'; } diff --git a/Plugins/CrashRecovery/CrashRecovery.plugin.js b/Plugins/CrashRecovery/CrashRecovery.plugin.js index 6d4d5a8..6f1988a 100644 --- a/Plugins/CrashRecovery/CrashRecovery.plugin.js +++ b/Plugins/CrashRecovery/CrashRecovery.plugin.js @@ -352,7 +352,7 @@ var CrashRecovery = (() => { n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), e = BdApi.getPlugin('ZeresPluginLibrary'), o = BdApi.getPlugin('XenoLib'); - n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.16') && (XenoLibOutdated = !0); + n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.17') && (XenoLibOutdated = !0); } } catch (i) { console.error('Error checking if libraries are out of date', i); @@ -392,7 +392,7 @@ var CrashRecovery = (() => { return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; })(), g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - h = BdApi.findModuleByProps('Sizes', 'Weights'), + h = BdApi.findModuleByDisplayName('Text'), i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!g || !i || !h) return j(); @@ -428,7 +428,7 @@ var CrashRecovery = (() => { Object.assign( { header: e, - children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel', diff --git a/Plugins/InAppNotifications/InAppNotifications.plugin.js b/Plugins/InAppNotifications/InAppNotifications.plugin.js index 64e3006..6ac4887 100644 --- a/Plugins/InAppNotifications/InAppNotifications.plugin.js +++ b/Plugins/InAppNotifications/InAppNotifications.plugin.js @@ -506,7 +506,7 @@ var InAppNotifications = (() => { return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; })(), g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - h = BdApi.findModuleByProps('Sizes', 'Weights'), + h = BdApi.findModuleByDisplayName('Text'), i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!g || !i || !h) return j(); @@ -542,7 +542,7 @@ var InAppNotifications = (() => { Object.assign( { header: e, - children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel', diff --git a/Plugins/MentionAliasesRedux/MentionAliasesRedux.plugin.js b/Plugins/MentionAliasesRedux/MentionAliasesRedux.plugin.js index c609160..36d30ec 100644 --- a/Plugins/MentionAliasesRedux/MentionAliasesRedux.plugin.js +++ b/Plugins/MentionAliasesRedux/MentionAliasesRedux.plugin.js @@ -1182,7 +1182,7 @@ var MentionAliasesRedux = (() => { n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), e = BdApi.getPlugin('ZeresPluginLibrary'), o = BdApi.getPlugin('XenoLib'); - n(e, '1.2.10') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.13') && (XenoLibOutdated = !0); + n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.17') && (XenoLibOutdated = !0); } } catch (i) { console.error('Error checking if libraries are out of date', i); @@ -1190,6 +1190,10 @@ var MentionAliasesRedux = (() => { return !global.ZeresPluginLibrary || !global.XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated ? class { + constructor() { + this._XL_PLUGIN = true; + this.start = this.load = this.handleMissingLib; + } getName() { return this.name.replace(/\s+/g, ''); } @@ -1200,101 +1204,84 @@ var MentionAliasesRedux = (() => { return this.version; } getDescription() { - return this.description; + return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.'; } stop() {} - load() { - const a = !global.XenoLib, - b = !global.ZeresPluginLibrary, - c = (a && b) || ((a || b) && (XenoLibOutdated || ZeresPluginLibraryOutdated)) || XenoLibOutdated || ZeresPluginLibraryOutdated, - d = (() => { - let d = ''; - return a || b ? (d += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (d += `Outdated `), (d += `${c ? 'Libraries' : 'Library'} `), d; - })(), + handleMissingLib() { + const a = BdApi.findModuleByProps('isModalOpenWithKey'); + if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; + const b = !global.XenoLib, + c = !global.ZeresPluginLibrary, + d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)), e = (() => { - let d = `The ${c ? 'libraries' : 'library'} `; - return a || XenoLibOutdated ? ((d += 'XenoLib '), (b || ZeresPluginLibraryOutdated) && (d += 'and ZeresPluginLibrary ')) : (b || ZeresPluginLibraryOutdated) && (d += 'ZeresPluginLibrary '), (d += `required for ${this.name} ${c ? 'are' : 'is'} ${a || b ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (a || b ? ' and/or outdated' : 'outdated') : ''}.`), d; + let a = ''; + return b || c ? (a += `Missing${XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : ''} `) : (XenoLibOutdated || ZeresPluginLibraryOutdated) && (a += `Outdated `), (a += `${d ? 'Libraries' : 'Library'} `), a; })(), - f = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - g = BdApi.findModuleByProps('Sizes', 'Weights'), - h = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), - i = () => BdApi.getCore().alert(d, `${e}
Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.
${b || ZeresPluginLibraryOutdated ? '
Click here to download ZeresPluginLibrary' : ''}${a || XenoLibOutdated ? '
Click here to download XenoLib' : ''}`); - if (!f || !h || !g) return i(); - let j; - const k = (() => { - if (!global.pluginModule || !global.BDEvents) return; - if (a || XenoLibOutdated) { - const a = () => { - BDEvents.off('xenolib-loaded', a), f.popWithKey(j), pluginModule.reloadPlugin(this.name); - }; - return BDEvents.on('xenolib-loaded', a), () => BDEvents.off('xenolib-loaded', a); - } - const b = a => { - 'ZeresPluginLibrary' !== a || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), f.popWithKey(j), pluginModule.reloadPlugin(this.name)); - }; - return BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b), () => (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b)); - })(); - class l extends BdApi.React.PureComponent { + f = (() => { + let a = `The ${d ? 'libraries' : 'library'} `; + return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; + })(), + g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), + h = BdApi.findModuleByDisplayName('Text'), + i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), + j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); + if (!g || !i || !h) return j(); + class k extends BdApi.React.PureComponent { constructor(a) { super(a), (this.state = { hasError: !1 }); } - componentDidCatch(a, b) { + componentDidCatch(a) { console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a); } render() { return this.state.hasError ? null : this.props.children; } } - j = f.push(a => - BdApi.React.createElement( - l, - { - label: 'missing dependency modal', - onError: () => { - f.popWithKey(j), i(); - } - }, + class l extends i { + submitModal() { + this.props.onConfirm(); + } + } + let m = !1; + const n = g.push( + a => BdApi.React.createElement( - h, - Object.assign( - { - header: d, - children: [BdApi.React.createElement(g, { color: g.Colors.PRIMARY, children: [`${e} Please click Download Now to download ${c ? 'them' : 'it'}.`] })], - red: !1, - confirmText: 'Download Now', - cancelText: 'Cancel', - onConfirm: () => { - k(); - const a = require('request'), - b = require('fs'), - c = require('path'), - d = a => { - if (!global.BDEvents) return a(); - const b = c => { - 'ZeresPluginLibrary' !== c || (BDEvents.off('plugin-loaded', b), BDEvents.off('plugin-reloaded', b), a()); + k, + { + label: 'missing dependency modal', + onError: () => { + g.popWithKey(n), j(); + } + }, + BdApi.React.createElement( + l, + Object.assign( + { + header: e, + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + red: !1, + confirmText: 'Download Now', + cancelText: 'Cancel', + onConfirm: () => { + if (m) return; + m = !0; + const a = require('request'), + b = require('fs'), + c = require('path'), + d = () => { + (global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {}))); }; - BDEvents.on('plugin-loaded', b), BDEvents.on('plugin-reloaded', b); - }, - e = () => { - if (!global.pluginModule || (!global.BDEvents && !global.XenoLib)) return; - if ((global.XenoLib && !XenoLibOutdated) || !global.BDEvents) return pluginModule.reloadPlugin(this.name); - const a = () => { - BDEvents.off('xenolib-loaded', a), pluginModule.reloadPlugin(this.name); - }; - BDEvents.on('xenolib-loaded', a); - }, - f = () => (global.XenoLib && !XenoLibOutdated ? e() : void a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, f) => (a ? i() : void (e(), b.writeFile(c.join(window.ContentManager.pluginsFolder, '1XenoLib.plugin.js'), f, () => {}))))); - !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', (a, e, g) => (a ? i() : void (d(f), b.writeFile(c.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), g, () => {})))) : f(); - } - }, - a + !global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d(); + } + }, + a + ) ) - ) - ) + ), + void 0, + `${this.name}_DEP_MODAL` ); } - - start() {} get [Symbol.toStringTag]() { return 'Plugin'; } diff --git a/Plugins/SaveToRedux/SaveToRedux.plugin.js b/Plugins/SaveToRedux/SaveToRedux.plugin.js index 8de1570..130c1e7 100644 --- a/Plugins/SaveToRedux/SaveToRedux.plugin.js +++ b/Plugins/SaveToRedux/SaveToRedux.plugin.js @@ -215,7 +215,7 @@ var SaveToRedux = (() => { else this.forceUpdate(); } render() { - return React.createElement(TextComponent, { }, this.props.formatFilename('unknown', this.state.date, this.state.rand), '.png'); + return React.createElement(TextComponent, {}, this.props.formatFilename('unknown', this.state.date, this.state.rand), '.png'); } } @@ -1162,7 +1162,7 @@ var SaveToRedux = (() => { return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; })(), g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - h = BdApi.findModuleByProps('Sizes', 'Weights'), + h = BdApi.findModuleByDisplayName('Text'), i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!g || !i || !h) return j(); @@ -1198,7 +1198,7 @@ var SaveToRedux = (() => { Object.assign( { header: e, - children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel', diff --git a/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js b/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js index a8db680..445ea66 100644 --- a/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js +++ b/Plugins/UnreadBadgesRedux/UnreadBadgesRedux.plugin.js @@ -591,7 +591,7 @@ var UnreadBadgesRedux = (() => { n = (n, e) => n && n._config && n._config.info && n._config.info.version && i(n._config.info.version, e), e = BdApi.getPlugin('ZeresPluginLibrary'), o = BdApi.getPlugin('XenoLib'); - n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.16') && (XenoLibOutdated = !0); + n(e, '1.2.14') && (ZeresPluginLibraryOutdated = !0), n(o, '1.3.17') && (XenoLibOutdated = !0); } } catch (i) { console.error('Error checking if libraries are out of date', i); @@ -631,7 +631,7 @@ var UnreadBadgesRedux = (() => { return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a; })(), g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'), - h = BdApi.findModuleByProps('Sizes', 'Weights'), + h = BdApi.findModuleByDisplayName('Text'), i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()), j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null)); if (!g || !i || !h) return j(); @@ -667,7 +667,7 @@ var UnreadBadgesRedux = (() => { Object.assign( { header: e, - children: [BdApi.React.createElement(h, { color: h.Colors.PRIMARY, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], + children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })], red: !1, confirmText: 'Download Now', cancelText: 'Cancel',