From db0ed65aa2a403b4fb0455bc55c04e513fe769da Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sat, 4 Jan 2025 18:59:17 +0000 Subject: [PATCH 01/14] add support for delete link --- CHANGELOG.md | 5 +++++ jinjafx_server.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2e2c8..c28db24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## CHANGELOG +### [25.1.2] - In Development +- Check we specify ?ds=Live for example when selecting a DataTemplate +- Added a "Delete Link" button to allow DataTemplates to be deleted + ### [25.1.1] - Jan 1, 2025 - Rewritten Web Log authentication so it will now prompt you for a password @@ -368,6 +372,7 @@ - Initial release +[25.1.2]: https://github.com/cmason3/jinjafx_server/compare/25.1.1...25.1.2 [25.1.1]: https://github.com/cmason3/jinjafx_server/compare/25.1.0...25.1.1 [25.1.0]: https://github.com/cmason3/jinjafx_server/compare/24.12.1...25.1.0 [24.12.1]: https://github.com/cmason3/jinjafx_server/compare/24.12.0...24.12.1 diff --git a/jinjafx_server.py b/jinjafx_server.py index 71e8d18..f0d5c05 100755 --- a/jinjafx_server.py +++ b/jinjafx_server.py @@ -26,7 +26,7 @@ import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess import cmarkgfm, emoji -__version__ = '25.1.1' +__version__ = '25.1.2' llock = threading.RLock() rlock = threading.RLock() From 1744c54c3be86924b57592a0ad0312eaac788fdc Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sat, 4 Jan 2025 19:02:36 +0000 Subject: [PATCH 02/14] add support for delete link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c28db24..459aed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ ## CHANGELOG ### [25.1.2] - In Development -- Check we specify ?ds=Live for example when selecting a DataTemplate - Added a "Delete Link" button to allow DataTemplates to be deleted +- Added support so a specific DataSet can be selected via the DataTemplate URL using `ds=` ### [25.1.1] - Jan 1, 2025 - Rewritten Web Log authentication so it will now prompt you for a password From e03a370e30f16777803f1257a97f5af355a58820 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sun, 5 Jan 2025 11:33:56 +0000 Subject: [PATCH 03/14] add support for ds param --- www/index.html | 2 +- www/jinjafx_m.js | 70 +++++++++++++++++++----------------------------- 2 files changed, 28 insertions(+), 44 deletions(-) diff --git a/www/index.html b/www/index.html index fe4cd1b..b1f999e 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 631c7fb..151c503 100644 --- a/www/jinjafx_m.js +++ b/www/jinjafx_m.js @@ -860,7 +860,10 @@ function getStatusText(code) { dt_encrypted = false; } - if (dt.hasOwnProperty('dataset')) { + if (qs.hasOwnProperty('ds')) { + load_datatemplate(dt['dt'], qs, qs['ds']); + } + else if (dt.hasOwnProperty('dataset')) { load_datatemplate(dt['dt'], qs, dt['dataset']); } else { @@ -1770,15 +1773,26 @@ function getStatusText(code) { } }; }); - + + if (window.location.search.length > 1) { + var v = window.location.search.substr(1).split('&'); + + for (var i = 0; i < v.length; i++) { + var p = v[i].split('='); + qs[p[0].toLowerCase()] = decodeURIComponent(p.length > 1 ? p[1] : ''); + } + } + if (window.location.pathname.startsWith('/dt/') && (window.location.pathname.length > 4)) { qs['dt'] = decodeURIComponent(window.location.pathname.substr(4)); - + } + + if (qs.hasOwnProperty('dt')) { if (document.getElementById('get_link').value != 'false') { try_to_load(); - + document.getElementById('lbuttons').classList.remove('d-none'); - + if (fe != window.cmData) { onDataBlur(); } @@ -1790,44 +1804,11 @@ function getStatusText(code) { loaded = true; } } - else if (window.location.href.indexOf('?') > -1) { - var v = window.location.href.substr(window.location.href.indexOf('?') + 1).split('&'); - - for (var i = 0; i < v.length; i++) { - var p = v[i].split('='); - qs[p[0].toLowerCase()] = decodeURIComponent(p.length > 1 ? p[1] : ''); - } - - if (qs.hasOwnProperty('dt')) { - if (document.getElementById('get_link').value != 'false') { - try_to_load(); - - document.getElementById('lbuttons').classList.remove('d-none'); - - if (fe != window.cmData) { - onDataBlur(); - } - } - else { - set_status("darkred", "HTTP ERROR 503", "Service Unavailable"); - reset_location(''); - document.getElementById('buttons').classList.remove('d-none'); - loaded = true; - } - } - else { - reset_location(''); - document.getElementById('buttons').classList.remove('d-none'); - loaded = true; - } - } else { - if (document.getElementById('get_link').value != 'false') { - document.getElementById('lbuttons').classList.remove('d-none'); - } + reset_location(''); + document.getElementById('buttons').classList.remove('d-none'); document.getElementById('stemplates').style.visibility = 'hidden'; document.getElementById('template_info').style.visibility = 'visible'; - document.getElementById('buttons').classList.remove('d-none'); loaded = true; } } @@ -2024,9 +2005,6 @@ function getStatusText(code) { if (tinfo) { if (editor == window.cmTemplate) { remove_info(); - //document.getElementById('template_info').classList.add('fade-out'); - //document.getElementById('template_info').style.zIndex = -1000; - //document.getElementById('stemplates').style.visibility = 'visible'; tinfo = false; } } @@ -2047,6 +2025,12 @@ function getStatusText(code) { var data = _dt.datasets[ds].hasOwnProperty("data") ? _dt.datasets[ds].data : ""; var vars = _dt.datasets[ds].hasOwnProperty("vars") ? _dt.datasets[ds].vars : ""; datasets[ds] = [CodeMirror.Doc(data, 'data'), CodeMirror.Doc(vars, 'yaml')]; + + if (_ds != null) { + if (ds.toLowerCase() == _ds.toLowerCase()) { + _ds = ds; + } + } }); if ((_ds == null) || !datasets.hasOwnProperty(_ds)) { From 79f42f25d80e4ac051a1b152e5747fab66611c3e Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sun, 5 Jan 2025 12:04:13 +0000 Subject: [PATCH 04/14] add support for ds param --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 508bee7..d27d5a3 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ As well as supporting the standard CodeMirror shortcut keys for the "data.csv", The DataSet feature allows you to include multiple different "data.csv" and "vars.yml" contents while maintaining the same "template.j2". When enabled it also enables a "global.yml" pane for specifying global variables which are common across all DataSets (any variables which are redefined in "vars.yml" will overwrite variables in "global.yml"). This is to support scenarios where you have different DataSets for your Live vs your Test environments, but the template should be the same. There are no limits on the number of different DataSets that can be added to a single DataTemplate (the name must start with a letter and only contain alphanumerical, "-", " " or "_" characters). When you click "Generate" it will use the currently active DataSet to generate the output - clicking on the name of the current DataSet (by default there is a single "Default" DataSet) allows you to switch between the different DataSets. +You can also select a specific DataSet when you load a DataTemplate using the `ds` query string parameter (i.e. `?ds=Default'`). + ### Output Formats JinjaFx Server supports the ability to use "output" tags to create different outputs with different names like JinjaFx, but it also allows you to optionally specify how you want the output to be rendered. By default, the output is rendered as "text" but you also have the option to specify "html" and "markdown" (for GitHub Flavoured Markdown), which will result in the output being rendered appropriately, e.g: From decc8eecacadef76bc3bf9a9f016b19bcb81a6a3 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sun, 5 Jan 2025 12:05:50 +0000 Subject: [PATCH 05/14] add support for ds param --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 459aed4..45dc568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ ## CHANGELOG ### [25.1.2] - In Development +- Added support so a specific DataSet can be selected via the DataTemplate URL using `?ds=` - Added a "Delete Link" button to allow DataTemplates to be deleted -- Added support so a specific DataSet can be selected via the DataTemplate URL using `ds=` ### [25.1.1] - Jan 1, 2025 - Rewritten Web Log authentication so it will now prompt you for a password From 4926e90d62b30f462f20843fe85c84d655ca3820 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sun, 5 Jan 2025 12:51:38 +0000 Subject: [PATCH 06/14] add support for delete link --- www/index.html | 12 ++++++++++-- www/jinjafx_logs.js | 2 +- www/jinjafx_m.js | 40 ++++++++++++++++++++++++++++++---------- www/logs.html | 2 +- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/www/index.html b/www/index.html index b1f999e..e590825 100644 --- a/www/index.html +++ b/www/index.html @@ -32,7 +32,7 @@ - +
@@ -106,11 +106,19 @@
 Get New Link - +  Protect Link + + + + + + +  Delete Link + diff --git a/www/jinjafx_logs.js b/www/jinjafx_logs.js index 2aa5216..8e37f21 100644 --- a/www/jinjafx_logs.js +++ b/www/jinjafx_logs.js @@ -70,7 +70,7 @@ if (qs.has('key')) { key = qs.get('key'); - window.history.replaceState(null, null, window.location.pathname); + window.history.replaceState({}, document.title, window.location.pathname); sessionStorage.removeItem('jfx_weblog_key'); update(); } diff --git a/www/jinjafx_m.js b/www/jinjafx_m.js index 151c503..fa13111 100644 --- a/www/jinjafx_m.js +++ b/www/jinjafx_m.js @@ -418,6 +418,17 @@ function getStatusText(code) { return false; } + if (method == "delete") { + if (confirm("Are You Sure?") === true) { + apply_dt(true); + window.addEventListener('beforeunload', onBeforeUnload); + document.title = 'JinjaFx [unsaved]'; + dirty = true; + set_status("green", "OK", "Link Deleted", 10000); + } + return false; + } + switch_template(current_t, true, false); if (templates['Default'].getValue().length === 0) { window.cmTemplate.focus(); @@ -875,7 +886,8 @@ function getStatusText(code) { document.getElementById('get').classList.add('d-none'); document.getElementById('mdd').disabled = false; - document.getElementById('protect').classList.remove('disabled'); + // document.getElementById('protect').classList.remove('disabled'); + // document.getElementById('delete').classList.remove('disabled'); if (dt.hasOwnProperty('dt_password') || dt.hasOwnProperty('dt_mpassword')) { document.getElementById('protect_text').innerHTML = 'Update Protection'; dt_protected = true; @@ -967,6 +979,7 @@ function getStatusText(code) { document.getElementById('get2').onclick = function() { jinjafx('get_link'); }; document.getElementById('update').onclick = function() { jinjafx('update_link'); }; document.getElementById('protect').onclick = function() { jinjafx('protect'); }; + document.getElementById('delete').onclick = function() { jinjafx('delete'); }; if (window.crypto.subtle) { document.getElementById('encrypt').classList.remove('d-none'); @@ -992,7 +1005,7 @@ function getStatusText(code) { var obj = jsyaml.load(contents, jsyaml_schema); if (obj != null) { pending_dt = obj['dt']; - apply_dt(); + apply_dt(false); return true; } } @@ -1017,7 +1030,7 @@ function getStatusText(code) { var obj = jsyaml.load(e2.target.result, jsyaml_schema); if (obj != null) { pending_dt = obj['dt']; - apply_dt(); + apply_dt(false); return true; } } @@ -1809,6 +1822,10 @@ function getStatusText(code) { document.getElementById('buttons').classList.remove('d-none'); document.getElementById('stemplates').style.visibility = 'hidden'; document.getElementById('template_info').style.visibility = 'visible'; + + if (document.getElementById('get_link').value != 'false') { + document.getElementById('lbuttons').classList.remove('d-none'); + } loaded = true; } } @@ -1912,8 +1929,10 @@ function getStatusText(code) { } } - function apply_dt() { - load_datatemplate(pending_dt, null, null); + function apply_dt(dflag) { + if (!dflag) { + load_datatemplate(pending_dt, null, null); + } reset_location(''); dt_id = ''; dt_password = null; @@ -1923,9 +1942,10 @@ function getStatusText(code) { input_form = null; document.getElementById('update').classList.add('d-none'); document.getElementById('get').classList.remove('d-none'); - document.getElementById('mdd').disabled = true; - document.getElementById('protect').classList.add('disabled'); - document.getElementById('protect').innerHTML = 'Protect Link'; + document.getElementById('protect_text').innerHTML = 'Protect Link'; + setTimeout(function() { + document.getElementById('mdd').disabled = true; + }, 50); } function onPasteOrDrop(e, obj, target) { @@ -1937,11 +1957,11 @@ function getStatusText(code) { if (dirty) { if (confirm("Are You Sure?") === true) { - apply_dt(); + apply_dt(false); } } else { - apply_dt(); + apply_dt(false); } } } diff --git a/www/logs.html b/www/logs.html index 1ed4487..f5dd9aa 100644 --- a/www/logs.html +++ b/www/logs.html @@ -9,7 +9,7 @@ - +


From 7c4d69a82697d5ad3fefb31457d5667ac95f2fe5 Mon Sep 17 00:00:00 2001
From: Chris Mason 
Date: Sun, 5 Jan 2025 15:35:46 +0000
Subject: [PATCH 07/14] add support for delete link

---
 www/jinjafx_m.js | 71 ++++++++++++++++++++++++++++--------------------
 1 file changed, 42 insertions(+), 29 deletions(-)

diff --git a/www/jinjafx_m.js b/www/jinjafx_m.js
index fa13111..40a584d 100644
--- a/www/jinjafx_m.js
+++ b/www/jinjafx_m.js
@@ -40,7 +40,6 @@ function _utob(c) {
 }
 
 function utob(u) {
-  // Borrowed from Dan Kogai (https://github.com/dankogai/js-base64)
   return u.replace(/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, _utob);
 }
 
@@ -57,7 +56,6 @@ function _btou(cccc) {
 }
 
 function btou(b) {
-  // Borrowed from Dan Kogai (https://github.com/dankogai/js-base64)
   return b.replace(/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, _btou);
 }
 
@@ -119,6 +117,7 @@ function getStatusText(code) {
   var dt_opassword = null;
   var dt_mpassword = null;
   var dt_epassword = null;
+  var delete_pending = false;
   var input_form = null;
   var r_input_form = null;
   var jinput = null;
@@ -420,11 +419,8 @@ function getStatusText(code) {
 
     if (method == "delete") {
       if (confirm("Are You Sure?") === true) {
-        apply_dt(true);
-        window.addEventListener('beforeunload', onBeforeUnload);
-        document.title = 'JinjaFx [unsaved]';
-        dirty = true;
-        set_status("green", "OK", "Link Deleted", 10000);
+        set_wait();
+        update_link(dt_id, true);
       }
       return false;
     }
@@ -709,10 +705,10 @@ function getStatusText(code) {
           set_wait();
 
           if (method == "update_link") {
-            update_link(dt_id);
+            update_link(dt_id, false);
           }
           else {
-            update_link(null);
+            update_link(null, false);
           }
         }
       }
@@ -724,11 +720,16 @@ function getStatusText(code) {
     }
   }
 
-  function update_link(v_dt_id) {
+  function update_link(v_dt_id, dflag) {
     var xHR = new XMLHttpRequest();
 
     if (v_dt_id !== null) {
-      xHR.open("POST", "/get_link?id=" + v_dt_id, true);
+      if (dflag) {
+        xHR.open("POST", "/delete_link?id=" + v_dt_id, true);
+      }
+      else {
+        xHR.open("POST", "/get_link?id=" + v_dt_id, true);
+      }
       xHR.setRequestHeader("X-Dt-Protected", dt_protected ? 1 : 0);
       if (dt_password !== null) {
         xHR.setRequestHeader("X-Dt-Password", dt_password);
@@ -752,26 +753,38 @@ function getStatusText(code) {
     xHR.onload = function() {
       if (this.status === 200) {
         if (v_dt_id !== null) {
-          revision += 1;
-          if (dt_protected) {
-            if (dt_mpassword != null) {
-              dt_password = dt_mpassword;
-            }
-            else if (dt_opassword != null) {
-              dt_password = dt_opassword;
+          if (!dflag) {
+            revision += 1;
+            if (dt_protected) {
+              if (dt_mpassword != null) {
+                dt_password = dt_mpassword;
+              }
+              else if (dt_opassword != null) {
+                dt_password = dt_opassword;
+              }
+              if (dt_opassword != null) {
+                dt_epassword = dt_opassword;
+              }
             }
-            if (dt_opassword != null) {
-              dt_epassword = dt_opassword;
+            else {
+              dt_epassword = null;
+              dt_password = null;
             }
+            dt_opassword = null;
+            dt_mpassword = null;
+            set_status("green", "OK", "Link Updated");
+            window.removeEventListener('beforeunload', onBeforeUnload);
           }
           else {
-            dt_epassword = null;
-            dt_password = null;
+            apply_dt(true);
+            delete_pending = false;
+            document.title = 'JinjaFx [unsaved]';
+            dirty = true;
+            set_status("green", "OK", "Link Deleted", 10000);
+            window.addEventListener('beforeunload', onBeforeUnload);
+            clear_wait();
+            return false;
           }
-          dt_opassword = null;
-          dt_mpassword = null;
-          set_status("green", "OK", "Link Updated");
-          window.removeEventListener('beforeunload', onBeforeUnload);
         }
         else {
           window.removeEventListener('beforeunload', onBeforeUnload);
@@ -782,6 +795,7 @@ function getStatusText(code) {
       }
       else if (this.status == 401) {
         protect_action = 2;
+        delete_pending = dflag;
         document.getElementById('lb_protect').innerHTML = 'DataTemplate ' + this.getResponseHeader('X-Dt-Authentication') + ' Passsword';
         new bootstrap.Modal(document.getElementById('protect_input'), {
           keyboard: false
@@ -795,6 +809,7 @@ function getStatusText(code) {
         var sT = (this.statusText.length == 0) ? getStatusText(this.status) : this.statusText;
         set_status("darkred", "HTTP ERROR " + this.status, sT);
       }
+      delete_pending = false;
       clear_wait();
     };
 
@@ -886,8 +901,6 @@ function getStatusText(code) {
               document.getElementById('get').classList.add('d-none');
               document.getElementById('mdd').disabled = false;
 
-              // document.getElementById('protect').classList.remove('disabled');
-              // document.getElementById('delete').classList.remove('disabled');
               if (dt.hasOwnProperty('dt_password') || dt.hasOwnProperty('dt_mpassword')) {
                 document.getElementById('protect_text').innerHTML = 'Update Protection';
                 dt_protected = true;
@@ -1554,7 +1567,7 @@ function getStatusText(code) {
               try_to_load();
             }
             else {
-              update_link(dt_id);
+              update_link(dt_id, delete_pending);
             }
           }
           else {

From 7500919e28b14f307555b06b87c9ae52cd86773a Mon Sep 17 00:00:00 2001
From: Chris Mason 
Date: Sun, 5 Jan 2025 16:21:09 +0000
Subject: [PATCH 08/14] add support for delete link

---
 CHANGELOG.md      | 4 ++--
 jinjafx_server.py | 2 +-
 www/index.html    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45dc568..fbdc206 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
 ## CHANGELOG
 
-### [25.1.2] - In Development
+### [25.2.0] - In Development
 - Added support so a specific DataSet can be selected via the DataTemplate URL using `?ds=`
 - Added a "Delete Link" button to allow DataTemplates to be deleted
 
@@ -372,7 +372,7 @@
 - Initial release
 
 
-[25.1.2]: https://github.com/cmason3/jinjafx_server/compare/25.1.1...25.1.2
+[25.2.0]: https://github.com/cmason3/jinjafx_server/compare/25.1.1...25.2.0
 [25.1.1]: https://github.com/cmason3/jinjafx_server/compare/25.1.0...25.1.1
 [25.1.0]: https://github.com/cmason3/jinjafx_server/compare/24.12.1...25.1.0
 [24.12.1]: https://github.com/cmason3/jinjafx_server/compare/24.12.0...24.12.1
diff --git a/jinjafx_server.py b/jinjafx_server.py
index f0d5c05..78ec5de 100755
--- a/jinjafx_server.py
+++ b/jinjafx_server.py
@@ -26,7 +26,7 @@
 import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess
 import cmarkgfm, emoji
 
-__version__ = '25.1.2'
+__version__ = '25.2.0'
 
 llock = threading.RLock()
 rlock = threading.RLock()
diff --git a/www/index.html b/www/index.html
index e590825..0c09ef3 100644
--- a/www/index.html
+++ b/www/index.html
@@ -32,7 +32,7 @@
     
     
     
-    
+    
   
   
     
From 09b38244a8011b1b3437568c12146a497abecb16 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sun, 5 Jan 2025 16:58:05 +0000 Subject: [PATCH 09/14] add support for delete link --- www/jinjafx_m.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/www/jinjafx_m.js b/www/jinjafx_m.js index 40a584d..e2dacc8 100644 --- a/www/jinjafx_m.js +++ b/www/jinjafx_m.js @@ -825,16 +825,21 @@ function getStatusText(code) { xHR.timeout = 10000; xHR.setRequestHeader("Content-Type", "application/json"); - var rd = JSON.stringify(dt); - if (rd.length > 2048 * 1024) { - set_status("darkred", "ERROR", 'Content Too Large'); - } - else if (rd.length > 1024) { - xHR.setRequestHeader("Content-Encoding", "gzip"); - xHR.send(pako.gzip(rd)); + if (!dflag) { + var rd = JSON.stringify(dt); + if (rd.length > 2048 * 1024) { + set_status("darkred", "ERROR", 'Content Too Large'); + } + else if (rd.length > 1024) { + xHR.setRequestHeader("Content-Encoding", "gzip"); + xHR.send(pako.gzip(rd)); + } + else { + xHR.send(rd); + } } else { - xHR.send(rd); + xHR.send('{}'); } } From 622ac9d80ec6ed14e48e4f15ff467f6a85663eb9 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Mon, 6 Jan 2025 04:56:51 +0000 Subject: [PATCH 10/14] add support for delete link --- CHANGELOG.md | 3 ++- README.md | 2 +- jinjafx_server.py | 2 +- www/index.html | 8 ++++---- www/jinjafx_m.js | 22 +++++++++++++++------- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbdc206..fe4c22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ ## CHANGELOG ### [25.2.0] - In Development -- Added support so a specific DataSet can be selected via the DataTemplate URL using `?ds=` - Added a "Delete Link" button to allow DataTemplates to be deleted +- Added support so a specific DataSet can be selected via the DataTemplate URL using `?ds=` or `/dt/
/` +- Don't add a hash symbol to the end of the URL when clicking on links ### [25.1.1] - Jan 1, 2025 - Rewritten Web Log authentication so it will now prompt you for a password diff --git a/README.md b/README.md index d27d5a3..1c6f730 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ As well as supporting the standard CodeMirror shortcut keys for the "data.csv", The DataSet feature allows you to include multiple different "data.csv" and "vars.yml" contents while maintaining the same "template.j2". When enabled it also enables a "global.yml" pane for specifying global variables which are common across all DataSets (any variables which are redefined in "vars.yml" will overwrite variables in "global.yml"). This is to support scenarios where you have different DataSets for your Live vs your Test environments, but the template should be the same. There are no limits on the number of different DataSets that can be added to a single DataTemplate (the name must start with a letter and only contain alphanumerical, "-", " " or "_" characters). When you click "Generate" it will use the currently active DataSet to generate the output - clicking on the name of the current DataSet (by default there is a single "Default" DataSet) allows you to switch between the different DataSets. -You can also select a specific DataSet when you load a DataTemplate using the `ds` query string parameter (i.e. `?ds=Default'`). +You can also select a specific DataSet when you load a DataTemplate using the `ds` query string parameter (i.e. `?ds='`) or by adding an additional path element (i.e. `/dt/
/`). ### Output Formats diff --git a/jinjafx_server.py b/jinjafx_server.py index 78ec5de..2a62ee9 100755 --- a/jinjafx_server.py +++ b/jinjafx_server.py @@ -247,7 +247,7 @@ def do_GET(self, head=False, cache=True, versioned=False): fpath = '/index.html' self.hide = not verbose - if re.search(r'^/dt/[A-Za-z0-9_-]{1,24}$', fpath): + if re.search(r'^/dt/[A-Za-z0-9_-]{1,24}(?:/[A-Za-z][A-Za-z0-9_ -]*)?$', fpath): fpath = '/index.html' if re.search(r'^/[a-f0-9]{8}/', fpath): diff --git a/www/index.html b/www/index.html index 0c09ef3..7e733ea 100644 --- a/www/index.html +++ b/www/index.html @@ -32,7 +32,7 @@ - +
@@ -100,18 +100,18 @@