|
|
|
@ -23,11 +23,11 @@ const _error = (...message) => error({ labels: [ _module, _submodule ], message
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
const _getModules = (filter, all = false) => {
|
|
|
|
|
if (!this.instance?.cache) {
|
|
|
|
|
if (!this.instance?.c) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const moduleInstances = Object.values(this.instance.cache).filter(m => m.exports);
|
|
|
|
|
const moduleInstances = Object.values(this.instance.c).filter(m => m.exports);
|
|
|
|
|
|
|
|
|
|
if (all) {
|
|
|
|
|
const exports = moduleInstances.filter(m => filter(m.exports)).map(m => m.exports);
|
|
|
|
@ -82,24 +82,18 @@ export const initialize = async () => {
|
|
|
|
|
/**
|
|
|
|
|
* Wait until webpack is ready.
|
|
|
|
|
*/
|
|
|
|
|
while (!window.webpackJsonp || window.webpackJsonp?.flat(10)?.length < 8000) {
|
|
|
|
|
while (!window.webpackChunkdiscord_app) {
|
|
|
|
|
await sleep(100);
|
|
|
|
|
}
|
|
|
|
|
const instance = window.webpackJsonp.push([
|
|
|
|
|
[],
|
|
|
|
|
{
|
|
|
|
|
_vizality: (_, e, r) => {
|
|
|
|
|
e.cache = r.c;
|
|
|
|
|
e.require = r;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
[ [ '_vizality' ] ]
|
|
|
|
|
|
|
|
|
|
let instance;
|
|
|
|
|
window.webpackChunkdiscord_app.push([
|
|
|
|
|
[ '_vizality' ],
|
|
|
|
|
{}, exports => instance = exports
|
|
|
|
|
]);
|
|
|
|
|
delete instance?.cache?._vizality;
|
|
|
|
|
|
|
|
|
|
this.instance = instance;
|
|
|
|
|
/**
|
|
|
|
|
* Load modules pre-fetched.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
for (const mdl in moduleFilters) {
|
|
|
|
|
this[mdl] = await _getModule(moduleFilters[mdl], true);
|
|
|
|
|
}
|
|
|
|
|