use superior library downloader
This commit is contained in:
parent
cd52105f1a
commit
eb62419b92
|
@ -429,8 +429,54 @@ var BetterUnavailableGuilds = (() => {
|
|||
const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal');
|
||||
const onFail = () => BdApi.getCore().alert(header, `${content}<br/>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.<br/>${(zlibMissing && '<br/><a href="https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>') || ''}${(zlibMissing && '<br/><a href="http://localhost:7474/XenoLib.js"target="_blank">Click here to download XenoLib</a>') || ''}`);
|
||||
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail();
|
||||
ModalStack.push(props => {
|
||||
class TempErrorBoundary extends BdApi.React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
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);
|
||||
}
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
return 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);
|
||||
}
|
||||
})();
|
||||
modalId = ModalStack.push(props => {
|
||||
return BdApi.React.createElement(
|
||||
TempErrorBoundary,
|
||||
{
|
||||
label: 'missing dependency modal',
|
||||
onError: () => {
|
||||
ModalStack.popWithKey(modalId); /* smh... */
|
||||
onFail();
|
||||
}
|
||||
},
|
||||
BdApi.React.createElement(
|
||||
ConfirmationModal,
|
||||
Object.assign(
|
||||
{
|
||||
|
@ -440,6 +486,7 @@ var BetterUnavailableGuilds = (() => {
|
|||
confirmText: 'Download Now',
|
||||
cancelText: 'Cancel',
|
||||
onConfirm: () => {
|
||||
onHeckWouldYouLookAtThat();
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -457,8 +504,8 @@ var BetterUnavailableGuilds = (() => {
|
|||
if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name);
|
||||
else {
|
||||
const listener = () => {
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
BDEvents.off('xenolib-loaded', listener);
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
};
|
||||
BDEvents.on('xenolib-loaded', listener);
|
||||
}
|
||||
|
@ -482,6 +529,7 @@ var BetterUnavailableGuilds = (() => {
|
|||
},
|
||||
props
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -345,8 +345,54 @@ var CrashRecovery = (() => {
|
|||
const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal');
|
||||
const onFail = () => BdApi.getCore().alert(header, `${content}<br/>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.<br/>${(zlibMissing && '<br/><a href="https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>') || ''}${(zlibMissing && '<br/><a href="http://localhost:7474/XenoLib.js"target="_blank">Click here to download XenoLib</a>') || ''}`);
|
||||
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail();
|
||||
ModalStack.push(props => {
|
||||
class TempErrorBoundary extends BdApi.React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
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);
|
||||
}
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
return 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);
|
||||
}
|
||||
})();
|
||||
modalId = ModalStack.push(props => {
|
||||
return BdApi.React.createElement(
|
||||
TempErrorBoundary,
|
||||
{
|
||||
label: 'missing dependency modal',
|
||||
onError: () => {
|
||||
ModalStack.popWithKey(modalId); /* smh... */
|
||||
onFail();
|
||||
}
|
||||
},
|
||||
BdApi.React.createElement(
|
||||
ConfirmationModal,
|
||||
Object.assign(
|
||||
{
|
||||
|
@ -356,6 +402,7 @@ var CrashRecovery = (() => {
|
|||
confirmText: 'Download Now',
|
||||
cancelText: 'Cancel',
|
||||
onConfirm: () => {
|
||||
onHeckWouldYouLookAtThat();
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -373,8 +420,8 @@ var CrashRecovery = (() => {
|
|||
if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name);
|
||||
else {
|
||||
const listener = () => {
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
BDEvents.off('xenolib-loaded', listener);
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
};
|
||||
BDEvents.on('xenolib-loaded', listener);
|
||||
}
|
||||
|
@ -398,6 +445,7 @@ var CrashRecovery = (() => {
|
|||
},
|
||||
props
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1169,8 +1169,54 @@ var MentionAliasesRedux = (() => {
|
|||
const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal');
|
||||
const onFail = () => BdApi.getCore().alert(header, `${content}<br/>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.<br/>${(zlibMissing && '<br/><a href="https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>') || ''}${(zlibMissing && '<br/><a href="http://localhost:7474/XenoLib.js"target="_blank">Click here to download XenoLib</a>') || ''}`);
|
||||
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail();
|
||||
ModalStack.push(props => {
|
||||
class TempErrorBoundary extends BdApi.React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
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);
|
||||
}
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
return 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);
|
||||
}
|
||||
})();
|
||||
modalId = ModalStack.push(props => {
|
||||
return BdApi.React.createElement(
|
||||
TempErrorBoundary,
|
||||
{
|
||||
label: 'missing dependency modal',
|
||||
onError: () => {
|
||||
ModalStack.popWithKey(modalId); /* smh... */
|
||||
onFail();
|
||||
}
|
||||
},
|
||||
BdApi.React.createElement(
|
||||
ConfirmationModal,
|
||||
Object.assign(
|
||||
{
|
||||
|
@ -1180,6 +1226,7 @@ var MentionAliasesRedux = (() => {
|
|||
confirmText: 'Download Now',
|
||||
cancelText: 'Cancel',
|
||||
onConfirm: () => {
|
||||
onHeckWouldYouLookAtThat();
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -1197,8 +1244,8 @@ var MentionAliasesRedux = (() => {
|
|||
if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name);
|
||||
else {
|
||||
const listener = () => {
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
BDEvents.off('xenolib-loaded', listener);
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
};
|
||||
BDEvents.on('xenolib-loaded', listener);
|
||||
}
|
||||
|
@ -1222,6 +1269,7 @@ var MentionAliasesRedux = (() => {
|
|||
},
|
||||
props
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -914,18 +914,64 @@ var SaveToRedux = (() => {
|
|||
}
|
||||
stop() {}
|
||||
load() {
|
||||
const ezlibMissing = !global.XenoLib;
|
||||
const XenoLibMissing = !global.XenoLib;
|
||||
const zlibMissing = !global.ZeresPluginLibrary;
|
||||
const bothLibsMissing = ezlibMissing && zlibMissing;
|
||||
const bothLibsMissing = XenoLibMissing && zlibMissing;
|
||||
const header = `Missing ${(bothLibsMissing && 'Libraries') || 'Library'}`;
|
||||
const content = `The ${(bothLibsMissing && 'Libraries') || 'Library'} ${(zlibMissing && 'ZeresPluginLibrary') || ''} ${(ezlibMissing && (zlibMissing ? 'and XenoLib' : 'XenoLib')) || ''} required for ${this.name} ${(bothLibsMissing && 'are') || 'is'} missing.`;
|
||||
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}<br/>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.<br/>${(zlibMissing && '<br/><a href="https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>') || ''}${(zlibMissing && '<br/><a href="http://localhost:7474/XenoLib.js"target="_blank">Click here to download XenoLib</a>') || ''}`);
|
||||
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail();
|
||||
ModalStack.push(props => {
|
||||
class TempErrorBoundary extends BdApi.React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
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);
|
||||
}
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
return 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);
|
||||
}
|
||||
})();
|
||||
modalId = ModalStack.push(props => {
|
||||
return BdApi.React.createElement(
|
||||
TempErrorBoundary,
|
||||
{
|
||||
label: 'missing dependency modal',
|
||||
onError: () => {
|
||||
ModalStack.popWithKey(modalId); /* smh... */
|
||||
onFail();
|
||||
}
|
||||
},
|
||||
BdApi.React.createElement(
|
||||
ConfirmationModal,
|
||||
Object.assign(
|
||||
{
|
||||
|
@ -935,6 +981,7 @@ var SaveToRedux = (() => {
|
|||
confirmText: 'Download Now',
|
||||
cancelText: 'Cancel',
|
||||
onConfirm: () => {
|
||||
onHeckWouldYouLookAtThat();
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -952,8 +999,8 @@ var SaveToRedux = (() => {
|
|||
if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name);
|
||||
else {
|
||||
const listener = () => {
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
BDEvents.off('xenolib-loaded', listener);
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
};
|
||||
BDEvents.on('xenolib-loaded', listener);
|
||||
}
|
||||
|
@ -977,6 +1024,7 @@ var SaveToRedux = (() => {
|
|||
},
|
||||
props
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -555,8 +555,54 @@ var UnreadBadgesRedux = (() => {
|
|||
const ConfirmationModal = BdApi.findModule(m => m.defaultProps && m.key && m.key() === 'confirm-modal');
|
||||
const onFail = () => BdApi.getCore().alert(header, `${content}<br/>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.<br/>${(zlibMissing && '<br/><a href="https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>') || ''}${(zlibMissing && '<br/><a href="http://localhost:7474/XenoLib.js"target="_blank">Click here to download XenoLib</a>') || ''}`);
|
||||
if (!ModalStack || !ConfirmationModal || !TextElement) return onFail();
|
||||
ModalStack.push(props => {
|
||||
class TempErrorBoundary extends BdApi.React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
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);
|
||||
}
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
return 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);
|
||||
}
|
||||
})();
|
||||
modalId = ModalStack.push(props => {
|
||||
return BdApi.React.createElement(
|
||||
TempErrorBoundary,
|
||||
{
|
||||
label: 'missing dependency modal',
|
||||
onError: () => {
|
||||
ModalStack.popWithKey(modalId); /* smh... */
|
||||
onFail();
|
||||
}
|
||||
},
|
||||
BdApi.React.createElement(
|
||||
ConfirmationModal,
|
||||
Object.assign(
|
||||
{
|
||||
|
@ -566,6 +612,7 @@ var UnreadBadgesRedux = (() => {
|
|||
confirmText: 'Download Now',
|
||||
cancelText: 'Cancel',
|
||||
onConfirm: () => {
|
||||
onHeckWouldYouLookAtThat();
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -583,8 +630,8 @@ var UnreadBadgesRedux = (() => {
|
|||
if (!global.BDEvents || global.XenoLib) pluginModule.reloadPlugin(this.name);
|
||||
else {
|
||||
const listener = () => {
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
BDEvents.off('xenolib-loaded', listener);
|
||||
pluginModule.reloadPlugin(this.name);
|
||||
};
|
||||
BDEvents.on('xenolib-loaded', listener);
|
||||
}
|
||||
|
@ -608,6 +655,7 @@ var UnreadBadgesRedux = (() => {
|
|||
},
|
||||
props
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue