From a8fe847d222d77db7b6d0cb87121854617429448 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 2 Nov 2024 14:58:50 +0100 Subject: [PATCH] [tutorial 077] Jinja calculation for an hidden variable with a potential inaccessible varible (config and doc) --- README.md | 66 ++++++++++++++++++++++------------------ config/01/output_ro.html | 3 +- config/04/output_ro.html | 3 +- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 91a12fe..6307828 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ - [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md) -- [[tutorial 075] A variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_075/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_075~1..v1.1_075)) +- [[tutorial 076] A variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_076/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_076~1..v1.1_076)) -# [tutorial 076] A variable +# [tutorial 077] Jinja calculation for an hidden variable with a potential inaccessible varible -[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_076~1..v1.1_076) +[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_077~1..v1.1_077) ## Screenshot @@ -161,6 +161,16 @@ prompt_authentication: proxy_dns_socks5: description: Use proxy DNS when using SOCKS v5 default: false + disabled: + jinja: | + {% if manual.socks_proxy.version is propertyerror %} + the proxy mode is not manual + {% elif manual.socks_proxy.version == 'v4' %} + socks version is v4 + {% endif %} + description: | + if "firefox.proxy_mode" is not "Manual proxy configuration" + or "firefox.manual.socks_proxy.version" is "v4" ``` ### Generated documentation @@ -170,9 +180,9 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ -o doc -do github ``` ### Variables -| Variable                                                                                         | Description                                                                                      | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **proxy_mode**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Configure Proxy Access to the Internet.
**Choices**:
- No proxy ← (default)
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL | +| Variable                                                                                                                        | Description                                                                                                                     | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **proxy_mode**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Configure Proxy Access to the Internet.
**Choices**:
- No proxy ← (default)
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL | #### Manual proxy configuration @@ -182,14 +192,14 @@ _`disabled`_ ##### HTTP Proxy -| Variable                                                                                         | Description                                                                                      | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.http_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | HTTP address.
**Validator**: the domain name can be an IP | -| **manual.http_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | HTTP Port.
**Default**: 8080 | +| Variable                                                                                                                        | Description                                                                                                                     | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.http_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | HTTP address.
**Validator**: the domain name can be an IP | +| **manual.http_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | HTTP Port.
**Default**: 8080 | -| Variable                                                                                         | Description                                                                                      | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.use_for_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Also use this proxy for HTTPS.
**Default**: True | +| Variable                                                                                                                        | Description                                                                                                                     | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.use_for_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Also use this proxy for HTTPS.
**Default**: True | ##### "*HTTPS* Proxy" or "*SOCKS* Proxy" @@ -202,18 +212,18 @@ This family builds families dynamically. **Identifiers**:
- HTTPS
- SOCKS -| Variable                                                                                         | Description                                                                                      | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.https_proxy.address** or **manual.socks_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | "*HTTPS* address" or "*SOCKS* address".
**Validator**: the domain name can be an IP
**Default**: the value of the variable "manual.http_proxy.address". | -| **manual.https_proxy.port** or **manual.socks_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | "*HTTPS* port" or "*SOCKS* port".
**Default**: the value of the variable "manual.http_proxy.port". | -| **manual.https_proxy.version** or **manual.socks_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 ← (default)
**Disabled**: when the identifier is "HTTPS". | +| Variable                                                                                                                        | Description                                                                                                                     | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.https_proxy.address** or **manual.socks_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | "*HTTPS* address" or "*SOCKS* address".
**Validator**: the domain name can be an IP
**Default**: the value of the variable "manual.http_proxy.address". | +| **manual.https_proxy.port** or **manual.socks_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | "*HTTPS* port" or "*SOCKS* port".
**Default**: the value of the variable "manual.http_proxy.port". | +| **manual.https_proxy.version** or **manual.socks_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 ← (default)
**Disabled**: when the identifier is "HTTPS". | -| Variable                                                                                         | Description                                                                                      | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | Automatic proxy configuration URL.
**Disabled**: proxy_mode. | -| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) _`disabled`_ `unique` `multiple` | Address for which proxy will be desactivated.
Connections to localhost, 127.0.0.1/8 and ::1 are never proxied.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Examples**:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
**Disabled**: proxy_mode. | -| **prompt_authentication**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | Prompt for authentication if password is saved.
**Default**: True
**Disabled**: proxy_mode. | -| **proxy_dns_socks5**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Use proxy DNS when using SOCKS v5.
**Default**: False | +| Variable                                                                                                                        | Description                                                                                                                     | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | Automatic proxy configuration URL.
**Disabled**: proxy_mode. | +| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) _`disabled`_ `unique` `multiple` | Address for which proxy will be desactivated.
Connections to localhost, 127.0.0.1/8 and ::1 are never proxied.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Examples**:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
**Disabled**: proxy_mode. | +| **prompt_authentication**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | Prompt for authentication if password is saved.
**Default**: True
**Disabled**: proxy_mode. | +| **proxy_dns_socks5**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` _`disabled`_ | Use proxy DNS when using SOCKS v5.
**Default**: False
**Disabled**: if "firefox.proxy_mode" is not "Manual proxy configuration"
or "firefox.manual.socks_proxy.version" is "v4". | ## User data @@ -239,8 +249,7 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ -u file -ff config/01/config.yaml │ Unmodifiable variable │ ╰─────────────────────────────────────────────────────────────╯ Variables: -┣━━ 📓 proxy_mode: No proxy -┗━━ 📓 proxy_dns_socks5: False +┗━━ 📓 proxy_mode: No proxy ### Example 2 @@ -368,9 +377,8 @@ Variables: ┣━━ 📓 port: 8080 ┗━━ 📓 version: v4 (v5) ┣━━ 📓 no_proxy : -┣━━ 📓 prompt_authentication: True -┗━━ 📓 proxy_dns_socks5: False +┗━━ 📓 prompt_authentication: True -- [[tutorial 077] Jinja calculation for an hidden variable with a potential inaccessible varible](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_077/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_077~1..v1.1_077)) +- [[tutorial 078] A variable in avanced mode](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_078/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_078~1..v1.1_078)) diff --git a/config/01/output_ro.html b/config/01/output_ro.html index d8b2d77..cdecbe8 100644 --- a/config/01/output_ro.html +++ b/config/01/output_ro.html @@ -5,6 +5,5 @@ │ Unmodifiable variable │ ╰─────────────────────────────────────────────────────────────╯ Variables: -┣━━ 📓 proxy_mode: No proxy -┗━━ 📓 proxy_dns_socks5: False +┗━━ 📓 proxy_mode: No proxy diff --git a/config/04/output_ro.html b/config/04/output_ro.html index 2dab083..865beb0 100644 --- a/config/04/output_ro.html +++ b/config/04/output_ro.html @@ -19,6 +19,5 @@ Variables: ┣━━ 📓 port: 8080 ┗━━ 📓 version: v4 (v5) ┣━━ 📓 no_proxy : -┣━━ 📓 prompt_authentication: True -┗━━ 📓 proxy_dns_socks5: False +┗━━ 📓 prompt_authentication: True