[skip ci] wip: preserve Hermes crank development checkpoint
Owner-authorized recovery of accumulated source changes.
Includes accepted work and in-progress changes; NOT a release or acceptance.
Parent baseline 1b6db09bd1. Runtime data, build caches and local credentials excluded.
This commit is contained in:
1 parent
1b6db09bd1
commit
75fe5a123c
357 files changed
+118831
-5113
No files matched your search
+12
-3
@@ -14,11 +14,15 @@
|
||||
return /\/api\/auth\/(?:login|bootstrap\/complete|session\/csrf)$/.test(path);
|
||||
}
|
||||
|
||||
function attachCsrf(path, method, requestOptions) {
|
||||
function mutationNeedsCsrf(path, method) {
|
||||
if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || csrfExempt(path)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (!(path.indexOf('/api/auth/') === 0 || path.indexOf('/api/admin/') === 0)) {
|
||||
return path.indexOf('/api/auth/') === 0 || path.indexOf('/api/admin/') === 0;
|
||||
}
|
||||
|
||||
function attachCsrf(path, method, requestOptions) {
|
||||
if (!mutationNeedsCsrf(path, method)) {
|
||||
return;
|
||||
}
|
||||
var token = window.CrankAuth && typeof window.CrankAuth.getCsrfToken === 'function'
|
||||
@@ -92,6 +96,11 @@
|
||||
headers: headers(),
|
||||
}, options || {});
|
||||
var method = (requestOptions.method || 'GET').toUpperCase();
|
||||
if (mutationNeedsCsrf(path, method)
|
||||
&& window.CrankAuth
|
||||
&& typeof window.CrankAuth.ensureCsrf === 'function') {
|
||||
await window.CrankAuth.ensureCsrf();
|
||||
}
|
||||
attachCsrf(path, method, requestOptions);
|
||||
var mutationResource = operationMutationResource(path, method);
|
||||
var agentMutation = agentMutationResource(path, method);
|
||||
|
||||
Reference in new issue
Block a user