user authentication
This commit is contained in:
@@ -115,7 +115,12 @@ function initEnhancedUpload() {
|
||||
showNotification('Upload failed: Network error', 'error');
|
||||
});
|
||||
|
||||
xhr.open('POST', '/upload');
|
||||
const m = document.cookie.match(/(?:^|; )csrf_token=([^;]+)/);
|
||||
const csrf = m && m[1] ? decodeURIComponent(m[1]) : '';
|
||||
xhr.open('POST', '/editor/upload');
|
||||
if (csrf) {
|
||||
try { xhr.setRequestHeader('X-CSRF-Token', csrf); } catch (_) {}
|
||||
}
|
||||
xhr.send(formData);
|
||||
}
|
||||
|
||||
@@ -205,13 +210,13 @@ function initKeyboardShortcuts() {
|
||||
case 'n':
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
e.preventDefault();
|
||||
window.location.href = '/create';
|
||||
window.location.href = '/editor/create';
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
e.preventDefault();
|
||||
window.location.href = '/settings';
|
||||
window.location.href = '/editor/settings';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user