Commit c8d67301 authored by Your Name's avatar Your Name

Fix malformed Jinja2 template syntax caused by previous sed replacement

- Corrected nested template tags in dashboard templates
- All fetch() calls and URL generations now use proper url_for syntax
- Templates should render correctly now
parent a320f5af
...@@ -73,7 +73,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. ...@@ -73,7 +73,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
function restartServer() { function restartServer() {
if (confirm('Are you sure you want to restart the server? This will disconnect all active connections.')) { if (confirm('Are you sure you want to restart the server? This will disconnect all active connections.')) {
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/restart") }}', { fetch('{{ url_for(request, "/dashboard/restart") }}', {
method: 'POST', method: 'POST',
headers: {'Content-Type': 'application/json'} headers: {'Content-Type': 'application/json'}
}) })
......
...@@ -912,7 +912,7 @@ async function authenticateCodex(key) { ...@@ -912,7 +912,7 @@ async function authenticateCodex(key) {
statusEl.innerHTML = '<p style="margin: 0; color: #4a9eff;">🔄 Starting Codex OAuth2 Device Authorization flow...</p>'; statusEl.innerHTML = '<p style="margin: 0; color: #4a9eff;">🔄 Starting Codex OAuth2 Device Authorization flow...</p>';
try { try {
const response = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/codex/auth/start") }}', { const response = await fetch('{{ url_for(request, "/dashboard/codex/auth/start") }}', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...@@ -962,7 +962,7 @@ async function authenticateCodex(key) { ...@@ -962,7 +962,7 @@ async function authenticateCodex(key) {
pollCount++; pollCount++;
try { try {
const pollResponse = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/codex/auth/poll") }}', { const pollResponse = await fetch('{{ url_for(request, "/dashboard/codex/auth/poll") }}', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...@@ -1015,7 +1015,7 @@ async function checkCodexAuth(key) { ...@@ -1015,7 +1015,7 @@ async function checkCodexAuth(key) {
statusEl.innerHTML = '<p style="margin: 0; color: #4a9eff;">🔄 Checking Codex authentication status...</p>'; statusEl.innerHTML = '<p style="margin: 0; color: #4a9eff;">🔄 Checking Codex authentication status...</p>';
try { try {
const response = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/codex/auth/status") }}', { const response = await fetch('{{ url_for(request, "/dashboard/codex/auth/status") }}', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
......
...@@ -508,7 +508,7 @@ function createPersistentService() { ...@@ -508,7 +508,7 @@ function createPersistentService() {
async function checkTorStatus() { async function checkTorStatus() {
try { try {
const response = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/tor/status") }}'); const response = await fetch('{{ url_for(request, "/dashboard/tor/status") }}');
const status = await response.json(); const status = await response.json();
const statusText = document.getElementById('tor-status-text'); const statusText = document.getElementById('tor-status-text');
...@@ -550,7 +550,7 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -550,7 +550,7 @@ document.addEventListener('DOMContentLoaded', function() {
async function refreshCacheStats() { async function refreshCacheStats() {
try { try {
const response = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/response-cache/stats") }}'); const response = await fetch('{{ url_for(request, "/dashboard/response-cache/stats") }}');
const data = await response.json(); const data = await response.json();
const statsText = document.getElementById('cache-stats-text'); const statsText = document.getElementById('cache-stats-text');
...@@ -585,7 +585,7 @@ async function clearResponseCache() { ...@@ -585,7 +585,7 @@ async function clearResponseCache() {
} }
try { try {
const response = await fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/response-cache/clear") }}', { const response = await fetch('{{ url_for(request, "/dashboard/response-cache/clear") }}', {
method: 'POST' method: 'POST'
}); });
const data = await response.json(); const data = await response.json();
......
...@@ -114,7 +114,7 @@ function closeModal() { ...@@ -114,7 +114,7 @@ function closeModal() {
function deleteAutoselect(autoselectName) { function deleteAutoselect(autoselectName) {
if (!confirm(`Are you sure you want to delete the autoselect "${autoselectName}"? This action cannot be undone.`)) return; if (!confirm(`Are you sure you want to delete the autoselect "${autoselectName}"? This action cannot be undone.`)) return;
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/user/autoselects") }}/' + encodeURIComponent(autoselectName), { fetch('{{ url_for(request, "/dashboard/user/autoselects") }}/' + encodeURIComponent(autoselectName), {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -161,7 +161,7 @@ document.getElementById('autoselect-form').addEventListener('submit', function(e ...@@ -161,7 +161,7 @@ document.getElementById('autoselect-form').addEventListener('submit', function(e
formData.append('autoselect_name', autoselectName); formData.append('autoselect_name', autoselectName);
formData.append('autoselect_config', JSON.stringify(configObj)); formData.append('autoselect_config', JSON.stringify(configObj));
const url = '{{ url_for(request, "{{ url_for(request, "/dashboard/user/autoselects") }}'; const url = '{{ url_for(request, "/dashboard/user/autoselects") }}';
const method = currentEditingIndex >= 0 ? 'PUT' : 'POST'; const method = currentEditingIndex >= 0 ? 'PUT' : 'POST';
fetch(url, { fetch(url, {
......
...@@ -156,7 +156,7 @@ function closeModal() { ...@@ -156,7 +156,7 @@ function closeModal() {
function deleteProvider(providerName) { function deleteProvider(providerName) {
if (!confirm(`Are you sure you want to delete the provider "${providerName}"? This action cannot be undone.`)) return; if (!confirm(`Are you sure you want to delete the provider "${providerName}"? This action cannot be undone.`)) return;
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/user/providers") }}/' + encodeURIComponent(providerName), { fetch('{{ url_for(request, "/dashboard/user/providers") }}/' + encodeURIComponent(providerName), {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -203,7 +203,7 @@ document.getElementById('provider-form').addEventListener('submit', function(e) ...@@ -203,7 +203,7 @@ document.getElementById('provider-form').addEventListener('submit', function(e)
formData.append('provider_name', providerName); formData.append('provider_name', providerName);
formData.append('provider_config', JSON.stringify(configObj)); formData.append('provider_config', JSON.stringify(configObj));
const url = '{{ url_for(request, "{{ url_for(request, "/dashboard/user/providers") }}'; const url = '{{ url_for(request, "/dashboard/user/providers") }}';
const method = currentEditingIndex >= 0 ? 'PUT' : 'POST'; const method = currentEditingIndex >= 0 ? 'PUT' : 'POST';
fetch(url, { fetch(url, {
......
...@@ -114,7 +114,7 @@ function closeModal() { ...@@ -114,7 +114,7 @@ function closeModal() {
function deleteRotation(rotationName) { function deleteRotation(rotationName) {
if (!confirm(`Are you sure you want to delete the rotation "${rotationName}"? This action cannot be undone.`)) return; if (!confirm(`Are you sure you want to delete the rotation "${rotationName}"? This action cannot be undone.`)) return;
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/user/rotations") }}/' + encodeURIComponent(rotationName), { fetch('{{ url_for(request, "/dashboard/user/rotations") }}/' + encodeURIComponent(rotationName), {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -161,7 +161,7 @@ document.getElementById('rotation-form').addEventListener('submit', function(e) ...@@ -161,7 +161,7 @@ document.getElementById('rotation-form').addEventListener('submit', function(e)
formData.append('rotation_name', rotationName); formData.append('rotation_name', rotationName);
formData.append('rotation_config', JSON.stringify(configObj)); formData.append('rotation_config', JSON.stringify(configObj));
const url = '{{ url_for(request, "{{ url_for(request, "/dashboard/user/rotations") }}'; const url = '{{ url_for(request, "/dashboard/user/rotations") }}';
const method = currentEditingIndex >= 0 ? 'PUT' : 'POST'; const method = currentEditingIndex >= 0 ? 'PUT' : 'POST';
fetch(url, { fetch(url, {
......
...@@ -181,7 +181,7 @@ function closeModal() { ...@@ -181,7 +181,7 @@ function closeModal() {
function deleteToken(tokenId) { function deleteToken(tokenId) {
if (!confirm('Are you sure you want to delete this API token? This action cannot be undone and will immediately revoke access.')) return; if (!confirm('Are you sure you want to delete this API token? This action cannot be undone and will immediately revoke access.')) return;
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/user/tokens") }}/' + tokenId, { fetch('{{ url_for(request, "/dashboard/user/tokens") }}/' + tokenId, {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -228,7 +228,7 @@ document.getElementById('create-token-form').addEventListener('submit', function ...@@ -228,7 +228,7 @@ document.getElementById('create-token-form').addEventListener('submit', function
formData.append('description', description); formData.append('description', description);
} }
fetch('{{ url_for(request, "{{ url_for(request, "/dashboard/user/tokens") }}', { fetch('{{ url_for(request, "/dashboard/user/tokens") }}', {
method: 'POST', method: 'POST',
body: formData body: formData
}).then(response => { }).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment