Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update moduleraid.js - Esse commit faz que o whatsapp-web.js funcione #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tobizinho
Copy link

/* moduleRaid v5

const moduleRaid = function () {
moduleRaid.mID = Math.random().toString(36).substring(7);
moduleRaid.mObj = {};

fillModuleArray = function() {
if (parseFloat(window.Debug.VERSION) < 2.3) {
(window.webpackChunkbuild || window.webpackChunkwhatsapp_web_client).push([
[moduleRaid.mID], {}, function(e) {
Object.keys(e.m).forEach(function(mod) {
moduleRaid.mObj[mod] = e(mod);
})
}
]);
} else {
let modules = self.require('__debug').modulesMap;
Object.keys(modules).filter(e => e.includes("WA")).forEach(function (mod) {
let modulos = modules[mod];
if (modulos) {
moduleRaid.mObj[mod] = {
default: modulos.defaultExport,
factory: modulos.factory,
...modulos
};
if (Object.keys(moduleRaid.mObj[mod].default).length == 0) {
try {
self.ErrorGuard.skipGuardGlobal(true);
Object.assign(moduleRaid.mObj[mod], self.importNamespace(mod));
} catch (e) {
}
}
}
})
}
}

fillModuleArray();

get = function get (id) {
return moduleRaid.mObj[id]
}

findModule = function findModule (query) {
results = [];
modules = Object.keys(moduleRaid.mObj);

modules.forEach(function(mKey) {
  mod = moduleRaid.mObj[mKey];

  if (typeof mod !== 'undefined') {
    if (typeof query === 'string') {
      if (typeof mod.default === 'object') {
        for (key in mod.default) {
          if (key == query) results.push(mod);
        }
      }

      for (key in mod) {
        if (key == query) results.push(mod);
      }
    } else if (typeof query === 'function') { 
      if (query(mod)) {
        results.push(mod);
      }
    } else {
      throw new TypeError('findModule can only find via string and function, ' + (typeof query) + ' was passed');
    }
    
  }
})

return results;

}

return {
modules: moduleRaid.mObj,
constructors: moduleRaid.cArr,
findModule: findModule,
get: get
}
}

if (typeof module === 'object' && module.exports) {
module.exports = moduleRaid;
} else {
window.mR = moduleRaid();
}

/* moduleRaid v5
 * https://github.com/@pedroslopez/moduleRaid
 *
 * Copyright pixeldesu, pedroslopez and other contributors
 * Licensed under the MIT License
 * https://github.com/pedroslopez/moduleRaid/blob/master/LICENSE
 */

const moduleRaid = function () {
  moduleRaid.mID  = Math.random().toString(36).substring(7);
  moduleRaid.mObj = {};

 fillModuleArray = function() {
    if (parseFloat(window.Debug.VERSION) < 2.3) {
    (window.webpackChunkbuild || window.webpackChunkwhatsapp_web_client).push([
      [moduleRaid.mID], {}, function(e) {
        Object.keys(e.m).forEach(function(mod) {
          moduleRaid.mObj[mod] = e(mod);
        })
      }
    ]);
  } else {
    let modules = self.require('__debug').modulesMap;
    Object.keys(modules).filter(e => e.includes("WA")).forEach(function (mod) {
        let modulos = modules[mod];
        if (modulos) {
          moduleRaid.mObj[mod] = {
                default: modulos.defaultExport,
                factory: modulos.factory,
                ...modulos
            };
            if (Object.keys(moduleRaid.mObj[mod].default).length == 0) {
                try {
                    self.ErrorGuard.skipGuardGlobal(true);
                    Object.assign(moduleRaid.mObj[mod], self.importNamespace(mod));
                } catch (e) {
                }
            }
        }
    })
  }
  }

  fillModuleArray();

  get = function get (id) {
    return moduleRaid.mObj[id]
  }

  findModule = function findModule (query) {
    results = [];
    modules = Object.keys(moduleRaid.mObj);

    modules.forEach(function(mKey) {
      mod = moduleRaid.mObj[mKey];

      if (typeof mod !== 'undefined') {
        if (typeof query === 'string') {
          if (typeof mod.default === 'object') {
            for (key in mod.default) {
              if (key == query) results.push(mod);
            }
          }

          for (key in mod) {
            if (key == query) results.push(mod);
          }
        } else if (typeof query === 'function') { 
          if (query(mod)) {
            results.push(mod);
          }
        } else {
          throw new TypeError('findModule can only find via string and function, ' + (typeof query) + ' was passed');
        }
        
      }
    })

    return results;
  }

  return {
    modules: moduleRaid.mObj,
    constructors: moduleRaid.cArr,
    findModule: findModule,
    get: get
  }
}

if (typeof module === 'object' && module.exports) {
  module.exports = moduleRaid;
} else {
  window.mR = moduleRaid();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant