diff --git a/CHANGELOG.md b/CHANGELOG.md index 75ece09..ec16dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## CHANGELOG +### [25.5.1] - Feb 11, 2025 +- Changed behaviour of `jinjafx_vault_undefined`, so it only returns undefined if the password is missing +- Added support for adding blank lines between output sections using `` as closing tag + ### [25.5.0] - Feb 10, 2025 - Disabled dropdowns for DataSets and Templates are now opaque and don't show text behind them - Overhauled how Ansible Vault works and added `jinjafx_vault_undefined` from JinjaFx @@ -406,6 +410,7 @@ - Initial release +[25.5.1]: https://github.com/cmason3/jinjafx_server/compare/25.5.0...25.5.1 [25.5.0]: https://github.com/cmason3/jinjafx_server/compare/25.4.0...25.5.0 [25.4.0]: https://github.com/cmason3/jinjafx_server/compare/25.3.2...25.4.0 [25.3.2]: https://github.com/cmason3/jinjafx_server/compare/25.3.1...25.3.2 diff --git a/README.md b/README.md index cfe06b8..167c322 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ You can also paste in an image and it will convert it to a Base64 encoded Data U JinjaFx Server supports the ability to perform Ansible Vault encryption of strings from within the browser using client side JavaScript. By clicking on the padlock it will prompt you for your string and the password to use which you can then use within `vars.yml`. JinjaFx doesn't support the ability to use different passwords for different strings within the same DataTemplate so it is important that all vaulted strings are using the same password within the same DataTemplate. -By default JinjaFx will fail with "invalid ansible vault password" if the provided Ansible Vault password is incorrect. The `jinjafx_vault_undefined` variable allows you to change this behaviour - if set to `True` then it will proceed to process the template, but if it can't decrypt a vaulted variable due to an incorrect or missing password then the variable won't be defined. +By default JinjaFx will fail with "invalid ansible vault password" if the provided Ansible Vault password is empty or missing. The `jinjafx_vault_undefined` variable allows you to change this behaviour - if set to `True` then it will proceed to process the template, but if it can't decrypt a vaulted variable due to a missing password then the variable won't be defined. ### JinjaFx Input diff --git a/jinjafx_server.py b/jinjafx_server.py index ab3fa3f..4a516a2 100755 --- a/jinjafx_server.py +++ b/jinjafx_server.py @@ -27,7 +27,7 @@ import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess import cmarkgfm, emoji -__version__ = '25.5.0' +__version__ = '25.5.1' llock = threading.RLock() rlock = threading.RLock() @@ -502,6 +502,9 @@ def do_POST(self): if y := yaml.load(gyaml, Loader=yaml.SafeLoader): vault_undef = y.get('jinjafx_vault_undefined', vault_undef) + if vpw.strip(): + vault_undef = False + def yaml_vault_tag(loader, node): x = jinjafx.AnsibleVault().decrypt(node.value.encode('utf-8'), vpw, vault_undef) if x is not None: diff --git a/setup.py b/setup.py index ae6fae5..55b9733 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ packages=["jinjafx_server"], include_package_data=True, package_data={'': ['www/*', 'pandoc/reference.docx']}, - install_requires=["jinjafx>=1.24.3", "requests", "cmarkgfm>=0.5.0", "emoji"], + install_requires=["jinjafx>=1.24.4", "requests", "cmarkgfm>=0.5.0", "emoji"], entry_points={ "console_scripts": [ "jinjafx_server=jinjafx_server:main", diff --git a/www/index.html b/www/index.html index f184d90..2548316 100644 --- a/www/index.html +++ b/www/index.html @@ -32,7 +32,7 @@ - +
diff --git a/www/jinjafx_m.js b/www/jinjafx_m.js index d3c6e4b..278b9e8 100644 --- a/www/jinjafx_m.js +++ b/www/jinjafx_m.js @@ -643,7 +643,7 @@ function getStatusText(code) { set_wait(); var rbody = vars['jinjafx_input']['body']; - rbody = rbody.replace(/<(?:output[\t ]+.+?|\/output[\t ]*)>.*?\n/gi, ''); + rbody = rbody.replace(/<(?:output[\t ]+.+?|\/output[\t ]*(?:\\n[\t ]*)?)>.*?\n/gi, ''); xHR.timeout = 10000; xHR.setRequestHeader("Content-Type", "application/json"); @@ -1331,7 +1331,7 @@ function getStatusText(code) { state.output = 1; return "jfx-output-left"; } - else if (stream.match(/<(?=\/output *>)/i)) { + else if (stream.match(/<(?=\/output *(?:\\n *)?>)/i)) { state.type = 2; state.output = 1; return "jfx-output-left";