fix all csfr token issues
This commit is contained in:
@@ -22,7 +22,7 @@ document.getElementById('syncFilesBtn').addEventListener('click', async function
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ document.getElementById('verifyDbBtn').addEventListener('click', async function(
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
}
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ document.getElementById('cleanupOrphanedBtn').addEventListener('click', async fu
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Format the details for display
|
||||
const formattedDetails = {
|
||||
'Event ID': data.id,
|
||||
'Event Type': data.event_type,
|
||||
'Timestamp': new Date(data.timestamp).toLocaleString(),
|
||||
'User': data.user ? `${data.user.username} (${data.user.last_name})` : 'N/A',
|
||||
'IP Address': data.ip_address || 'N/A',
|
||||
'User Agent': data.user_agent || 'N/A'
|
||||
// 'Event ID': data.id,
|
||||
// 'Event Type': data.event_type,
|
||||
// 'Timestamp': new Date(data.timestamp).toLocaleString(),
|
||||
// 'User': data.user ? `${data.user.username} (${data.user.last_name})` : 'N/A',
|
||||
// 'IP Address': data.ip_address || 'N/A',
|
||||
// 'User Agent': data.user_agent || 'N/A'
|
||||
};
|
||||
|
||||
// Handle details separately
|
||||
|
||||
@@ -80,7 +80,7 @@ function toggleView(view) {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({ preferred_view: view })
|
||||
})
|
||||
@@ -344,7 +344,7 @@ function toggleStar(filename, path = '', roomId) {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
filename: filename,
|
||||
@@ -384,7 +384,7 @@ function restoreFile(filename, path = '', roomId) {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
filename: filename,
|
||||
@@ -438,7 +438,7 @@ function permanentDeleteFile() {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
filename: filename,
|
||||
@@ -530,7 +530,7 @@ function emptyTrash() {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -89,7 +89,7 @@ export class FileManager {
|
||||
const response = await fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
}
|
||||
});
|
||||
|
||||
@@ -276,7 +276,7 @@ export class FileManager {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
filename: file.name,
|
||||
@@ -339,7 +339,7 @@ export class FileManager {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
filename: filename,
|
||||
@@ -513,7 +513,7 @@ export class FileManager {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRFToken': csrfToken }
|
||||
headers: { 'X-CSRF-Token': csrfToken }
|
||||
});
|
||||
const result = await response.json();
|
||||
if (!result.success) {
|
||||
@@ -536,7 +536,7 @@ export class FileManager {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRFToken': csrfToken }
|
||||
headers: { 'X-CSRF-Token': csrfToken }
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
|
||||
@@ -319,7 +319,7 @@ export class ModalManager {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: folderName,
|
||||
|
||||
@@ -240,7 +240,7 @@ export class UploadManager {
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
const response = await fetch(`/api/rooms/${this.roomManager.roomId}/files/upload`, {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRFToken': csrfToken },
|
||||
headers: { 'X-CSRF-Token': csrfToken },
|
||||
body: formData
|
||||
});
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ function toggleView(view) {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
},
|
||||
body: JSON.stringify({ preferred_view: view })
|
||||
})
|
||||
|
||||
@@ -70,7 +70,7 @@ window.emptyTrash = function() {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRF-Token': csrfToken
|
||||
}
|
||||
})
|
||||
);
|
||||
@@ -189,7 +189,7 @@ function toggleView(view) {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||
},
|
||||
body: JSON.stringify({ preferred_view: view })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user