Merge remote-tracking branch 'origin/master' into next

# Conflicts:
#	package-lock.json
#	src/public/app/services/note_content_renderer.js
#	src/public/stylesheets/style.css
#	src/routes/api/files.js
#	src/routes/routes.js
This commit is contained in:
zadam
2021-04-25 11:14:45 +02:00
55 changed files with 378 additions and 165 deletions

View File

@@ -39,12 +39,12 @@ async function getRenderedContent(note, options = {}) {
.css("max-width", "100%")
);
}
else if (!options.tooltip && ['file', 'pdf', 'audio', 'video']) {
else if (!options.tooltip && ['file', 'pdf', 'audio', 'video'].includes(type)) {
const $downloadButton = $('<button class="file-download btn btn-primary" type="button">Download</button>');
const $openButton = $('<button class="file-open btn btn-primary" type="button">Open</button>');
$downloadButton.on('click', () => openService.downloadFileNote(note.noteId));
$openButton.on('click', () => openService.openFileNote(note.noteId));
$openButton.on('click', () => openService.openNoteExternally(note.noteId));
// open doesn't work for protected notes since it works through browser which isn't in protected session
$openButton.toggle(!note.isProtected);
@@ -59,7 +59,7 @@ async function getRenderedContent(note, options = {}) {
}
else if (type === 'audio') {
const $audioPreview = $('<audio controls></audio>')
.attr("src", openService.getUrlForDownload("api/notes/" + note.noteId + "/open"))
.attr("src", openService.getUrlForStreaming("api/notes/" + note.noteId + "/open-partial"))
.attr("type", note.mime)
.css("width", "100%");
@@ -67,7 +67,7 @@ async function getRenderedContent(note, options = {}) {
}
else if (type === 'video') {
const $videoPreview = $('<video controls></video>')
.attr("src", openService.getUrlForDownload("api/notes/" + note.noteId + "/open"))
.attr("src", openService.getUrlForDownload("api/notes/" + note.noteId + "/open-partial"))
.attr("type", note.mime)
.css("width", "100%");