Skip to content

Commit

Permalink
fix: webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Nov 15, 2021
1 parent f1a6289 commit dc6e5db
Showing 1 changed file with 36 additions and 29 deletions.
65 changes: 36 additions & 29 deletions src/lib/wapi/wapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,37 +193,44 @@ import {
_serializeRawObj,
_serializeMeObj
} from './serializers';
import { storeObjects } from './store/store-objects';
import getStore from './store/get-store';
window['webpackJsonp'] = window['webpackJsonp'] || [];
window['webpackChunkbuild'] = window['webpackChunkbuild'] || [];

if (typeof window.Store === 'undefined') {
window.Store = {};
window.Store.promises = {};
const f_modules = new getStore();
window.Store.loader = f_modules;

for (const store of storeObjects) {
Store.promises[store.id] = f_modules
.waitForModule((m) => !!store.conditions(m))
.then(store.conditions)
.then((m) => {
if (store.id === 'Store') {
window.Store = Object.assign({}, window.Store, m);
} else {
window.Store[store.id] = m;
import { getStore } from './store/get-store';

window['webpackChunkwhatsapp_web_client'] =
window['webpackChunkwhatsapp_web_client'] || [];
window.Store = {};
var loadParasite = function () {
function injectParasite() {
const parasite = `parasite`;
window['webpackChunkwhatsapp_web_client'].push([
[parasite],
{},
async function (o) {
let modules = [];
for (let idx in o.m) {
modules.push(o(idx));
}
});
getStore(modules);
}
]);
}

window.Store.sendMessage = function (e) {
return window.Store.SendTextMsgToChat(this, ...arguments);
};
window.Store.sendAddMessage = function (e) {
return window.Store.addAndSendMsgToChat(this, ...arguments);
};
}
setInterval(() => {
try {
const last = window['webpackChunkwhatsapp_web_client'].length - 1;
if (
!window['webpackChunkwhatsapp_web_client'][last][0].includes(
'parasite'
) &&
(document.querySelectorAll('#app').length ||
document.querySelectorAll('#app .two').length ||
document.querySelector('canvas') ||
document.querySelectorAll('#startup').length == 0)
) {
injectParasite();
}
} catch (e) {}
}, 100);
};
loadParasite();

if (typeof window.WAPI === 'undefined') {
window.WAPI = {
Expand Down

0 comments on commit dc6e5db

Please sign in to comment.