diff --git a/README.md b/README.md
index 4bee18c..c98e8df 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,510 @@
-# rougail-tutorials_builder
+---
+gitea: none
+include_toc: true
+---
+# Tutorial description files
+## proxy
+
+### 00-proxy.yml
+
+```yaml
+version: 1.1
+proxy_mode:
+ description: Configure Proxy Access to the Internet
+ choices:
+ - No proxy
+ - Auto-detect proxy settings for this network
+ - Use system proxy settings
+ - Manual proxy configuration
+ - Automatic proxy configuration URL
+ default: No proxy
+```
+### 10-manual.yml
+
+```yaml
+version: 1.1
+manual:
+ description: Manual proxy configuration
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.proxy_mode != 'Manual proxy configuration' %}
+ the proxy mode is not manual
+ {% endif %}
+ description: if the value of "proxy.proxy_mode" is not "Manual proxy configuration"
+
+ http_proxy: # HTTP Proxy
+ address:
+ description: HTTP address
+ type: domainname
+ params:
+ allow_ip: true
+ port:
+ description: HTTP Port
+ type: port
+ default: '8080'
+
+ use_for_https: true # Also use this proxy for HTTPS
+
+ '{{ suffix }}_proxy':
+ description: '{{ suffix }} Proxy'
+ type: dynamic
+ dynamic:
+ - HTTPS
+ - SOCKS
+ hidden:
+ type: jinja
+ jinja: |
+ {% if suffix == 'HTTPS' and _.use_for_https %}
+ HTTPS is same has HTTP
+ {% endif %}
+ params:
+ suffix:
+ type: suffix
+ description: |
+ if HTTPS and HTTPS is same has HTTP
+
+ address:
+ description: Address
+ type: domainname
+ params:
+ allow_ip: true
+ default:
+ type: variable
+ variable: __.http_proxy.address
+
+ port:
+ description: Port
+ type: port
+ default:
+ type: variable
+ variable: __.http_proxy.port
+
+ version:
+ description: SOCKS host version used by proxy
+ choices:
+ - v4
+ - v5
+ default: v5
+ disabled:
+ type: jinja
+ jinja: |
+ {% if suffix == 'HTTPS' %}
+ if HTTPS
+ {% endif %}
+ params:
+ suffix:
+ type: suffix
+ description: |
+ if not SOCKS
+```
+### 20-auto.yml
+
+```yaml
+version: 1.1
+auto:
+ description: Automatic proxy configuration URL
+ type: web_address
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.proxy_mode != 'Automatic proxy configuration URL' %}
+ the proxy mode is not automatic
+ {% endif %}
+ description: |
+ if "proxy.proxy_mode" is not "automatic proxy configuration URL"
+```
+### 30-no_proxy.yml
+
+```yaml
+version: 1.1
+no_proxy:
+ description: Address for which proxy will be desactivated
+ type: domainname
+ params:
+ allow_ip: true
+ allow_cidr_network: true
+ allow_without_dot: true
+ allow_startswith_dot: true
+ multi: true
+ mandatory: false
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.proxy_mode == 'No proxy' %}
+ proxy mode is no proxy
+ {% endif %}
+ description: if "proxy.proxy_mode" is "No proxy"
+ test:
+ - .mozilla.org
+ - .net.nz
+ - 192.168.1.0/24
+ help: Connections to localhost, 127.0.0.1/8 and ::1 are never proxied
+```
+### 40-prompt_authentication.yml
+
+```yaml
+version: 1.1
+prompt_authentication:
+ description: Prompt for authentication if password is saved
+ default: true
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.proxy_mode == 'No proxy' %}
+ proxy mode is no proxy
+ {% endif %}
+ description: if "proxy.proxy_mode" is "No proxy"
+```
+### 50-proxy_dns_socks5.yml
+
+```yaml
+version: 1.1
+proxy_dns_socks5:
+ description: Use proxy DNS when using SOCKS v5
+ default: false
+ mode: advanced
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.proxy_mode != 'Manual proxy configuration' %}
+ the proxy mode is not manual
+ {% elif socks_version == 'v4' %}
+ socks version is v4
+ {% endif %}
+ params:
+ socks_version:
+ type: variable
+ variable: _.manual.socks_proxy.version
+ propertyerror: false
+ description: |
+ if "proxy.proxy_mode" is not "Manual proxy configuration" or "proxy.manual.socks_proxy.version" is "v4"
+```
+### 60-dns_over_https.yml
+
+```yaml
+version: 1.1
+dns_over_https: # DNS over HTTPS
+
+ enable_dns_over_https: false # Enable DNS over HTTPS
+
+ provider:
+ description: Use Provider
+ choices:
+ - Cloudflare
+ - NextDNS
+ - Custom
+ default: Cloudflare
+ disabled:
+ type: jinja
+ jinja: |
+ {% if not _.enable_dns_over_https %}
+ Enable DNS over HTTPS is False
+ {% endif %}
+ description: if "proxy.dns_over_https.enable_dns_over_https" is not False
+
+ custom_dns_url:
+ description: Custom DNS URL
+ type: web_address
+ disabled:
+ type: jinja
+ jinja: |
+ {% if provider is not defined or provider != 'Custom' %}
+ provider is not custom
+ {% endif %}
+ params:
+ provider:
+ type: variable
+ variable: _.provider
+ propertyerror: false
+ description: if "proxy.dns_over_https.provider" is "Custom"
+ validators:
+ - type: jinja
+ jinja: |
+ {% if _.custom_dns_url.startswith('http://') %}
+ only https is allowed
+ {% endif %}
+ description: must starts with 'https://' only
+```
+## foxyproxy
+
+### 00-foxyproxy.yml
+
+```yaml
+version: 1.1
+proxies:
+ description: Proxy configuration
+ _type: leadership
+
+ title:
+ description: Title or Description
+ multi: true
+
+ color:
+ description: Color
+
+ type:
+ description: Type
+ type: choice
+ choices:
+ - HTTP
+ - HTTPS/SSL
+ - SOCKS4
+ - SOCKS5
+ - PAC URL
+ - WPAD
+ - System (use system settings)
+ - Direct (no proxy)
+ default: Direct (no proxy)
+
+ address:
+ description: IP address, DNS name, server name
+ multi: true
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
+ proxy does not need address
+ {% endif %}
+ description: &needs_address |
+ if type not in:
+ - HTTP
+ - HTTPS/SSL
+ - SOCKS4
+ - SOCKS5
+
+ default:
+ type: jinja
+ jinja: |
+ {% if firefox_address is not undefined %}
+ {{ firefox_address }}
+ {% endif %}
+ params:
+ firefox_address:
+ type: variable
+ variable: proxy.manual.http_proxy.address
+ propertyerror: false
+ description: copy HTTP address if proxy is not "Manual"
+
+ port:
+ description: Port
+ type: port
+ default:
+ type: jinja
+ jinja: |
+ {% if firefox_port is not undefined %}
+ {{ firefox_port }}
+ {% endif %}
+ params:
+ firefox_port:
+ type: variable
+ variable: proxy.manual.http_proxy.port
+ propertyerror: false
+ description: copy HTTP port if proxy is not "Manual"
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
+ proxy does not need port
+ {% endif %}
+ description: *needs_address
+
+ username:
+ description: Username
+ type: unix_user
+ mandatory:
+ type: jinja
+ jinja: |
+ {% if _.password %}
+ username is mandatory
+ {% endif %}
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
+ proxy does not need username
+ {% endif %}
+ description: *needs_address
+
+ password:
+ description: Password
+ type: secret
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
+ proxy does not need password
+ {% endif %}
+ description: *needs_address
+
+ url:
+ description: URL
+ type: web_address
+ disabled:
+ type: jinja
+ jinja: |
+ {% if _.type not in ['PAC URL', 'WPAD'] %}
+ proxy does not need url
+ {% endif %}
+ description: |
+ if type is not in:
+ - PAC URL
+ - WPAD
+```
+### 10-redefine.yml
+
+```yaml
+version: 1.1
+proxies:
+ username:
+ redefine: true
+ mandatory: false
+
+ password:
+ redefine: true
+ hidden:
+ type: jinja
+ jinja: |
+ {% if not _.username %}
+ no username defined
+ {% endif %}
+ description: if username is not defined
+```
+# Generated documentation
+
+## Variables for "proxy"
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.proxy_mode**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `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
+
+`basic` _`disabled`_
+
+**Disabled**: if the value of "proxy.proxy_mode" is not "Manual proxy configuration"
+
+#### HTTP Proxy
+
+`basic`
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.manual.http_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | HTTP address.
**Validator**: the domain name can be an IP |
+| **proxy.manual.http_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTP Port.
**Default**: 8080 |
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.manual.use_for_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Also use this proxy for HTTPS.
**Default**: True |
+
+#### "HTTPS Proxy" ou "SOCKS Proxy"
+
+`standard` _`hidden`_
+
+**Hidden**: if HTTPS and HTTPS is same has HTTP
+
+
+Cette famille constuit des familles dynamiquement.
+
+**Suffixes**:
- HTTPS
- SOCKS
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.manual.https_proxy.address** +
**proxy.manual.socks_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Address.
**Validator**: the domain name can be an IP
**Default**: the value of the variable "proxy.manual.http_proxy.address" |
+| **proxy.manual.https_proxy.port** +
**proxy.manual.socks_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Port.
**Default**: the value of the variable "proxy.manual.http_proxy.port" |
+| **proxy.manual.https_proxy.version** +
**proxy.manual.socks_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 ← (default)
**Disabled**: if not SOCKS
|
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Automatic proxy configuration URL.
**Disabled**: if "proxy.proxy_mode" is not "automatic proxy configuration URL"
|
+| **proxy.no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`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 only 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**: if "proxy.proxy_mode" is "No proxy" |
+| **proxy.prompt_authentication**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Prompt for authentication if password is saved.
**Default**: True
**Disabled**: if "proxy.proxy_mode" is "No proxy" |
+
+### DNS over HTTPS
+
+`basic`
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **proxy.dns_over_https.enable_dns_over_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Enable DNS over HTTPS.
**Default**: False |
+| **proxy.dns_over_https.provider**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Use Provider.
**Choices**:
- Cloudflare ← (default)
- NextDNS
- Custom
**Disabled**: if "proxy.dns_over_https.enable_dns_over_https" is not False |
+| **proxy.dns_over_https.custom_dns_url**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Custom DNS URL.
**Validator**: must starts with 'https://' only
**Disabled**: if "proxy.dns_over_https.provider" is "Custom" |
+
+
+## Variables for "foxyproxy"
+
+### Proxy configuration
+
+`basic`
+
+
+Cette famille contient des listes de bloc de variables.
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **foxyproxy.proxies.title**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` `unique` `multiple` | Title or Description. |
+| **foxyproxy.proxies.color**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Color. |
+| **foxyproxy.proxies.type**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Type.
**Choices**:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
- PAC URL
- WPAD
- System (use system settings)
- Direct (no proxy) ← (default) |
+| **foxyproxy.proxies.address**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ `multiple` | IP address, DNS name, server name.
**Default**: copy HTTP address if proxy is not "Manual"
**Disabled**: if type not in:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
|
+| **foxyproxy.proxies.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Port.
**Default**: copy HTTP port if proxy is not "Manual"
**Disabled**: if type not in:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
|
+| **foxyproxy.proxies.username**
[`unix_user`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`disabled`_ | Username.
**Disabled**: if type not in:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
|
+| **foxyproxy.proxies.password**
[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`hidden`_ _`disabled`_ | Password.
**Hidden**: if username is not defined
**Disabled**: if type not in:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
|
+| **foxyproxy.proxies.url**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | URL.
**Disabled**: if type is not in:
- PAC URL
- WPAD
|
+
+
+## Exemple avec les variables obligatoires non renseignées
+
+```yaml
+proxy:
+ manual:
+ http_proxy:
+ address: example.net
+ https_proxy:
+ address: example.net
+ socks_proxy:
+ address: example.net
+ auto: https://example.net
+ dns_over_https:
+ custom_dns_url: https://example.net
+```
+## Exemple avec tous les variables modifiables
+
+```yaml
+proxy:
+ proxy_mode: No proxy
+ manual:
+ http_proxy:
+ address: example.net
+ port: '8080'
+ use_for_https: true
+ https_proxy:
+ address: example.net
+ port: '8080'
+ version: v5
+ socks_proxy:
+ address: example.net
+ port: '8080'
+ version: v5
+ auto: https://example.net
+ no_proxy:
+ - .mozilla.org
+ - .net.nz
+ - 192.168.1.0/24
+ prompt_authentication: true
+ dns_over_https:
+ enable_dns_over_https: false
+ provider: Cloudflare
+ custom_dns_url: https://example.net
+foxyproxy:
+ proxies:
+ - title: xxx
+ color: xxx
+ type: Direct (no proxy)
+ address:
+ - None
+ port: '8080'
+ username: xxx
+ password: xxx
+ url: https://example.net
+```
diff --git a/build.py b/build.py
new file mode 100755
index 0000000..f4fbbf6
--- /dev/null
+++ b/build.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python3
+
+from pathlib import Path
+from ruamel.yaml import YAML
+from ansi2html import Ansi2HTMLConverter
+
+from rougail import RougailConfig, Rougail
+from rougail.output_exporter import RougailOutputExporter
+from rougail.user_data_file import RougailUserDataFile
+from rougail.output_doc import RougailOutputDoc
+
+
+NUM="50"
+
+
+if __name__ == "__main__":
+ rougailconfig = RougailConfig.copy()
+ rougailconfig['main_dictionaries'] = ['firefox']
+ rougailconfig['default_dictionary_format_version'] = '1.1'
+ if Path('foxyproxy').is_dir():
+ has_foxyproxy = False
+ rougailconfig['main_namespace'] = 'Firefox'
+ rougailconfig['extra_dictionaries'] = {'FoxyProxy': ['foxyproxy']}
+ else:
+ has_foxyproxy = True
+ rougailconfig['main_namespace'] = None
+# rougailconfig['tiramisu_cache'] = "cache.py"
+# rougail = Rougail(rougailconfig)
+# config = rougail.get_config()
+# print(config.value.get())
+ rougailconfig['step.output'] = 'doc'
+ rougailconfig['doc.output_format'] = 'github'
+ rougailconfig['doc.title_level'] = 3
+ inventory = RougailOutputDoc(rougailconfig=rougailconfig)
+ rougailconfig['step.output'] = 'exporter'
+ header = inventory.formater.header()
+ doc = ''
+ yaml = YAML()
+ namespace = 'firefox'
+ file_found = False
+ subdoc = ''
+ if rougailconfig['main_namespace']:
+ all_dirs = [[rougailconfig['main_dictionaries']], rougailconfig['extra_dictionaries'].values()]
+ else:
+ all_dirs = [[rougailconfig['main_dictionaries']]]
+
+ for r in all_dirs:
+ for dirs in r:
+ for d in dirs:
+ files = list(Path(d).iterdir())
+ files.sort()
+ for f in files:
+ namespace = f.parent.name
+ file_found = True
+ if f.name.endswith('.yml') or f.name.endswith('.yaml'):
+ subdoc += inventory.formater.title(str(f), 2)
+ with f.open(encoding="utf8") as file_fh:
+ objects = yaml.load(file_fh)
+ subdoc += inventory.formater.yaml(objects)
+# doc += f'\n'
+ doc += f'
\n\n'
+ with Path('summary.md').open('r') as sfh:
+ summary = sfh.read()
+ doc_file = Path('README.md')
+ doc = header + inventory.formater.title('Summary', 1) + '\n' + summary + '\n\n' + inventory.formater.title('Structural files', 1) + doc + '\n' + subdoc
+ with doc_file.open('r') as docfh:
+ doc += inventory.formater.title('Description', 2) + docfh.read()
+ if file_found:
+ doc += inventory.formater.title('Generated documentation', 2)
+ if has_foxyproxy:
+ cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -o doc -do github"
+ else:
+ cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -n Firefox -e FoxyProxy -d 1 foxyproxy -o doc -do github"
+ doc += f'```console\n{cmd}\n```\n'
+ doc += inventory.gen_doc()
+ #
+ config = Path('config')
+ if config.is_dir():
+ doc += inventory.formater.title('User data', 1)
+ configs = list(config.iterdir())
+ configs.sort()
+ for idx, dirname in enumerate(configs):
+ for filename in dirname.iterdir():
+ if filename.name.endswith('.yml') or filename.name.endswith('.yaml'):
+ doc += inventory.formater.title(f'Example {idx + 1}', 2)
+ # doc += inventory.formater.title(filename.name, 3)
+ with filename.open(encoding="utf8") as file_fh:
+ objects = yaml.load(file_fh)
+ doc += inventory.formater.title(str(filename), 3)
+ doc += inventory.formater.yaml(objects)
+ rougail = Rougail(rougailconfig)
+ tiramisu_config = rougail.get_config()
+ rougailconfig['step.user_data'] = ['file']
+ rougailconfig['file.filename'] = str(filename.absolute())
+ data = RougailUserDataFile(tiramisu_config, rougailconfig=rougailconfig)
+ data.read()
+ export = RougailOutputExporter(tiramisu_config)
+ export.errors = data.errors
+ export.warnings = data.warnings
+ export.exporter()
+ with export.formater.console.capture() as capture:
+ export.print()
+ conv = Ansi2HTMLConverter(inline=True)
+ doc += inventory.formater.title('Output', 3)
+ if has_foxyproxy:
+ cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff {filename}"
+ else:
+ cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -n Firefox -e FoxyProxy -d 1 foxyproxy -u file -ff {filename}"
+ doc += f"```console\n{cmd}\n```\n"
+ doc += '
' + conv.convert(capture.get(), full=False) + "\n" + # + with doc_file.open('w') as docfh: + docfh.write(doc) + with doc_file.open('w') as docfh: + docfh.write(doc) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..5e52052 --- /dev/null +++ b/build.sh @@ -0,0 +1,101 @@ +#!/bin/bash -e +set -x +DEST=../rougail-tutorials + +if [ -d $DEST ]; then + echo "déjà fait" + exit 1 +fi + +export LC_ALL=C + +BUILDER="$(pwd)" +mkdir -p $DEST/firefox +rm -f summary.md +touch summary.md +cd "$DEST" +DEST="$(pwd)" + + +cp "$BUILDER"/firefox.png . +cp "$BUILDER"/foxyproxy.png . +cp "$BUILDER"/summary.md . +touch README.md +"$BUILDER"/build.py +rm -rf summary.md +rm -rf jinja_caches +git init -b 1.1 +git add . +git commit -am"$(cat $BUILDER/TITLE)" +cd - > /dev/null + +for i in $(ls -d "examples"/* | sort); do + if [ -f "$i/README.md" ]; then + rm -rf "$DEST/config" + cp "summary.md" "$DEST" + echo $(basename "$i") + # + cd "$i/dictionaries" + if [ -d firefox ]; then + for j in $(ls firefox/*.yml 2>/dev/null); do + cp "$j" "$DEST/$j" + done + fi + if [ -d foxyproxy ]; then + mkdir -p $DEST/foxyproxy + for j in $(ls foxyproxy/*.yml 2>/dev/null); do + cp "$j" "$DEST/$j" + done + fi + cp -f ../README.md "$DEST" + if [ -d ../config ]; then + cp -aL ../config "$DEST" + fi + msg="[tutorial $(basename $i)] $(cat ../README.md)" + summary="[tutorial $(basename $i)] $(head -n 1 ../README.md)" + [ -e ../firefox.png ] && cp ../firefox.png "$DEST" + [ -e ../foxyproxy.png ] && cp ../foxyproxy.png "$DEST" + cd - > /dev/null + cd "$DEST" + echo "- $summary" >> summary.md + "$BUILDER"/build.py + rm -rf jinja_caches summary.md + git add . + git commit -am"$msg" + commit_id="$(git rev-parse HEAD)" + cd - > /dev/null + echo "- [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/commit/$commit_id))" >> summary.md + fi +done +cd "$DEST" +echo "# Description + +This tutorial shows to you an example of Rougail use on how to set a proxy in the Mozilla Firefox browser. + +More precisely, this tutorial aims at reproducing this [Mozilla Firefox](https://www.mozilla.org/firefox/new/) settings page: + + + +And the integration of part of the [Firefox FoxyProxy plugin](https://addons.mozilla.org/firefox/addon/foxyproxy-standard/). + +The idea is to have a namespace specific to FoxyProxy and to find in it part of the settings that we will have made in the main namespace. + +This is what the page looks like: + + +" > README.md +echo "# Summary + +Each step is a separerate commit. You can navigate to history to discover different aspect to the Rougail format. +" >> README.md +cat "$BUILDER"/summary.md >> README.md +echo >> README.md +git add . +rm -rf firefox foxyproxy +git commit -am"Summary" +# +git remote add origin ssh://git@forge.cloud.silique.fr:2222/stove/rougail-tutorials.git +git push --set-upstream origin 1.1 --force + +echo "FAIT" +exit 0 diff --git a/examples/001/README.md b/examples/001/README.md new file mode 100644 index 0000000..b75adba --- /dev/null +++ b/examples/001/README.md @@ -0,0 +1,10 @@ +A first variable + +In the Firefox configuration, it is possible to define several configuration modes, +from no proxy at all ("No proxy") to a kind of automatic configuration mode from a file +("Automatic proxy configuration URL"). + +We’re gonna create a first variable called "proxy_mode": + +- accepts only a string as value +- requires a value (that is, None is not an option) diff --git a/examples/001/config/01/config.yaml b/examples/001/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/001/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/001/config/02/config.yaml b/examples/001/config/02/config.yaml new file mode 100644 index 0000000..d914488 --- /dev/null +++ b/examples/001/config/02/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: No proxy diff --git a/examples/001/config/03/config.yaml b/examples/001/config/03/config.yaml new file mode 100644 index 0000000..74edb22 --- /dev/null +++ b/examples/001/config/03/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: Manual proxy configuration diff --git a/examples/001/config/04/config.yaml b/examples/001/config/04/config.yaml new file mode 100644 index 0000000..e3fa25d --- /dev/null +++ b/examples/001/config/04/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: foo diff --git a/examples/001/config/05/config.yaml b/examples/001/config/05/config.yaml new file mode 100644 index 0000000..bf6f64c --- /dev/null +++ b/examples/001/config/05/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: 1 diff --git a/examples/001/dictionaries/firefox/00-proxy.yml b/examples/001/dictionaries/firefox/00-proxy.yml new file mode 100644 index 0000000..e468d85 --- /dev/null +++ b/examples/001/dictionaries/firefox/00-proxy.yml @@ -0,0 +1,2 @@ +--- +proxy_mode: diff --git a/examples/001/firefox.png b/examples/001/firefox.png new file mode 100644 index 0000000..45725ac Binary files /dev/null and b/examples/001/firefox.png differ diff --git a/examples/001/firefox.xcf b/examples/001/firefox.xcf new file mode 100644 index 0000000..1101ae9 Binary files /dev/null and b/examples/001/firefox.xcf differ diff --git a/examples/002/README.md b/examples/002/README.md new file mode 100644 index 0000000..bd15787 --- /dev/null +++ b/examples/002/README.md @@ -0,0 +1,9 @@ +The variable description + +We can add a description to this first variable. + +This information is useful for: + +- documentation +- error message +- help user to known which value to set to this variable (for example with [the user data plugin Questionary](https://forge.cloud.silique.fr/gnunux/rougail-user-data-questionary)). diff --git a/examples/002/config b/examples/002/config new file mode 120000 index 0000000..6cf3df8 --- /dev/null +++ b/examples/002/config @@ -0,0 +1 @@ +../001/config \ No newline at end of file diff --git a/examples/002/dictionaries/firefox/00-proxy.yml b/examples/002/dictionaries/firefox/00-proxy.yml new file mode 100644 index 0000000..0299903 --- /dev/null +++ b/examples/002/dictionaries/firefox/00-proxy.yml @@ -0,0 +1,3 @@ +--- +proxy_mode: + description: Configure Proxy Access to the Internet diff --git a/examples/003/README.md b/examples/003/README.md new file mode 100644 index 0000000..2931300 --- /dev/null +++ b/examples/003/README.md @@ -0,0 +1,7 @@ +A default value + +Now we can define the default value of this variable. + +If the user doesn't touch this variable's value, the value is "No proxy" + +As user intervention is no more required, so the variable change it's default mode too (from "basic" to "standard"). diff --git a/examples/003/config b/examples/003/config new file mode 120000 index 0000000..6cf3df8 --- /dev/null +++ b/examples/003/config @@ -0,0 +1 @@ +../001/config \ No newline at end of file diff --git a/examples/003/dictionaries/firefox/00-proxy.yml b/examples/003/dictionaries/firefox/00-proxy.yml new file mode 100644 index 0000000..9d7618a --- /dev/null +++ b/examples/003/dictionaries/firefox/00-proxy.yml @@ -0,0 +1,4 @@ +--- +proxy_mode: + description: Configure Proxy Access to the Internet + default: No proxy diff --git a/examples/004/README.md b/examples/004/README.md new file mode 100644 index 0000000..529e7d6 --- /dev/null +++ b/examples/004/README.md @@ -0,0 +1,7 @@ +A variable with type choice + +"Foo" should not be an option to the "proxy_mode" variable. + +Now the "proxy_mode" type is "choice", that means that there is a list of available values that can be selected. + +We say that the "proxy_mode" variable is constrained (by choices): this variable accept, in fact, only a list of choices. diff --git a/examples/004/config b/examples/004/config new file mode 120000 index 0000000..6cf3df8 --- /dev/null +++ b/examples/004/config @@ -0,0 +1 @@ +../001/config \ No newline at end of file diff --git a/examples/004/dictionaries/firefox/00-proxy.yml b/examples/004/dictionaries/firefox/00-proxy.yml new file mode 100644 index 0000000..0272c72 --- /dev/null +++ b/examples/004/dictionaries/firefox/00-proxy.yml @@ -0,0 +1,11 @@ +--- +proxy_mode: + description: Configure Proxy Access to the Internet + type: choice + choices: + - No proxy + - Auto-detect proxy settings for this network + - Use system proxy settings + - Manual proxy configuration + - Automatic proxy configuration URL + default: No proxy diff --git a/examples/005/README.md b/examples/005/README.md new file mode 100644 index 0000000..4f83f97 --- /dev/null +++ b/examples/005/README.md @@ -0,0 +1,3 @@ +Choice type is optional + +The type is optional in choice type (if we have choices attributes, it's a choice option). diff --git a/examples/005/config b/examples/005/config new file mode 120000 index 0000000..6cf3df8 --- /dev/null +++ b/examples/005/config @@ -0,0 +1 @@ +../001/config \ No newline at end of file diff --git a/examples/005/dictionaries/firefox/00-proxy.yml b/examples/005/dictionaries/firefox/00-proxy.yml new file mode 100644 index 0000000..41f5978 --- /dev/null +++ b/examples/005/dictionaries/firefox/00-proxy.yml @@ -0,0 +1,10 @@ +--- +proxy_mode: + description: Configure Proxy Access to the Internet + choices: + - No proxy + - Auto-detect proxy settings for this network + - Use system proxy settings + - Manual proxy configuration + - Automatic proxy configuration URL + default: No proxy diff --git a/examples/010/README.md b/examples/010/README.md new file mode 100644 index 0000000..6a27bc7 --- /dev/null +++ b/examples/010/README.md @@ -0,0 +1,14 @@ +A family + +The "manual" mode structural descriptions are write in a new files to separate things. But Rougail will concatenate variables and families. + +We create a family, which will contain other variables. + +This family has: + +- a description +- a type + +As there is no variable inside this family, the type is mandatory. Without it, Rougail will create a variable. + +In fact, this family will be deleted by Rougail too because it is empty. diff --git a/examples/010/config/01/config.yaml b/examples/010/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/010/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/010/config/02/config.yaml b/examples/010/config/02/config.yaml new file mode 100644 index 0000000..74edb22 --- /dev/null +++ b/examples/010/config/02/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: Manual proxy configuration diff --git a/examples/010/dictionaries/firefox/10-manual.yml b/examples/010/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..8a704f5 --- /dev/null +++ b/examples/010/dictionaries/firefox/10-manual.yml @@ -0,0 +1,4 @@ +--- +manual: + description: Manual proxy configuration + type: family diff --git a/examples/010/firefox.png b/examples/010/firefox.png new file mode 100644 index 0000000..2dea193 Binary files /dev/null and b/examples/010/firefox.png differ diff --git a/examples/010/firefox.xcf b/examples/010/firefox.xcf new file mode 100644 index 0000000..d73e03e Binary files /dev/null and b/examples/010/firefox.xcf differ diff --git a/examples/011/README.md b/examples/011/README.md new file mode 100644 index 0000000..8072d5b --- /dev/null +++ b/examples/011/README.md @@ -0,0 +1,5 @@ +Conditional desactived family + +This family will be desactived if "proxy_mode" is not "manual proxy configuration". + +Desactived a variable or a family means that this variable will never be accessible. diff --git a/examples/011/config b/examples/011/config new file mode 120000 index 0000000..160a2a6 --- /dev/null +++ b/examples/011/config @@ -0,0 +1 @@ +../010/config \ No newline at end of file diff --git a/examples/011/dictionaries/firefox/10-manual.yml b/examples/011/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..29ea6a3 --- /dev/null +++ b/examples/011/dictionaries/firefox/10-manual.yml @@ -0,0 +1,8 @@ +--- +manual: + description: Manual proxy configuration + type: family + disabled: + type: variable + variable: proxy_mode + when_not: 'Manual proxy configuration' diff --git a/examples/012/README.md b/examples/012/README.md new file mode 100644 index 0000000..3a2fca9 --- /dev/null +++ b/examples/012/README.md @@ -0,0 +1,7 @@ +A sub family + +Inside a family, we can have variables or families. + +The "type" for family "manual" became unecessary because container an other family, so it's not a variable. + +In disabled attribute, it's better tu use relative path (we will see the reason in an other slide). diff --git a/examples/012/config b/examples/012/config new file mode 120000 index 0000000..160a2a6 --- /dev/null +++ b/examples/012/config @@ -0,0 +1 @@ +../010/config \ No newline at end of file diff --git a/examples/012/dictionaries/firefox/10-manual.yml b/examples/012/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..e875aa8 --- /dev/null +++ b/examples/012/dictionaries/firefox/10-manual.yml @@ -0,0 +1,11 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: + description: HTTP Proxy + type: family diff --git a/examples/013/README.md b/examples/013/README.md new file mode 100644 index 0000000..8aac5a2 --- /dev/null +++ b/examples/013/README.md @@ -0,0 +1,5 @@ +Family in "shorthand" mode + +The sub family is now in "shorthand" mode. In this mode we can only define "name" and "description" attributes. + +Inside the sub family we add two variables (with domainname and port types). diff --git a/examples/013/config/01/config.yaml b/examples/013/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/013/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/013/config/02/config.yaml b/examples/013/config/02/config.yaml new file mode 100644 index 0000000..74edb22 --- /dev/null +++ b/examples/013/config/02/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: Manual proxy configuration diff --git a/examples/013/config/03/config.yaml b/examples/013/config/03/config.yaml new file mode 100644 index 0000000..e3db924 --- /dev/null +++ b/examples/013/config/03/config.yaml @@ -0,0 +1,5 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: example.net diff --git a/examples/013/config/04/config.yaml b/examples/013/config/04/config.yaml new file mode 100644 index 0000000..c8d73af --- /dev/null +++ b/examples/013/config/04/config.yaml @@ -0,0 +1,6 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: example.net + port: '3128' diff --git a/examples/013/dictionaries/firefox/10-manual.yml b/examples/013/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..09b82d0 --- /dev/null +++ b/examples/013/dictionaries/firefox/10-manual.yml @@ -0,0 +1,20 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' diff --git a/examples/014/README.md b/examples/014/README.md new file mode 100644 index 0000000..02e52b2 --- /dev/null +++ b/examples/014/README.md @@ -0,0 +1,3 @@ +A boolean variable + +Let's create a boolean variable. diff --git a/examples/014/config/01/config.yaml b/examples/014/config/01/config.yaml new file mode 100644 index 0000000..e3db924 --- /dev/null +++ b/examples/014/config/01/config.yaml @@ -0,0 +1,5 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: example.net diff --git a/examples/014/dictionaries/firefox/10-manual.yml b/examples/014/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..93ad535 --- /dev/null +++ b/examples/014/dictionaries/firefox/10-manual.yml @@ -0,0 +1,25 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: + description: Also use this proxy for HTTPS + type: boolean + default: true diff --git a/examples/015/README.md b/examples/015/README.md new file mode 100644 index 0000000..bb1058e --- /dev/null +++ b/examples/015/README.md @@ -0,0 +1,3 @@ +Bases type is optional if default value + +The type is deduct with the default value type. This is only true for "string", "number", "float" or "boolean" variables. diff --git a/examples/015/config b/examples/015/config new file mode 120000 index 0000000..6bb267f --- /dev/null +++ b/examples/015/config @@ -0,0 +1 @@ +../014/config \ No newline at end of file diff --git a/examples/015/dictionaries/firefox/10-manual.yml b/examples/015/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..587510b --- /dev/null +++ b/examples/015/dictionaries/firefox/10-manual.yml @@ -0,0 +1,24 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: + description: Also use this proxy for HTTPS + default: true diff --git a/examples/016/README.md b/examples/016/README.md new file mode 100644 index 0000000..1ca6797 --- /dev/null +++ b/examples/016/README.md @@ -0,0 +1,9 @@ +A variable in "shorthand" mode + +Transform it in "shorthand" mode. + +In this notation we can only define: + +- name +- default value (so deduct the type) +- description diff --git a/examples/016/config b/examples/016/config new file mode 120000 index 0000000..6bb267f --- /dev/null +++ b/examples/016/config @@ -0,0 +1 @@ +../014/config \ No newline at end of file diff --git a/examples/016/dictionaries/firefox/10-manual.yml b/examples/016/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..f486e14 --- /dev/null +++ b/examples/016/dictionaries/firefox/10-manual.yml @@ -0,0 +1,22 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: true # Also use this proxy for HTTPS diff --git a/examples/017/README.md b/examples/017/README.md new file mode 100644 index 0000000..887f4cd --- /dev/null +++ b/examples/017/README.md @@ -0,0 +1,9 @@ +Conditional hidden family and calculated default value + +Add a sub family "https_proxy" which will be hidden if "use_for_https" is True. + +Hidden means that we cannot change value, but we can access to it in read only mode. Inside, we add two variable with calculated default value (with variable type). + +So, if user set "use_for_https" to True, the default values of HTTPS configuration will be a copy of HTTP values. The use can change HTTPS values if needed. + +If user set "use_for_https" to False, the default values of HTTPS configuration will only be a copy of HTTP values. diff --git a/examples/017/config b/examples/017/config new file mode 120000 index 0000000..6bb267f --- /dev/null +++ b/examples/017/config @@ -0,0 +1 @@ +../014/config \ No newline at end of file diff --git a/examples/017/dictionaries/firefox/10-manual.yml b/examples/017/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..d27e939 --- /dev/null +++ b/examples/017/dictionaries/firefox/10-manual.yml @@ -0,0 +1,44 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: true # Also use this proxy for HTTPS + + https_proxy: + description: HTTPS Proxy + hidden: + type: variable + variable: _.use_for_https + + address: + description: HTTPS address + type: domainname + params: + allow_ip: true + default: + type: variable + variable: __.http_proxy.address + + port: + description: HTTPS Port + type: port + default: + type: variable + variable: __.http_proxy.port diff --git a/examples/018/README.md b/examples/018/README.md new file mode 100644 index 0000000..bef3f23 --- /dev/null +++ b/examples/018/README.md @@ -0,0 +1,15 @@ +A dynamic family + +HTTPS and socks proxy are very similar. It could be interesting to do on dynamic family instead of duplicate family and variable description. + +First of all, we add a dynamic attribute to the family. Dynamic is here a static list of suffix. It could be a variable or jinja informations too. + +The dynamic family is only hidden in the HTTPs case. +Hidden is now a Jinja calculation with a parameter named "suffix". + +The suffix is use in: + +- family name +- family description +- variables name +- variables description diff --git a/examples/018/config/01/config.yaml b/examples/018/config/01/config.yaml new file mode 100644 index 0000000..135d8b3 --- /dev/null +++ b/examples/018/config/01/config.yaml @@ -0,0 +1,5 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net diff --git a/examples/018/config/02/config.yaml b/examples/018/config/02/config.yaml new file mode 100644 index 0000000..4a1f789 --- /dev/null +++ b/examples/018/config/02/config.yaml @@ -0,0 +1,9 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net + port: '3128' + use_for_https: false + https_proxy: + address: https.proxy.net diff --git a/examples/018/dictionaries/firefox/10-manual.yml b/examples/018/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..7120496 --- /dev/null +++ b/examples/018/dictionaries/firefox/10-manual.yml @@ -0,0 +1,54 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: true # Also use this proxy for HTTPS + + "{{ suffix }}_proxy": + description: "{{ suffix }} Proxy" + type: dynamic + dynamic: + - HTTPS + - SOCKS + hidden: + type: jinja + jinja: | + {% if suffix == 'HTTPS' and _.use_for_https %} + HTTPS is same has HTTP + {% endif %} + params: + suffix: + type: suffix + + address: + description: "{{ suffix }} address" + type: domainname + params: + allow_ip: true + default: + type: variable + variable: __.http_proxy.address + + port: + description: "{{ suffix }} port" + type: port + default: + type: variable + variable: __.http_proxy.port diff --git a/examples/019/README.md b/examples/019/README.md new file mode 100644 index 0000000..215a16d --- /dev/null +++ b/examples/019/README.md @@ -0,0 +1,5 @@ +Description of Jinja calculation + +By default, the Jinja calculation is generic in documentation. We can add a useful description. + +We add a new variable "version" only accessible in "Socks" family. diff --git a/examples/019/config/01/config.yaml b/examples/019/config/01/config.yaml new file mode 100644 index 0000000..135d8b3 --- /dev/null +++ b/examples/019/config/01/config.yaml @@ -0,0 +1,5 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net diff --git a/examples/019/config/02/config.yaml b/examples/019/config/02/config.yaml new file mode 100644 index 0000000..4a1f789 --- /dev/null +++ b/examples/019/config/02/config.yaml @@ -0,0 +1,9 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net + port: '3128' + use_for_https: false + https_proxy: + address: https.proxy.net diff --git a/examples/019/dictionaries/firefox/10-manual.yml b/examples/019/dictionaries/firefox/10-manual.yml new file mode 100644 index 0000000..9f99950 --- /dev/null +++ b/examples/019/dictionaries/firefox/10-manual.yml @@ -0,0 +1,74 @@ +--- +manual: + description: Manual proxy configuration + disabled: + type: variable + variable: _.proxy_mode + when_not: 'Manual proxy configuration' + + http_proxy: # HTTP Proxy + + address: + description: HTTP address + type: domainname + params: + allow_ip: true + + port: + description: HTTP Port + type: port + default: '8080' + + use_for_https: true # Also use this proxy for HTTPS + + "{{ suffix }}_proxy": + description: "{{ suffix }} Proxy" + type: dynamic + dynamic: + - HTTPS + - SOCKS + hidden: + type: jinja + jinja: | + {% if suffix == 'HTTPS' and _.use_for_https %} + HTTPS is same has HTTP + {% endif %} + params: + suffix: + type: suffix + description: | + if "use_for_https" is set to True + + address: + description: "{{ suffix }} address" + type: domainname + params: + allow_ip: true + default: + type: variable + variable: __.http_proxy.address + + port: + description: "{{ suffix }} port" + type: port + default: + type: variable + variable: __.http_proxy.port + + version: + description: SOCKS host version used by proxy + choices: + - v4 + - v5 + default: v5 + disabled: + type: jinja + jinja: | + {% if suffix == 'HTTPS' %} + if HTTPS + {% endif %} + params: + suffix: + type: suffix + description: | + if not SOCKS diff --git a/examples/020/README.md b/examples/020/README.md new file mode 100644 index 0000000..2f96325 --- /dev/null +++ b/examples/020/README.md @@ -0,0 +1,3 @@ +A conditional disabled variable + +Add a new "auto" variable. diff --git a/examples/020/config/01/config.yaml b/examples/020/config/01/config.yaml new file mode 100644 index 0000000..26df130 --- /dev/null +++ b/examples/020/config/01/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: Automatic proxy configuration URL diff --git a/examples/020/config/02/config.yaml b/examples/020/config/02/config.yaml new file mode 100644 index 0000000..307e175 --- /dev/null +++ b/examples/020/config/02/config.yaml @@ -0,0 +1,3 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat diff --git a/examples/020/dictionaries/firefox/20-auto.yml b/examples/020/dictionaries/firefox/20-auto.yml new file mode 100644 index 0000000..0fa4dba --- /dev/null +++ b/examples/020/dictionaries/firefox/20-auto.yml @@ -0,0 +1,12 @@ +--- +auto: + description: Automatic proxy configuration URL + type: web_address + disabled: + type: jinja + jinja: | + {% if _.proxy_mode != 'Automatic proxy configuration URL' %} + the proxy mode is not automatic + {% endif %} + description: | + if "firefox.proxy_mode" is not "automatic proxy configuration URL" diff --git a/examples/020/firefox.png b/examples/020/firefox.png new file mode 100644 index 0000000..20701e2 Binary files /dev/null and b/examples/020/firefox.png differ diff --git a/examples/020/firefox.xcf b/examples/020/firefox.xcf new file mode 100644 index 0000000..89c7f4b Binary files /dev/null and b/examples/020/firefox.xcf differ diff --git a/examples/030/README.md b/examples/030/README.md new file mode 100644 index 0000000..760e014 --- /dev/null +++ b/examples/030/README.md @@ -0,0 +1,4 @@ +A conditional disabled variable + +Add a new "no\_proxy" variable. + diff --git a/examples/030/config/01/config.yaml b/examples/030/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/030/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/030/config/02/config.yaml b/examples/030/config/02/config.yaml new file mode 100644 index 0000000..54956ea --- /dev/null +++ b/examples/030/config/02/config.yaml @@ -0,0 +1,4 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat +no_proxy: 192.168.1.0/24 diff --git a/examples/030/dictionaries/firefox/30-no_proxy.yml b/examples/030/dictionaries/firefox/30-no_proxy.yml new file mode 100644 index 0000000..16f160b --- /dev/null +++ b/examples/030/dictionaries/firefox/30-no_proxy.yml @@ -0,0 +1,16 @@ +--- +no_proxy: + description: Address for which proxy will be desactivated + type: "domainname" + params: + allow_ip: true + allow_cidr_network: true + allow_without_dot: true + allow_startswith_dot: true + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" diff --git a/examples/031/README.md b/examples/031/README.md new file mode 100644 index 0000000..a2074cb --- /dev/null +++ b/examples/031/README.md @@ -0,0 +1,3 @@ +A variable multi + +This variable accept multiple value. diff --git a/examples/031/config/01/config.yaml b/examples/031/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/031/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/031/config/02/config.yaml b/examples/031/config/02/config.yaml new file mode 100644 index 0000000..ccba4c0 --- /dev/null +++ b/examples/031/config/02/config.yaml @@ -0,0 +1,6 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat +no_proxy: + - example.net + - 192.168.1.0/24 diff --git a/examples/031/config/03/config.yaml b/examples/031/config/03/config.yaml new file mode 100644 index 0000000..307e175 --- /dev/null +++ b/examples/031/config/03/config.yaml @@ -0,0 +1,3 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat diff --git a/examples/031/dictionaries/firefox/30-no_proxy.yml b/examples/031/dictionaries/firefox/30-no_proxy.yml new file mode 100644 index 0000000..066b55d --- /dev/null +++ b/examples/031/dictionaries/firefox/30-no_proxy.yml @@ -0,0 +1,17 @@ +--- +no_proxy: + description: Address for which proxy will be desactivated + type: "domainname" + multi: true + params: + allow_ip: true + allow_cidr_network: true + allow_without_dot: true + allow_startswith_dot: true + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" diff --git a/examples/032/README.md b/examples/032/README.md new file mode 100644 index 0000000..d83ef1b --- /dev/null +++ b/examples/032/README.md @@ -0,0 +1 @@ +A non mandatory variable diff --git a/examples/032/config b/examples/032/config new file mode 120000 index 0000000..51b7987 --- /dev/null +++ b/examples/032/config @@ -0,0 +1 @@ +../031/config \ No newline at end of file diff --git a/examples/032/dictionaries/firefox/30-no_proxy.yml b/examples/032/dictionaries/firefox/30-no_proxy.yml new file mode 100644 index 0000000..f8a68ab --- /dev/null +++ b/examples/032/dictionaries/firefox/30-no_proxy.yml @@ -0,0 +1,18 @@ +--- +no_proxy: + description: Address for which proxy will be desactivated + type: "domainname" + params: + allow_ip: true + allow_cidr_network: true + allow_without_dot: true + allow_startswith_dot: true + multi: true + mandatory: false + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" diff --git a/examples/033/README.md b/examples/033/README.md new file mode 100644 index 0000000..da36ca2 --- /dev/null +++ b/examples/033/README.md @@ -0,0 +1,3 @@ +Examples + +We can add example (only for documentation). diff --git a/examples/033/config b/examples/033/config new file mode 120000 index 0000000..51b7987 --- /dev/null +++ b/examples/033/config @@ -0,0 +1 @@ +../031/config \ No newline at end of file diff --git a/examples/033/dictionaries/firefox/30-no_proxy.yml b/examples/033/dictionaries/firefox/30-no_proxy.yml new file mode 100644 index 0000000..788a1a1 --- /dev/null +++ b/examples/033/dictionaries/firefox/30-no_proxy.yml @@ -0,0 +1,22 @@ +--- +no_proxy: + description: Address for which proxy will be desactivated + type: "domainname" + params: + allow_ip: true + allow_cidr_network: true + allow_without_dot: true + allow_startswith_dot: true + multi: true + mandatory: false + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" + test: + - .mozilla.org + - .net.nz + - 192.168.1.0/24 diff --git a/examples/034/README.md b/examples/034/README.md new file mode 100644 index 0000000..a2a2030 --- /dev/null +++ b/examples/034/README.md @@ -0,0 +1,3 @@ +Help + +We can add help informations for documentation. diff --git a/examples/034/config/01/config.yaml b/examples/034/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/034/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/034/config/02/config.yaml b/examples/034/config/02/config.yaml new file mode 100644 index 0000000..307e175 --- /dev/null +++ b/examples/034/config/02/config.yaml @@ -0,0 +1,3 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat diff --git a/examples/034/config/03/config.yaml b/examples/034/config/03/config.yaml new file mode 100644 index 0000000..5319897 --- /dev/null +++ b/examples/034/config/03/config.yaml @@ -0,0 +1,6 @@ +--- +proxy_mode: Automatic proxy configuration URL +auto: https://auto.proxy.net/wpad.dat +no_proxy: + - .example.net + - 192.168.1.0/24 diff --git a/examples/034/dictionaries/firefox/30-no_proxy.yml b/examples/034/dictionaries/firefox/30-no_proxy.yml new file mode 100644 index 0000000..b44565e --- /dev/null +++ b/examples/034/dictionaries/firefox/30-no_proxy.yml @@ -0,0 +1,23 @@ +--- +no_proxy: + description: Address for which proxy will be desactivated + type: "domainname" + params: + allow_ip: true + allow_cidr_network: true + allow_without_dot: true + allow_startswith_dot: true + multi: true + mandatory: false + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" + test: + - .mozilla.org + - .net.nz + - 192.168.1.0/24 + help: Connections to localhost, 127.0.0.1/8 and ::1 are never proxied diff --git a/examples/040/README.md b/examples/040/README.md new file mode 100644 index 0000000..c19e709 --- /dev/null +++ b/examples/040/README.md @@ -0,0 +1 @@ +A variable in avanced mode diff --git a/examples/040/config/01/config.yaml b/examples/040/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/040/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/040/config/02/config.yaml b/examples/040/config/02/config.yaml new file mode 100644 index 0000000..135d8b3 --- /dev/null +++ b/examples/040/config/02/config.yaml @@ -0,0 +1,5 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net diff --git a/examples/040/config/03/config.yaml b/examples/040/config/03/config.yaml new file mode 100644 index 0000000..d04e72c --- /dev/null +++ b/examples/040/config/03/config.yaml @@ -0,0 +1,6 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net +proxy_dns_socks5: true diff --git a/examples/040/config/04/config.yaml b/examples/040/config/04/config.yaml new file mode 100644 index 0000000..8ceca7b --- /dev/null +++ b/examples/040/config/04/config.yaml @@ -0,0 +1,7 @@ +--- +proxy_mode: Manual proxy configuration +manual: + http_proxy: + address: http.proxy.net + socks_proxy: + version: v4 diff --git a/examples/040/dictionaries/firefox/40-prompt_authentication.yml b/examples/040/dictionaries/firefox/40-prompt_authentication.yml new file mode 100644 index 0000000..494578d --- /dev/null +++ b/examples/040/dictionaries/firefox/40-prompt_authentication.yml @@ -0,0 +1,11 @@ +--- +prompt_authentication: + description: Prompt for authentication if password is saved + default: true + disabled: + type: jinja + jinja: | + {% if _.proxy_mode == 'No proxy' %} + proxy mode is no proxy + {% endif %} + description: if "firefox.proxy_mode" is "No proxy" diff --git a/examples/040/dictionaries/firefox/50-proxy_dns_socks5.yml b/examples/040/dictionaries/firefox/50-proxy_dns_socks5.yml new file mode 100644 index 0000000..5b5d92b --- /dev/null +++ b/examples/040/dictionaries/firefox/50-proxy_dns_socks5.yml @@ -0,0 +1,20 @@ +--- +proxy_dns_socks5: + description: Use proxy DNS when using SOCKS v5 + default: false + mode: advanced + disabled: + type: jinja + jinja: | + {% if _.proxy_mode != 'Manual proxy configuration' %} + the proxy mode is not manual + {% elif socks_version == 'v4' %} + socks version is v4 + {% endif %} + params: + socks_version: + type: variable + variable: _.manual.socks_proxy.version + propertyerror: false + description: | + if "firefox.proxy_mode" is not "Manual proxy configuration" or "firefox.manual.socks_proxy.version" is "v4" diff --git a/examples/040/firefox.png b/examples/040/firefox.png new file mode 100644 index 0000000..34e6c08 Binary files /dev/null and b/examples/040/firefox.png differ diff --git a/examples/040/firefox.xcf b/examples/040/firefox.xcf new file mode 100644 index 0000000..ac54e0c Binary files /dev/null and b/examples/040/firefox.xcf differ diff --git a/examples/060/README.md b/examples/060/README.md new file mode 100644 index 0000000..4207bc8 --- /dev/null +++ b/examples/060/README.md @@ -0,0 +1 @@ +A boolean variable diff --git a/examples/060/config/01/config.yaml b/examples/060/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/060/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/060/dictionaries/firefox/60-dns_over_https.yml b/examples/060/dictionaries/firefox/60-dns_over_https.yml new file mode 100644 index 0000000..d709ea5 --- /dev/null +++ b/examples/060/dictionaries/firefox/60-dns_over_https.yml @@ -0,0 +1,4 @@ +--- +dns_over_https: # DNS over HTTPS + + enable_dns_over_https: false # Enable DNS over HTTPS diff --git a/examples/060/firefox.png b/examples/060/firefox.png new file mode 100644 index 0000000..d368003 Binary files /dev/null and b/examples/060/firefox.png differ diff --git a/examples/060/firefox.xcf b/examples/060/firefox.xcf new file mode 100644 index 0000000..c362607 Binary files /dev/null and b/examples/060/firefox.xcf differ diff --git a/examples/061/README.md b/examples/061/README.md new file mode 100644 index 0000000..9215d09 --- /dev/null +++ b/examples/061/README.md @@ -0,0 +1 @@ +A choice variable diff --git a/examples/061/config/01/config.yaml b/examples/061/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/061/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/061/config/02/config.yaml b/examples/061/config/02/config.yaml new file mode 100644 index 0000000..aee4796 --- /dev/null +++ b/examples/061/config/02/config.yaml @@ -0,0 +1,3 @@ +--- +dns_over_https: + enable_dns_over_https: true diff --git a/examples/061/dictionaries/firefox/60-dns_over_https.yml b/examples/061/dictionaries/firefox/60-dns_over_https.yml new file mode 100644 index 0000000..4fa7edd --- /dev/null +++ b/examples/061/dictionaries/firefox/60-dns_over_https.yml @@ -0,0 +1,20 @@ +--- +dns_over_https: # DNS over HTTPS + + enable_dns_over_https: false # Enable DNS over HTTPS + + provider: + description: Use Provider + choices: + - Cloudflare + - NextDNS + - Custom + default: Cloudflare + disabled: + type: jinja + jinja: | + {% if not _.enable_dns_over_https %} + Enable DNS over HTTPS is False + {% endif %} + description: | + if "firefox.dns_over_https.enable_dns_over_https" is not False diff --git a/examples/062/README.md b/examples/062/README.md new file mode 100644 index 0000000..c11c818 --- /dev/null +++ b/examples/062/README.md @@ -0,0 +1 @@ +A variable with custom validation diff --git a/examples/062/config/01/config.yaml b/examples/062/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/062/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/062/config/02/config.yaml b/examples/062/config/02/config.yaml new file mode 100644 index 0000000..aee4796 --- /dev/null +++ b/examples/062/config/02/config.yaml @@ -0,0 +1,3 @@ +--- +dns_over_https: + enable_dns_over_https: true diff --git a/examples/062/config/03/config.yaml b/examples/062/config/03/config.yaml new file mode 100644 index 0000000..2497fc1 --- /dev/null +++ b/examples/062/config/03/config.yaml @@ -0,0 +1,5 @@ +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: http://dns.net diff --git a/examples/062/config/04/config.yaml b/examples/062/config/04/config.yaml new file mode 100644 index 0000000..7f28b0d --- /dev/null +++ b/examples/062/config/04/config.yaml @@ -0,0 +1,5 @@ +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: https://dns.net diff --git a/examples/062/dictionaries/firefox/60-dns_over_https.yml b/examples/062/dictionaries/firefox/60-dns_over_https.yml new file mode 100644 index 0000000..de0e11a --- /dev/null +++ b/examples/062/dictionaries/firefox/60-dns_over_https.yml @@ -0,0 +1,43 @@ +--- +dns_over_https: # DNS over HTTPS + + enable_dns_over_https: false # Enable DNS over HTTPS + + provider: + description: Use Provider + choices: + - Cloudflare + - NextDNS + - Custom + default: Cloudflare + disabled: + type: jinja + jinja: | + {% if not _.enable_dns_over_https %} + Enable DNS over HTTPS is False + {% endif %} + description: | + if "firefox.dns_over_https.enable_dns_over_https" is not False + + custom_dns_url: + description: Custom DNS URL + type: web_address + disabled: + type: jinja + jinja: | + {% if provider is not defined or provider != 'Custom' %} + provider is not custom + {% endif %} + params: + provider: + type: variable + variable: _.provider + propertyerror: false + description: if "firefox.dns_over_https.provider" is not "Custom" + validators: + - type: jinja + jinja: | + {% if _.custom_dns_url.startswith('http://') %} + only https is allowed + {% endif %} + description: must starts with 'https://' only diff --git a/examples/100/README.md b/examples/100/README.md new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/examples/100/README.md @@ -0,0 +1 @@ +xxx diff --git a/examples/100/config/01/config.yaml b/examples/100/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/100/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/100/config/02/config.yaml b/examples/100/config/02/config.yaml new file mode 100644 index 0000000..c43d770 --- /dev/null +++ b/examples/100/config/02/config.yaml @@ -0,0 +1,7 @@ +--- +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + address: proxy.my_company.net diff --git a/examples/100/config/03/config.yaml b/examples/100/config/03/config.yaml new file mode 100644 index 0000000..bf2cc98 --- /dev/null +++ b/examples/100/config/03/config.yaml @@ -0,0 +1,20 @@ +--- +firefox: + proxy_mode: Manual proxy configuration + manual: + http_proxy: + address: http.proxy.net +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + - title: An other company + color: '#cc66cc' + type: SOCKS5 + username: my_user + password: my_password + - title: WPAD + color: '#1166cc' + type: WPAD + url: http://wpad.proxy.net/wpad.dat diff --git a/examples/100/dictionaries/foxyproxy/00-foxyproxy.yml b/examples/100/dictionaries/foxyproxy/00-foxyproxy.yml new file mode 100644 index 0000000..16a9c9e --- /dev/null +++ b/examples/100/dictionaries/foxyproxy/00-foxyproxy.yml @@ -0,0 +1,12 @@ +--- +proxies: + description: Proxy configuration + type: leadership + + title: + description: Title or Description + multi: true + mandatory: false + + color: + description: Color diff --git a/examples/101/README.md b/examples/101/README.md new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/examples/101/README.md @@ -0,0 +1 @@ +xxx diff --git a/examples/101/config/01/config.yaml b/examples/101/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/101/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/101/config/02/config.yaml b/examples/101/config/02/config.yaml new file mode 100644 index 0000000..c43d770 --- /dev/null +++ b/examples/101/config/02/config.yaml @@ -0,0 +1,7 @@ +--- +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + address: proxy.my_company.net diff --git a/examples/101/config/03/config.yaml b/examples/101/config/03/config.yaml new file mode 100644 index 0000000..bf2cc98 --- /dev/null +++ b/examples/101/config/03/config.yaml @@ -0,0 +1,20 @@ +--- +firefox: + proxy_mode: Manual proxy configuration + manual: + http_proxy: + address: http.proxy.net +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + - title: An other company + color: '#cc66cc' + type: SOCKS5 + username: my_user + password: my_password + - title: WPAD + color: '#1166cc' + type: WPAD + url: http://wpad.proxy.net/wpad.dat diff --git a/examples/101/dictionaries/foxyproxy/00-foxyproxy.yml b/examples/101/dictionaries/foxyproxy/00-foxyproxy.yml new file mode 100644 index 0000000..4b363ee --- /dev/null +++ b/examples/101/dictionaries/foxyproxy/00-foxyproxy.yml @@ -0,0 +1,18 @@ +--- +proxies: + description: Proxy configuration + type: leadership + + title: + description: Title or Description + multi: true + mandatory: false + + color: + description: Color +# validators: +# - type: jinja +# jinja: | +# {% if _.color | regex_search('/^#([A-F0-9]{3}|[A-F0-9]{6})$/i') %} +# not a valid color, should be somethink like #000000 +# {% endif %} diff --git a/examples/102/README.md b/examples/102/README.md new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/examples/102/README.md @@ -0,0 +1 @@ +xxx diff --git a/examples/102/config/01/config.yaml b/examples/102/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/102/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/102/config/02/config.yaml b/examples/102/config/02/config.yaml new file mode 100644 index 0000000..c43d770 --- /dev/null +++ b/examples/102/config/02/config.yaml @@ -0,0 +1,7 @@ +--- +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + address: proxy.my_company.net diff --git a/examples/102/config/03/config.yaml b/examples/102/config/03/config.yaml new file mode 100644 index 0000000..bf2cc98 --- /dev/null +++ b/examples/102/config/03/config.yaml @@ -0,0 +1,20 @@ +--- +firefox: + proxy_mode: Manual proxy configuration + manual: + http_proxy: + address: http.proxy.net +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + - title: An other company + color: '#cc66cc' + type: SOCKS5 + username: my_user + password: my_password + - title: WPAD + color: '#1166cc' + type: WPAD + url: http://wpad.proxy.net/wpad.dat diff --git a/examples/102/dictionaries/foxyproxy/00-foxyproxy.yml b/examples/102/dictionaries/foxyproxy/00-foxyproxy.yml new file mode 100644 index 0000000..e94b7b3 --- /dev/null +++ b/examples/102/dictionaries/foxyproxy/00-foxyproxy.yml @@ -0,0 +1,32 @@ +--- +proxies: + description: Proxy configuration + _type: leadership + + title: + description: Title or Description + multi: true + mandatory: false + + type: + description: Proxy Type + type: choice + choices: + - HTTP + - HTTPS/SSL + - SOCKS4 + - SOCKS5 + - PAC URL + - WPAD + - System (use system settings) + - Direct (no proxy) + default: Direct (no proxy) + + color: + description: Color +# validators: +# - type: jinja +# jinja: | +# {% if _.color | regex_search('/^#([A-F0-9]{3}|[A-F0-9]{6})$/i') %} +# not a valid color, should be somethink like #000000 +# {% endif %} diff --git a/examples/103/README.md b/examples/103/README.md new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/examples/103/README.md @@ -0,0 +1 @@ +xxx diff --git a/examples/103/config/01/config.yaml b/examples/103/config/01/config.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/examples/103/config/01/config.yaml @@ -0,0 +1 @@ +--- diff --git a/examples/103/config/02/config.yaml b/examples/103/config/02/config.yaml new file mode 100644 index 0000000..c43d770 --- /dev/null +++ b/examples/103/config/02/config.yaml @@ -0,0 +1,7 @@ +--- +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + address: proxy.my_company.net diff --git a/examples/103/config/03/config.yaml b/examples/103/config/03/config.yaml new file mode 100644 index 0000000..bf2cc98 --- /dev/null +++ b/examples/103/config/03/config.yaml @@ -0,0 +1,20 @@ +--- +firefox: + proxy_mode: Manual proxy configuration + manual: + http_proxy: + address: http.proxy.net +foxyproxy: + proxies: + - title: My company + color: '#66cc66' + type: HTTP + - title: An other company + color: '#cc66cc' + type: SOCKS5 + username: my_user + password: my_password + - title: WPAD + color: '#1166cc' + type: WPAD + url: http://wpad.proxy.net/wpad.dat diff --git a/examples/103/dictionaries/foxyproxy/00-foxyproxy.yml b/examples/103/dictionaries/foxyproxy/00-foxyproxy.yml new file mode 100644 index 0000000..2012c76 --- /dev/null +++ b/examples/103/dictionaries/foxyproxy/00-foxyproxy.yml @@ -0,0 +1,125 @@ +--- +proxies: + description: Proxy configuration + _type: leadership + + title: + description: Title or Description + multi: true + mandatory: false + + type: + description: Proxy Type + type: choice + choices: + - HTTP + - HTTPS/SSL + - SOCKS4 + - SOCKS5 + - PAC URL + - WPAD + - System (use system settings) + - Direct (no proxy) + default: Direct (no proxy) + + color: + description: Color +# validators: +# - type: jinja +# jinja: | +# {% if _.color | regex_search('/^#([A-F0-9]{3}|[A-F0-9]{6})$/i') %} +# not a valid color, should be somethink like #000000 +# {% endif %} + + address: + description: IP address, DNS name, server name + disabled: &needs_address + type: jinja + jinja: | + {% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %} + disabled + {% endif %} + description: | + if type not in: + - HTTP + - HTTPS/SSL + - SOCKS4 + - SOCKS5 + default: + type: jinja + jinja: | + {% if firefox_address is not undefined %} + {{ firefox_address }} + {% endif %} + params: + firefox_address: + type: variable + variable: firefox.manual.http_proxy.address + propertyerror: false + description: copy HTTP address if proxy is not "Manual" + + port: + description: Port + type: port + default: + type: jinja + jinja: | + {% if firefox_port is not undefined %} + {{ firefox_port }} + {% endif %} + params: + firefox_port: + type: variable + variable: firefox.manual.http_proxy.port + propertyerror: false + description: copy HTTP port if proxy is not "Manual" + disabled: *needs_address + + username: + description: Username + type: unix_user + mandatory: + type: jinja + jinja: | + {% if password is not undefined and password %} + username is mandatory + {% endif %} + params: + password: + type: variable + variable: _.password + propertyerror: false + description: if a password is set + disabled: *needs_address + + password: + description: Password + type: secret + mandatory: false + disabled: *needs_address + + url: + description: URL + type: web_address + disabled: + type: jinja + jinja: | + {% if _.type not in ['PAC URL', 'WPAD'] %} + proxy does not need url + {% endif %} + description: | + if type is not in: + - PAC URL + - WPAD + default: + type: jinja + jinja: | + {% if firefox_url is not undefined %} + {{ firefox_url }} + {% endif %} + params: + firefox_url: + type: variable + variable: firefox.auto + propertyerror: false + description: copy HTTP address if proxy is "Auto" diff --git a/examples/110/README.md b/examples/110/README.md new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/examples/110/README.md @@ -0,0 +1 @@ +xxx diff --git a/examples/110/dictionaries/foxyproxy/10-redefine.yml b/examples/110/dictionaries/foxyproxy/10-redefine.yml new file mode 100644 index 0000000..83578f0 --- /dev/null +++ b/examples/110/dictionaries/foxyproxy/10-redefine.yml @@ -0,0 +1,15 @@ +--- +proxies: + username: + redefine: true + mandatory: false + + password: + redefine: true + hidden: + type: jinja + jinja: | + {% if not _.username %} + no username defined + {% endif %} + description: if username is not defined diff --git a/firefox.png b/firefox.png new file mode 100644 index 0000000..050f837 Binary files /dev/null and b/firefox.png differ diff --git a/foxyproxy.png b/foxyproxy.png new file mode 100644 index 0000000..418dad0 Binary files /dev/null and b/foxyproxy.png differ diff --git a/load.py b/load.py new file mode 100755 index 0000000..97335f2 --- /dev/null +++ b/load.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +from pathlib import Path +from ruamel.yaml import YAML + +from rougail import Rougail, RougailConfig + + +if __name__ == "__main__": + rougailconfig = RougailConfig.copy() + rougailconfig['variable_namespace'] = 'proxy' + rougailconfig['dictionaries_dir'] = ['proxy'] + rougailconfig['extra_dictionaries'] = {'foxyproxy': ['foxyproxy']} + rougailconfig['tiramisu_cache'] = "cache.py" + rougail = Rougail(rougailconfig) + config = rougail.get_config() + print(config.value.get())