STR v2.0.3

This commit is contained in:
_Lighty_ 2020-01-03 17:18:26 +01:00
parent 9bcfcfb2ee
commit a4ef267b4d
2 changed files with 123 additions and 113 deletions

View File

@ -1,4 +1,7 @@
# [SaveToRedux](https://1lighty.github.io/BetterDiscordStuff/?plugin=SaveToRedux "SaveToRedux") Changelog
### 2.0.3
- Saving pictures from steam now works properly
### 2.0.2
- Plugin has been renamed to SaveToRedux to avoid issues loading due to the original plugin, as well as to be able to distinguish between the two more easily.
- Changed update URL

View File

@ -41,16 +41,16 @@ var SaveToRedux = (() => {
twitter_username: ''
}
],
version: '2.0.2',
version: '2.0.3',
description: 'Allows you to save images, videos, profile icons, server icons, reactions, emotes and custom status emotes to any folder quickly.',
github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/SaveToRedux/SaveToRedux.plugin.js'
},
changelog: [
{
title: 'plugin rename',
type: 'added',
items: ['Plugin has been renamed to SaveToRedux to avoid issues loading due to the original plugin, as well as to be able to distinguish between the two more easily.', 'Changed update URL']
title: 'Fixed',
type: 'fixed',
items: ['Saving pictures from steam now works properly']
}
],
defaultConfig: [
@ -357,6 +357,7 @@ var SaveToRedux = (() => {
}
formatURL(url, requiresSize, customName) {
if (url.indexOf('//steamuserimages') !== -1) url = url.replace(/\/$/, '');
if (url.indexOf('/a_') !== -1) url = url.replace('.webp', '.gif').replace('.png', '.gif');
else url = url.replace('.webp', '.png');
let fileName = url.substr(url.lastIndexOf('/') + 1);
@ -368,8 +369,14 @@ var SaveToRedux = (() => {
extension = name;
name = url.match(/\/\/media.tenor.co\/[^\/]+\/([^\/]+)\//)[1];
} else if (url.indexOf('//i.giphy.com/media/') !== -1) name = url.match(/\/\/i\.giphy\.com\/media\/([^\/]+)\//)[1];
else if (url.indexOf('//steamuserimages') !== -1) {
extension = 'png';
url += '/'; /* ??? */
}
name = this.formatFilename(name);
return { fileName: (extension && `${name}.${extension}`) || name, url: url, name, extension };
const ret = { fileName: (extension && `${name}.${extension}`) || name, url: url, name, extension };
// Logger.info(`[formatURL] url \`${url}\` requiresSize \`${requiresSize}\` customName \`${customName}\`, ret ${JSON.stringify(ret, '', 1)}`);
return ret;
}
constructMenu(url, type, customName) {
@ -684,10 +691,10 @@ var SaveToRedux = (() => {
}
url = src;
if (!url) return;
if (/\.(png|jpe?g|webp|gif|svg)$/i.test(url)) saveType = 'Image';
if (/\.(mp4|webm|mov)$/i.test(url)) saveType = 'Video';
if (/\.(mp3|ogg|wav|flac)$/i.test(url)) saveType = 'Audio';
if (url.indexOf('app.com/emojis/') !== -1) {
if (/\.(png|jpe?g|webp|gif|svg)$/i.test(url) || url.indexOf('//steamuserimages') !== -1) saveType = 'Image';
else if (/\.(mp4|webm|mov)$/i.test(url)) saveType = 'Video';
else if (/\.(mp3|ogg|wav|flac)$/i.test(url)) saveType = 'Audio';
else if (url.indexOf('app.com/emojis/') !== -1) {
saveType = 'Emoji';
const emojiId = url.split('emojis/')[1].split('.')[0];
const emoji = EmojiUtils.getDisambiguatedEmojiContext().getById(emojiId);
@ -780,7 +787,7 @@ var SaveToRedux = (() => {
getDescription() {
return this.description;
}
stop() { }
stop() {}
load() {
const ezlibMissing = !global.XenoLib;
const zlibMissing = !global.ZeresPluginLibrary;
@ -831,14 +838,14 @@ var SaveToRedux = (() => {
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, () => { });
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, () => { });
fs.writeFile(path.join(window.ContentManager.pluginsFolder, '0PluginLibrary.plugin.js'), body, () => {});
});
} else downloadXenoLib();
}
@ -849,7 +856,7 @@ var SaveToRedux = (() => {
});
}
start() { }
start() {}
get [Symbol.toStringTag]() {
return 'Plugin';
}