|
@@ -106,7 +106,12 @@
|
|
|
<td class="p-4 text-gray-400 font-mono text-xs">{{ t.ttl }}s</td>
|
|
<td class="p-4 text-gray-400 font-mono text-xs">{{ t.ttl }}s</td>
|
|
|
<td class="p-4 text-gray-400 font-mono text-xs">{{ t.refresh }}s</td>
|
|
<td class="p-4 text-gray-400 font-mono text-xs">{{ t.refresh }}s</td>
|
|
|
<td class="p-4 text-right pr-6 whitespace-nowrap">
|
|
<td class="p-4 text-right pr-6 whitespace-nowrap">
|
|
|
- <button type="button" onclick="editTemplate('{{ name|e }}', '{{ idx }}')" class="text-blue-400 text-[10px] font-black uppercase mr-4">Edit</button>
|
|
|
|
|
|
|
+ <button type="button"
|
|
|
|
|
+ data-name="{{ name|e }}"
|
|
|
|
|
+ data-idx="{{ idx }}"
|
|
|
|
|
+ onclick="editTemplate(this.getAttribute('data-name'), this.getAttribute('data-idx'))"
|
|
|
|
|
+ class="text-blue-400 text-[10px] font-black uppercase mr-4">Edit</button>
|
|
|
|
|
+
|
|
|
<button type="button" onclick="this.closest('tr').remove()" class="text-red-500 text-[10px] font-black uppercase">Delete</button>
|
|
<button type="button" onclick="this.closest('tr').remove()" class="text-red-500 text-[10px] font-black uppercase">Delete</button>
|
|
|
|
|
|
|
|
<div class="hidden" id="data-container-{{ idx }}">
|
|
<div class="hidden" id="data-container-{{ idx }}">
|
|
@@ -115,7 +120,7 @@
|
|
|
<input type="hidden" name="t_retry[]" value="{{ t.retry }}">
|
|
<input type="hidden" name="t_retry[]" value="{{ t.retry }}">
|
|
|
<input type="hidden" name="t_expire[]" value="{{ t.expire }}">
|
|
<input type="hidden" name="t_expire[]" value="{{ t.expire }}">
|
|
|
<input type="hidden" name="t_ttl[]" value="{{ t.ttl }}">
|
|
<input type="hidden" name="t_ttl[]" value="{{ t.ttl }}">
|
|
|
- <textarea name="t_content[]" class="hidden">{{ t.content }}</textarea>
|
|
|
|
|
|
|
+ <textarea name="t_content[]" class="hidden">{{ t.content|e }}</textarea>
|
|
|
<div id="vars-storage-{{ idx }}">
|
|
<div id="vars-storage-{{ idx }}">
|
|
|
{% for vk, vv in t.custom_vars.items() %}
|
|
{% for vk, vv in t.custom_vars.items() %}
|
|
|
<input type="hidden" name="custom_key_{{ idx }}[]" value="{{ vk|e }}">
|
|
<input type="hidden" name="custom_key_{{ idx }}[]" value="{{ vk|e }}">
|
|
@@ -242,12 +247,15 @@ function applyToTable() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Η ΔΙΟΡΘΩΣΗ ΕΔΩ: Ασφαλής περασμένη μεταβλητή μέσω data-attributes και για τα νέα templates!
|
|
|
|
|
+ const safeNameAttr = tName.replace(/"/g, '"');
|
|
|
|
|
+
|
|
|
const trHtml = `
|
|
const trHtml = `
|
|
|
<td class="p-4 pl-6 text-green-400 font-black">${tName}</td>
|
|
<td class="p-4 pl-6 text-green-400 font-black">${tName}</td>
|
|
|
<td class="p-4 text-gray-400 font-mono text-xs">${tTtl}s</td>
|
|
<td class="p-4 text-gray-400 font-mono text-xs">${tTtl}s</td>
|
|
|
<td class="p-4 text-gray-400 font-mono text-xs">${tRefresh}s</td>
|
|
<td class="p-4 text-gray-400 font-mono text-xs">${tRefresh}s</td>
|
|
|
<td class="p-4 text-right pr-6 whitespace-nowrap">
|
|
<td class="p-4 text-right pr-6 whitespace-nowrap">
|
|
|
- <button type="button" onclick="editTemplate('${tName}', '${idx}')" class="text-blue-400 text-[10px] font-black uppercase mr-4">Edit</button>
|
|
|
|
|
|
|
+ <button type="button" data-name="${safeNameAttr}" data-idx="${idx}" onclick="editTemplate(this.getAttribute('data-name'), this.getAttribute('data-idx'))" class="text-blue-400 text-[10px] font-black uppercase mr-4">Edit</button>
|
|
|
<button type="button" onclick="this.closest('tr').remove()" class="text-red-500 text-[10px] font-black uppercase">Delete</button>
|
|
<button type="button" onclick="this.closest('tr').remove()" class="text-red-500 text-[10px] font-black uppercase">Delete</button>
|
|
|
|
|
|
|
|
<div class="hidden" id="data-container-${idx}">
|
|
<div class="hidden" id="data-container-${idx}">
|
|
@@ -274,6 +282,7 @@ function applyToTable() {
|
|
|
tr.innerHTML = trHtml;
|
|
tr.innerHTML = trHtml;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Ασφαλής εισαγωγή του περιεχομένου στο textarea
|
|
|
tr.querySelector('textarea[name="t_content[]"]').value = tContent;
|
|
tr.querySelector('textarea[name="t_content[]"]').value = tContent;
|
|
|
|
|
|
|
|
closeModal();
|
|
closeModal();
|