Skip to content

Commit

Permalink
docs: update advanced documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Feb 15, 2025
1 parent b9b89a1 commit 2e0691b
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions docs/guides/9-adv-conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,36 @@ order: 0

## Audit d'un site à accès sécurisé

Utilisation d'un `.puppeteerrc.cjs` custom.

> À adapter suivant le type d'authentification.
```javascript
module.exports = async (browser, context) => {
// launch browser for LHCI
const page = await browser.newPage(context.options)
page.authenticate({ username: '<to adapte>', password: '<to adapte>' })
const session = await page.target().createCDPSession()
await page.goto(context.url, { waitUntil: 'networkidle0' })
await startEcoindexPageMesure(page, session)
await endEcoindexPageMesure()
// close session for next run
await page.close()
### En mode simple (liste d'URLs)

```shell
npx lighthouse-plugin-ecoindex collect -u https://greenit.eco/ -u https://greenit.eco/wp-login.php/ -u https://greenit.eco/wp-admin/plugins.php --auth.url %test_url% --auth.user.target '#user_login' --auth.user.value %username_value% --auth.pass.target '#user_pass' --auth.pass.value %password_value% -o html
```

### En mode mesure de parcours (avec le fichier de config JSON)

```json
{
"$schema": "/workspace/docs/static/schema/5.1/schema.json",
"extra-header": {
"Cookie": "monster=blue",
"x-men": "wolverine"
},
"output": ["html", "json", "statement"],
"user-agent": "random",
"output-path": "./reports/multi",
"auth": {
"url": "https://domain.ltd/login/",
"user": {
"target": "#user_login",
"value": "******"
},
"pass": {
"target": "#user_pass",
"value": "*****"
}
},
"courses": [...]
}
```

Expand Down

0 comments on commit 2e0691b

Please sign in to comment.