STR v2.1.4

This commit is contained in:
_Lighty_ 2020-07-17 15:17:30 +02:00
parent 20274dada4
commit 2c0fcf8e07
2 changed files with 185 additions and 154 deletions

View File

@ -1,4 +1,7 @@
# [SaveToRedux](https://1lighty.github.io/BetterDiscordStuff/?plugin=SaveToRedux "SaveToRedux") Changelog # [SaveToRedux](https://1lighty.github.io/BetterDiscordStuff/?plugin=SaveToRedux "SaveToRedux") Changelog
### 2.1.4
- Fixed some options not doing anything
### 2.1.3 ### 2.1.3
- Fixed startup error on canary - Fixed startup error on canary

View File

@ -41,7 +41,7 @@ var SaveToRedux = (() => {
twitter_username: '' twitter_username: ''
} }
], ],
version: '2.1.3', version: '2.1.4',
description: 'Allows you to save images, videos, profile icons, server icons, reactions, emotes and custom status emotes to any folder quickly, as well as install plugins from direct links.', description: 'Allows you to save images, videos, profile icons, server icons, reactions, emotes and custom status emotes to any folder quickly, as well as install plugins from direct links.',
github: 'https://github.com/1Lighty', github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/SaveToRedux/SaveToRedux.plugin.js' github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/SaveToRedux/SaveToRedux.plugin.js'
@ -50,7 +50,7 @@ var SaveToRedux = (() => {
{ {
title: 'fixed', title: 'fixed',
type: 'fixed', type: 'fixed',
items: ['Fixed startup error on canary'] items: ['Fixed some options not doing anything']
} }
], ],
defaultConfig: [ defaultConfig: [
@ -103,10 +103,36 @@ var SaveToRedux = (() => {
/* Build */ /* Build */
const buildPlugin = ([Plugin, Api]) => { const buildPlugin = ([Plugin, Api]) => {
const { Settings, Modals, Utilities, WebpackModules, DiscordModules, DiscordClasses, ReactComponents, DiscordAPI, Logger, PluginUpdater, PluginUtilities, ReactTools } = Api; const { Settings, Utilities, WebpackModules, DiscordModules, DiscordClasses, ReactComponents, DiscordAPI, Logger, PluginUpdater, PluginUtilities, ReactTools } = Api;
const { React, ContextMenuActions, GuildStore, DiscordConstants, Dispatcher, SwitchRow, EmojiUtils, EmojiStore, RadioGroup, EmojiInfo, ModalStack } = DiscordModules; const { React, ContextMenuActions, GuildStore, DiscordConstants, Dispatcher, SwitchRow, EmojiUtils, EmojiStore, RadioGroup, EmojiInfo } = DiscordModules;
const Patcher = XenoLib.createSmartPatcher(Api.Patcher); const Patcher = XenoLib.createSmartPatcher(Api.Patcher);
const ConfirmModal = ZeresPluginLibrary.WebpackModules.getByDisplayName('ConfirmModal');
const ConfirmationModal = props => {
try {
const ret = ConfirmModal(props);
if (props.size) ret.props.size = props.size;
return ret;
} catch(err) {
if (props.onCancel) props.onCancel();
else props.onClose();
return null;
}
};
const ModalStack = ZeresPluginLibrary.WebpackModules.getByProps('openModal', 'hasModalOpen');
const Markdown = WebpackModules.getByDisplayName('Markdown');
const Modals = {
showModal(title, content, options) {
return ModalStack.openModal(e => React.createElement(ConfirmationModal, Object.assign({title, children: content, cancelText: 'Cancel'}, e, options)));
},
showConfirmationModal(title, content, options) {
return this.showModal(title, React.createElement(Markdown, null, content), options);
},
ModalSizes: (WebpackModules.getByProps('ModalSize') || {}).ModalSize
}
const TextComponent = WebpackModules.getByDisplayName('Text'); const TextComponent = WebpackModules.getByDisplayName('Text');
const getEmojiURL = Utilities.getNestedProp(WebpackModules.getByProps('getEmojiURL'), 'getEmojiURL'); const getEmojiURL = Utilities.getNestedProp(WebpackModules.getByProps('getEmojiURL'), 'getEmojiURL');
const showAlertModal = Utilities.getNestedProp( const showAlertModal = Utilities.getNestedProp(
@ -301,12 +327,12 @@ var SaveToRedux = (() => {
XenoLib.Notifications.error(`[**${this.name}**] Failed to start! Please update it, press CTRL + R, or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 }); XenoLib.Notifications.error(`[**${this.name}**] Failed to start! Please update it, press CTRL + R, or ${GuildStore.getGuild(XenoLib.supportServerId) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)'} for further assistance.`, { timeout: 0 });
try { try {
this.onStop(); this.onStop();
} catch (e) {} } catch (e) { }
} }
}; };
try { try {
ModalStack.popWithKey(`${this.name}_DEP_MODAL`); ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
} catch (e) {} } catch (e) { }
} }
onStart() { onStart() {
this.promises = { state: { cancelled: false } }; this.promises = { state: { cancelled: false } };
@ -330,7 +356,7 @@ var SaveToRedux = (() => {
.ST-randomize > .${XenoLib.getSingleClass('lookBlank contents')} { .ST-randomize > .${XenoLib.getSingleClass('lookBlank contents')} {
margin: 0; margin: 0;
} }
#user-context-str + .${XenoLib.getSingleClass('layerContainer layer')} { div[id$="-str"] + .${XenoLib.getSingleClass('layerContainer layer')} {
z-index: 1; z-index: 1;
} }
` `
@ -746,7 +772,7 @@ var SaveToRedux = (() => {
return ret; return ret;
} }
constructMenu(url, type, customName, onNoExtension = () => {}, fallbackExtension, proxiedUrl) { constructMenu(url, type, customName, onNoExtension = () => { }, fallbackExtension, proxiedUrl) {
const subItems = []; const subItems = [];
const folderSubMenus = []; const folderSubMenus = [];
const formattedurl = this.formatURL(url, type === 'Icon' || type === 'Avatar', customName, fallbackExtension, proxiedUrl, 0, type === 'Theme' || type === 'Plugin'); const formattedurl = this.formatURL(url, type === 'Icon' || type === 'Avatar', customName, fallbackExtension, proxiedUrl, 0, type === 'Theme' || type === 'Plugin');
@ -1072,7 +1098,8 @@ var SaveToRedux = (() => {
{ {
confirmText: 'Create', confirmText: 'Create',
onConfirm: saveFolder, onConfirm: saveFolder,
size: XenoLib.joinClassNames(Modals.ModalSizes.MEDIUM, 'ST-modal') size: Modals.ModalSizes.MEDIUM,
className: 'ST-modal'
} }
); );
}, },
@ -1127,7 +1154,8 @@ var SaveToRedux = (() => {
{ {
confirmText: 'Create', confirmText: 'Create',
onConfirm: saveFolder, onConfirm: saveFolder,
size: XenoLib.joinClassNames(Modals.ModalSizes.MEDIUM, 'ST-modal') size: Modals.ModalSizes.MEDIUM,
className: 'ST-modal'
} }
); );
}); });
@ -1268,7 +1296,7 @@ var SaveToRedux = (() => {
getDescription() { getDescription() {
return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.'; return this.description + ' You are missing libraries for this plugin, please enable the plugin and click Download Now.';
} }
stop() {} stop() { }
handleMissingLib() { handleMissingLib() {
const a = BdApi.findModuleByProps('isModalOpenWithKey'); const a = BdApi.findModuleByProps('isModalOpenWithKey');
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return; if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return;
@ -1331,9 +1359,9 @@ var SaveToRedux = (() => {
b = require('fs'), b = require('fs'),
c = require('path'), c = require('path'),
d = () => { 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, () => {}))); (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, () => { })));
}; };
!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(); !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 a