Skip to content

Commit

Permalink
feat: --disable-plugins command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Mar 11, 2021
1 parent ac374b3 commit 3a483c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ npm install site-audit-seo-readability
npm install site-audit-seo-yake
```

#### Disable plugins:
You can add argument such: `--disable-plugins readability,yake`. It more faster, but less data extracted.

## Credentials
Based on [headless-chrome-crawler](https://github.com/yujiosaka/headless-chrome-crawler) (puppeteer). Used forked version [@popstas/headless-chrome-crawler](https://github.com/popstas/headless-chrome-crawler).

Expand Down
4 changes: 3 additions & 1 deletion src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ program.option('-u --urls <urls>', 'Comma separated url list for scan', list).
getConfigVal('openFile', undefined)).
option('--no-open-file', `Don't open file after scan`).
option('--no-console-validate', `Don't output validate messages in console`).
option('--disable-plugins <plugins>', `Comma-separated plugin list`, list).
name('site-audit-seo').
version(packageJson.version).
usage('-u https://example.com --upload')
Expand Down Expand Up @@ -253,7 +254,8 @@ program.getOptions = () => {
consoleValidate: program.consoleValidate, // выводить данные валидации в консоль
obeyRobotsTxt: !program.ignoreRobotsTxt, // chrome-crawler, не учитывать блокировки в robots.txt
influxdb: program.influxdb, // конфиг influxdb
urls: program.urls // адреса для одиночного сканирования
urls: program.urls, // адреса для одиночного сканирования
disablePlugins: program.disablePlugins
};
return opts;
}
Expand Down
3 changes: 3 additions & 0 deletions src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ async function execPlugins(jsonPath, options, type = 'any') {
if (!plugins) return;
// console.log(`\n${color.white}exec plugins (${type}):${color.reset}`);
for (let plugin of plugins) {
if (options.disablePlugins.includes(plugin.name)){
continue;
}
if (type !== 'any' && plugin.type != type) continue;

// console.log(`exec plugin ${plugin.name} (type ${type}):`);
Expand Down
3 changes: 3 additions & 0 deletions src/scrap-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ module.exports = async (baseUrl, options = {}) => {
// plugins fields
const plugins = registry.getPlugins();
for (let plugin of plugins) {
if (options.disablePlugins.includes(plugin.name)){
continue;
}
if (plugin.fields) for(let field of plugin.fields) {
if (typeof field === 'string') {
fields.push(field);
Expand Down
1 change: 1 addition & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async function onScan(url, args, socket) {
delete(program.consoleValidate);
delete(program.influxdb);
delete(program.urls);
program.disablePlugins = [];

program.exitOverride();
try {
Expand Down

0 comments on commit 3a483c3

Please sign in to comment.