mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
set cookie header only for electron calls
This commit is contained in:
parent
90a331b989
commit
3670800a51
@ -5,12 +5,17 @@ function getHeaders() {
|
|||||||
// headers need to be lowercase because node.js automatically converts them to lower case
|
// headers need to be lowercase because node.js automatically converts them to lower case
|
||||||
// so hypothetical protectedSessionId becomes protectedsessionid on the backend
|
// so hypothetical protectedSessionId becomes protectedsessionid on the backend
|
||||||
// also avoiding using underscores instead of dashes since nginx filters them out by default
|
// also avoiding using underscores instead of dashes since nginx filters them out by default
|
||||||
return {
|
const headers = {
|
||||||
// passing it explicitely here because of the electron HTTP bypass
|
|
||||||
'cookie': document.cookie,
|
|
||||||
'trilium-source-id': glob.sourceId,
|
'trilium-source-id': glob.sourceId,
|
||||||
'x-csrf-token': glob.csrfToken
|
'x-csrf-token': glob.csrfToken
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (utils.isElectron()) {
|
||||||
|
// passing it explicitely here because of the electron HTTP bypass
|
||||||
|
headers.cookie = document.cookie;
|
||||||
|
}
|
||||||
|
|
||||||
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get(url) {
|
async function get(url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user