fix usage of async .getHeaders()

This commit is contained in:
zadam 2020-12-03 21:50:41 +01:00
parent 5f4f0d3086
commit bc520edd19
10 changed files with 69 additions and 77 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

115
package-lock.json generated
View file

@ -2163,9 +2163,9 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
}, },
"cross-env": { "cross-env": {
"version": "7.0.2", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true, "dev": true,
"requires": { "requires": {
"cross-spawn": "^7.0.1" "cross-spawn": "^7.0.1"
@ -2182,12 +2182,6 @@
"which": "^2.0.1" "which": "^2.0.1"
} }
}, },
"path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true
},
"shebang-command": { "shebang-command": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -3075,9 +3069,9 @@
} }
}, },
"electron-rebuild": { "electron-rebuild": {
"version": "2.3.2", "version": "2.3.4",
"resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-2.3.2.tgz", "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-2.3.4.tgz",
"integrity": "sha512-VLd3iIn65PmYWmvL+nx0oKspbohkDUhCAz8I2EWbMJcOFzWKW1UXJZ+ZG53iEDJFldm9PahE4q2Bx3ns4bdzeQ==", "integrity": "sha512-EHr1bkqXTN/jQJuh2/IunF9QGa9yOgpE9KdQ9A7VHshd7ycWvoXjWzaXaimfa1nu1l7vKqLLu7N2COe3Jn9NuA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@malept/cross-spawn-promise": "^1.1.0", "@malept/cross-spawn-promise": "^1.1.0",
@ -3087,7 +3081,7 @@
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"got": "^11.7.0", "got": "^11.7.0",
"lzma-native": "^6.0.1", "lzma-native": "^6.0.1",
"node-abi": "^2.19.1", "node-abi": "^2.19.2",
"node-gyp": "^7.1.0", "node-gyp": "^7.1.0",
"ora": "^5.1.0", "ora": "^5.1.0",
"tar": "^6.0.5", "tar": "^6.0.5",
@ -4501,14 +4495,6 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
}, },
"isobject": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
"integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
"requires": {
"isarray": "1.0.0"
}
},
"isstream": { "isstream": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
@ -4833,15 +4819,6 @@
"resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz",
"integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA=="
}, },
"line-column": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz",
"integrity": "sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI=",
"requires": {
"isarray": "^1.0.0",
"isobject": "^2.0.0"
}
},
"linkify-it": { "linkify-it": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz",
@ -4987,7 +4964,6 @@
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": { "requires": {
"yallist": "^4.0.0" "yallist": "^4.0.0"
}, },
@ -4995,8 +4971,7 @@
"yallist": { "yallist": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
"dev": true
} }
} }
}, },
@ -5257,9 +5232,9 @@
"dev": true "dev": true
}, },
"nanoid": { "nanoid": {
"version": "3.1.16", "version": "3.1.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.16.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
"integrity": "sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w==" "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw=="
}, },
"napi-build-utils": { "napi-build-utils": {
"version": "1.0.2", "version": "1.0.2",
@ -5278,9 +5253,9 @@
}, },
"dependencies": { "dependencies": {
"debug": { "debug": {
"version": "3.2.6", "version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ms": "^2.1.1" "ms": "^2.1.1"
@ -5939,14 +5914,14 @@
} }
}, },
"postcss": { "postcss": {
"version": "8.1.6", "version": "8.1.10",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.1.6.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.1.10.tgz",
"integrity": "sha512-JuifSl4h8dJ70SiMXKjzCxhalE6p2TnMHuq9G8ftyXj2jg6SXzqCsEuxMj9RkmJoO5D+Z9YrWunNkxqpRT02qg==", "integrity": "sha512-iBXEV5VTTYaRRdxiFYzTtuv2lGMQBExqkZKSzkJe+Fl6rvQrA/49UVGKqB+LG54hpW/TtDBMGds8j33GFNW7pg==",
"requires": { "requires": {
"colorette": "^1.2.1", "colorette": "^1.2.1",
"line-column": "^1.0.2", "nanoid": "^3.1.18",
"nanoid": "^3.1.16", "source-map": "^0.6.1",
"source-map": "^0.6.1" "vfile-location": "^3.2.0"
} }
}, },
"prebuild-install": { "prebuild-install": {
@ -6106,9 +6081,9 @@
} }
}, },
"rcedit": { "rcedit": {
"version": "2.2.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-2.2.0.tgz", "resolved": "https://registry.npmjs.org/rcedit/-/rcedit-2.3.0.tgz",
"integrity": "sha512-dhFtYmQS+V8qQIANyX6zDK+sO50ayDePKApi46ZPK8I6QeyyTDD6LManMa7a3p3c9mLM4zi9QBP41pfhQ9p7Sg==", "integrity": "sha512-h1gNEl9Oai1oijwyJ1WYqYSXTStHnOcv1KYljg/8WM4NAg3H1KBK3azIaKkQ1WQl+d7PoJpcBMscPfLXVKgCLQ==",
"dev": true "dev": true
}, },
"read-config-file": { "read-config-file": {
@ -6459,9 +6434,9 @@
} }
}, },
"sanitize-html": { "sanitize-html": {
"version": "2.1.2", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.1.2.tgz", "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.2.0.tgz",
"integrity": "sha512-i/h+fJal+609o6GlWFpQmAL7E5ZL4rrb0QwbDKQue2uift+4WKMe/HViRGawP4Q/UgswdDKxMqjDRrKPtCpBMg==", "integrity": "sha512-UXd7Rjb5qJHixoUtBLZflfEsJ2kzFsLaKBcWUBTr3G0gXRpZqkzqhIxY79Kl4oju7N4YHTM5TnBtw4scsxyj8A==",
"requires": { "requires": {
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
@ -6483,9 +6458,9 @@
} }
}, },
"domelementtype": { "domelementtype": {
"version": "2.0.2", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.2.tgz", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz",
"integrity": "sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA==" "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w=="
}, },
"domhandler": { "domhandler": {
"version": "3.3.0", "version": "3.3.0",
@ -6496,13 +6471,23 @@
} }
}, },
"domutils": { "domutils": {
"version": "2.4.2", "version": "2.4.3",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.2.tgz", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.3.tgz",
"integrity": "sha512-NKbgaM8ZJOecTZsIzW5gSuplsX2IWW2mIK7xVr8hTQF2v1CJWTmLZ1HOCh5sH+IzVPAGE5IucooOkvwBRAdowA==", "integrity": "sha512-MDMfEjgtzHvRX7i21XQfkk/vfZbLOe0VJk8dDETkTTo3BTeH3NXz3Xvs94UQ+GzTw/GjRYKsfVKIIOheYX63fw==",
"requires": { "requires": {
"dom-serializer": "^1.0.1", "dom-serializer": "^1.0.1",
"domelementtype": "^2.0.1", "domelementtype": "^2.0.1",
"domhandler": "^3.3.0" "domhandler": "^4.0.0"
},
"dependencies": {
"domhandler": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz",
"integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==",
"requires": {
"domelementtype": "^2.1.0"
}
}
} }
}, },
"entities": { "entities": {
@ -6573,9 +6558,12 @@
} }
}, },
"semver": { "semver": {
"version": "7.3.2", "version": "7.3.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==",
"requires": {
"lru-cache": "^6.0.0"
}
}, },
"semver-compare": { "semver-compare": {
"version": "1.0.0", "version": "1.0.0",
@ -7586,6 +7574,11 @@
"extsprintf": "^1.2.0" "extsprintf": "^1.2.0"
} }
}, },
"vfile-location": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.2.0.tgz",
"integrity": "sha512-aLEIZKv/oxuCDZ8lkJGhuhztf/BW4M+iHdCwglA/eWc+vtuRFJj8EtgceYFX4LRjOhCAAiNHsKGssC6onJ+jbA=="
},
"w3c-hr-time": { "w3c-hr-time": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",

View file

@ -60,9 +60,9 @@
"request": "^2.88.2", "request": "^2.88.2",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"sanitize-html": "2.1.2", "sanitize-html": "2.2.0",
"sax": "1.2.4", "sax": "1.2.4",
"semver": "7.3.2", "semver": "7.3.4",
"serve-favicon": "2.5.0", "serve-favicon": "2.5.0",
"session-file-store": "1.5.0", "session-file-store": "1.5.0",
"stream-throttle": "^0.1.3", "stream-throttle": "^0.1.3",
@ -76,16 +76,16 @@
"yazl": "2.5.1" "yazl": "2.5.1"
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.2", "cross-env": "7.0.3",
"electron": "9.3.5", "electron": "9.3.5",
"electron-builder": "22.9.1", "electron-builder": "22.9.1",
"electron-packager": "15.1.0", "electron-packager": "15.1.0",
"electron-rebuild": "2.3.2", "electron-rebuild": "2.3.4",
"esm": "3.2.25", "esm": "3.2.25",
"jasmine": "3.6.3", "jasmine": "3.6.3",
"jsdoc": "3.6.6", "jsdoc": "3.6.6",
"lorem-ipsum": "2.0.3", "lorem-ipsum": "2.0.3",
"rcedit": "2.2.0", "rcedit": "2.3.0",
"webpack": "5.9.0", "webpack": "5.9.0",
"webpack-cli": "4.2.0" "webpack-cli": "4.2.0"
}, },

View file

@ -13,6 +13,7 @@ const $textImportedAsTextCheckbox = $("#text-imported-as-text-checkbox");
const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox"); const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox");
const $explodeArchivesCheckbox = $("#explode-archives-checkbox"); const $explodeArchivesCheckbox = $("#explode-archives-checkbox");
const $replaceUnderscoresWithSpacesCheckbox = $("#replace-underscores-with-spaces-checkbox"); const $replaceUnderscoresWithSpacesCheckbox = $("#replace-underscores-with-spaces-checkbox");
const $csrf = $("#import-csrf");
let parentNoteId = null; let parentNoteId = null;

View file

@ -27,7 +27,7 @@ export async function uploadFiles(parentNoteId, files, options) {
({noteId} = await $.ajax({ ({noteId} = await $.ajax({
url: baseApiUrl + 'notes/' + parentNoteId + '/import', url: baseApiUrl + 'notes/' + parentNoteId + '/import',
headers: server.getHeaders(), headers: await server.getHeaders(),
data: formData, data: formData,
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',

View file

@ -245,10 +245,7 @@ class NoteListRenderer {
} }
// TODO: we should also render (promoted) attributes // TODO: we should also render (promoted) attributes
// FIXME: showing specific path might be necessary because of a match in the patch
async renderNote(note, expand = false) { async renderNote(note, expand = false) {
const notePath = /*this.notePath + '/' + */ note.noteId;
const $expander = $('<span class="note-expander bx bx-chevron-right"></span>'); const $expander = $('<span class="note-expander bx bx-chevron-right"></span>');
const $card = $('<div class="note-book-card">') const $card = $('<div class="note-book-card">')
@ -256,7 +253,7 @@ class NoteListRenderer {
.append( .append(
$('<h5 class="note-book-title">') $('<h5 class="note-book-title">')
.append($expander) .append($expander)
.append(await linkService.createNoteLink(notePath, {showTooltip: false})) .append(await linkService.createNoteLink(note.noteId, {showTooltip: false}))
); );
$expander.on('click', () => this.toggleContent($card, note, !$card.hasClass("expanded"))); $expander.on('click', () => this.toggleContent($card, note, !$card.hasClass("expanded")));

View file

@ -136,6 +136,7 @@ const TPL = `
border-radius: 3px; border-radius: 3px;
border: 1px solid var(--main-background-color); border: 1px solid var(--main-background-color);
margin-left: 5px; margin-left: 5px;
margin-top: 2px;
} }
.tree-item-button:hover { .tree-item-button:hover {
@ -147,7 +148,7 @@ const TPL = `
} }
span.fancytree-node:hover .add-note-button { span.fancytree-node:hover .add-note-button {
display: inline; display: inline-block;
} }
</style> </style>

View file

@ -91,7 +91,7 @@ export default class FileTypeWidget extends TypeWidget {
const result = await $.ajax({ const result = await $.ajax({
url: baseApiUrl + 'notes/' + this.noteId + '/file', url: baseApiUrl + 'notes/' + this.noteId + '/file',
headers: server.getHeaders(), headers: await server.getHeaders(),
data: formData, data: formData,
type: 'PUT', type: 'PUT',
timeout: 60 * 60 * 1000, timeout: 60 * 60 * 1000,

View file

@ -102,7 +102,7 @@ class ImageTypeWidget extends TypeWidget {
const result = await $.ajax({ const result = await $.ajax({
url: baseApiUrl + 'images/' + this.noteId, url: baseApiUrl + 'images/' + this.noteId,
headers: server.getHeaders(), headers: await server.getHeaders(),
data: formData, data: formData,
type: 'PUT', type: 'PUT',
timeout: 60 * 60 * 1000, timeout: 60 * 60 * 1000,