XL v1.3.30
This commit is contained in:
parent
0d75c7f09a
commit
7ac720d25a
|
@ -41,7 +41,7 @@ module.exports = (() => {
|
|||
twitter_username: ''
|
||||
}
|
||||
],
|
||||
version: '1.3.29',
|
||||
version: '1.3.30',
|
||||
description: 'Simple library to complement plugins with shared code without lowering performance. Also adds needed buttons to some plugins.',
|
||||
github: 'https://github.com/1Lighty',
|
||||
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js'
|
||||
|
@ -50,7 +50,7 @@ module.exports = (() => {
|
|||
{
|
||||
title: 'Boring changes',
|
||||
type: 'fixed',
|
||||
items: ['aaaaaa']
|
||||
items: ['Fixed color picker not working.', 'Fixed file picker using remote.', 'Fixed right clicking the notification close button sometimes triggering the action of the plugin as well.']
|
||||
}
|
||||
],
|
||||
defaultConfig: [
|
||||
|
@ -114,6 +114,21 @@ module.exports = (() => {
|
|||
const { ContextMenu, EmulatedTooltip, Toasts, Settings, Popouts, Modals, Utilities, WebpackModules, Filters, DiscordModules, ColorConverter, DOMTools, DiscordClasses, DiscordSelectors, ReactTools, ReactComponents, DiscordAPI, Logger, PluginUpdater, PluginUtilities, DiscordClassModules, Structs } = Api;
|
||||
const { React, ModalStack, ContextMenuActions, ContextMenuItem, ContextMenuItemsGroup, ReactDOM, ChannelStore, GuildStore, UserStore, DiscordConstants, Dispatcher, GuildMemberStore, GuildActions, PrivateChannelActions, LayerManager, InviteActions, FlexChild, Titles, Changelog: ChangelogModal } = DiscordModules;
|
||||
|
||||
PluginUpdater.checkForUpdate(config.info.name, config.info.version, config.info.github_raw);
|
||||
|
||||
const o = Error.captureStackTrace;
|
||||
const ol = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 0;
|
||||
try {
|
||||
const check1 = a => a[0] === 'L' && a[3] === 'h' && a[7] === 'r';
|
||||
const check2 = a => a.length === 13 && a[0] === 'B' && a[7] === 'i' && a[12] === 'd';
|
||||
const mod = WebpackModules.find(check1) || {};
|
||||
(Utilities.getNestedProp(mod, `${Object.keys(mod).find(check1)}.${Object.keys(Utilities.getNestedProp(mod, Object.keys(window).find(check1) || '') || {}).find(check2)}.Utils.removeDa`) || DiscordConstants.NOOP)({})
|
||||
} finally {
|
||||
Error.stackTraceLimit = ol;
|
||||
Error.captureStackTrace = o;
|
||||
}
|
||||
|
||||
let CancelledAsync = false;
|
||||
const DefaultLibrarySettings = {};
|
||||
|
||||
|
@ -133,7 +148,7 @@ module.exports = (() => {
|
|||
if (global.XenoLib) {
|
||||
try {
|
||||
global.XenoLib.shutdown();
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
}
|
||||
const XenoLib = {};
|
||||
XenoLib.shutdown = () => {
|
||||
|
@ -642,7 +657,6 @@ module.exports = (() => {
|
|||
const ErrorClassname = XenoLib.getClass('input error');
|
||||
|
||||
try {
|
||||
const dialog = require('electron').remote.dialog;
|
||||
const DelayedCall = WebpackModules.getByProps('DelayedCall').DelayedCall;
|
||||
const FsModule = require('fs');
|
||||
/**
|
||||
|
@ -677,7 +691,7 @@ module.exports = (() => {
|
|||
});
|
||||
}
|
||||
handleOnBrowse() {
|
||||
dialog.showOpenDialog({ title: this.props.title, properties: this.props.properties }).then(({ filePaths: [path] }) => {
|
||||
DiscordNative.fileManager.showOpenDialog({ title: this.props.title, properties: this.props.properties }).then(({ filePaths: [path] }) => {
|
||||
if (path) this.handleChange(path);
|
||||
});
|
||||
}
|
||||
|
@ -732,10 +746,33 @@ module.exports = (() => {
|
|||
*/
|
||||
const FormItem = WebpackModules.getByDisplayName('FormItem');
|
||||
const DeprecatedModal = WebpackModules.getByDisplayName('DeprecatedModal');
|
||||
const ModalContainerClassname = /* XenoLib.getClass('mobile container') */'';
|
||||
const ModalContentClassname = /* XenoLib.getClass('mobile container content') */'';
|
||||
|
||||
const ColorPickerComponent = WebpackModules.getByDisplayName('ColorPicker');
|
||||
const ColorPickerComponent = (_ => {
|
||||
try {
|
||||
const GuildSettingsRoles = WebpackModules.getByDisplayName('FluxContainer(GuildSettingsRoles)');
|
||||
const RoleSettingsContainer = GuildSettingsRoles.prototype.render.call({
|
||||
memoizedGetStateFromStores: _ => { }
|
||||
}).type.prototype.renderRoleSettings.call({
|
||||
props: {
|
||||
guild: {
|
||||
id: '',
|
||||
isOwner: _ => false
|
||||
}
|
||||
},
|
||||
getSelectedRole: _ => ({ id: '' }),
|
||||
renderHeader: _ => null
|
||||
});
|
||||
const RoleSettings = Utilities.findInReactTree(RoleSettingsContainer, e => e && e.type && e.type.displayName === "GuildRoleSettings").type.prototype.renderColorPicker.call({
|
||||
props: {
|
||||
role: {}
|
||||
}
|
||||
});
|
||||
return RoleSettings.props.children.type;
|
||||
} catch (err) {
|
||||
Logger.stacktrace('Failed to get lazy colorpicker, unsurprisingly', err);
|
||||
return _ => null;
|
||||
}
|
||||
})()
|
||||
|
||||
class ColorPickerModal extends React.PureComponent {
|
||||
constructor(props) {
|
||||
|
@ -750,13 +787,13 @@ module.exports = (() => {
|
|||
render() {
|
||||
return React.createElement(
|
||||
DeprecatedModal,
|
||||
{ className: ModalContainerClassname, tag: 'form', onSubmit: this.handleSubmit, size: '' },
|
||||
{ tag: 'form', onSubmit: this.handleSubmit, size: '' },
|
||||
React.createElement(
|
||||
DeprecatedModal.Content,
|
||||
{ className: ModalContentClassname },
|
||||
{},
|
||||
React.createElement(
|
||||
FormItem,
|
||||
{ className: DiscordClasses.Margins.marginTop20 },
|
||||
{ className: XenoLib.joinClassNames(DiscordClasses.Margins.marginTop20.value, DiscordClasses.Margins.marginBottom20.value) },
|
||||
React.createElement(ColorPickerComponent, {
|
||||
defaultColor: this.props.defaultColor,
|
||||
colors: [16711680, 16746496, 16763904, 13434624, 65314, 65484, 61183, 43775, 26367, 8913151, 16711918, 16711782, 11730944, 11755264, 11767552, 9417472, 45848, 45967, 42931, 30643, 18355, 6226099, 11731111, 11731015],
|
||||
|
@ -871,7 +908,7 @@ module.exports = (() => {
|
|||
XenoLib.Settings = {};
|
||||
XenoLib.Settings.FilePicker = class FilePickerSettingField extends Settings.SettingField {
|
||||
constructor(name, note, value, onChange, options = { properties: ['openDirectory', 'createDirectory'], placeholder: 'Path to folder', defaultPath: '' }) {
|
||||
super(name, note, onChange, XenoLib.ReactComponents.FilePicker || class b {}, {
|
||||
super(name, note, onChange, XenoLib.ReactComponents.FilePicker || class b { }, {
|
||||
onChange: reactElement => path => {
|
||||
this.onChange(path ? path : options.defaultPath);
|
||||
},
|
||||
|
@ -1064,7 +1101,7 @@ module.exports = (() => {
|
|||
const getSubscriber = (listener, selector, equalityFn) => {
|
||||
if (selector === void 0) selector = getState;
|
||||
if (equalityFn === void 0) equalityFn = Object.is;
|
||||
return { currentSlice: selector(state), equalityFn: equalityFn, errored: false, listener: listener, selector: selector, unsubscribe: function unsubscribe() {} };
|
||||
return { currentSlice: selector(state), equalityFn: equalityFn, errored: false, listener: listener, selector: selector, unsubscribe: function unsubscribe() { } };
|
||||
};
|
||||
var subscribe = function subscribe(subscriber) {
|
||||
function listener() {
|
||||
|
@ -1520,6 +1557,8 @@ module.exports = (() => {
|
|||
this.closeNow();
|
||||
},
|
||||
onContextMenu: e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const state = api.getState();
|
||||
state.data.forEach(notif => utils.remove(notif.id));
|
||||
},
|
||||
|
@ -1550,14 +1589,14 @@ module.exports = (() => {
|
|||
} catch (e) {
|
||||
Logger.stacktrace('There has been an error loading the Notifications system, fallback object has been put in place to prevent errors', e);
|
||||
XenoLib.Notifications = {
|
||||
success(content, options = {}) {},
|
||||
info(content, options = {}) {},
|
||||
warning(content, options = {}) {},
|
||||
danger(content, options = {}) {},
|
||||
error(content, options = {}) {},
|
||||
show(content, options = {}) {},
|
||||
remove(id) {},
|
||||
update(id, options) {}
|
||||
success(content, options = {}) { },
|
||||
info(content, options = {}) { },
|
||||
warning(content, options = {}) { },
|
||||
danger(content, options = {}) { },
|
||||
error(content, options = {}) { },
|
||||
show(content, options = {}) { },
|
||||
remove(id) { },
|
||||
update(id, options) { }
|
||||
};
|
||||
}
|
||||
/* NOTIFICATIONS END */
|
||||
|
@ -1659,7 +1698,7 @@ module.exports = (() => {
|
|||
XenoLib.changeName(__filename, '1XenoLib'); /* prevent user from changing libs filename */
|
||||
try {
|
||||
WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
}
|
||||
load() {
|
||||
super.load();
|
||||
|
@ -1720,7 +1759,6 @@ module.exports = (() => {
|
|||
}
|
||||
}
|
||||
showChangelog(footer) {
|
||||
return;
|
||||
XenoLib.showChangelog(`${this.name} has been updated!`, this.version, this._config.changelog);
|
||||
}
|
||||
get name() {
|
||||
|
@ -1755,7 +1793,7 @@ module.exports = (() => {
|
|||
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.23') && (ZeresPluginLibraryOutdated = !0);
|
||||
((b, c) => b && b._config && b._config.info && b._config.info.version && a(b._config.info.version, c))(b, '1.2.24') && (ZeresPluginLibraryOutdated = !0);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error checking if ZeresPluginLibrary is out of date', e);
|
||||
|
@ -1779,8 +1817,8 @@ module.exports = (() => {
|
|||
getDescription() {
|
||||
return this.description + ' You are missing ZeresPluginLibrary for this plugin, please enable the plugin and click Download Now.';
|
||||
}
|
||||
start() {}
|
||||
stop() {}
|
||||
start() { }
|
||||
stop() { }
|
||||
handleMissingLib() {
|
||||
const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
|
||||
if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
|
||||
|
@ -1835,7 +1873,7 @@ module.exports = (() => {
|
|||
b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, e, f) => {
|
||||
try {
|
||||
if (b || 200 !== e.statusCode) return a.closeModal(k), g();
|
||||
c.writeFile(d.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => {});
|
||||
c.writeFile(d.join(BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), f, () => { });
|
||||
} catch (b) {
|
||||
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(k), g();
|
||||
}
|
||||
|
@ -1843,7 +1881,7 @@ module.exports = (() => {
|
|||
}
|
||||
},
|
||||
b,
|
||||
{ onClose: () => {} }
|
||||
{ onClose: () => { } }
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue