Compare commits
3 commits
d0d1feca18
...
0da9097a6a
| Author | SHA1 | Date | |
|---|---|---|---|
| 0da9097a6a | |||
| 017d9be45a | |||
| 9eb9fbe3a5 |
7 changed files with 32 additions and 14 deletions
|
|
@ -553,7 +553,7 @@ class File(models.Model):
|
|||
|
||||
def process_stream(self):
|
||||
'''
|
||||
extract derivatives from webm upload
|
||||
extract derivatives from stream upload
|
||||
'''
|
||||
from . import tasks
|
||||
return tasks.process_stream.delay(self.id)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
"canExportAnnotations": {"friend": true, "staff": true, "admin": true},
|
||||
"canImportAnnotations": {"staff": true, "admin": true},
|
||||
"canImportItems": {},
|
||||
"canTranscribeAudio": {},
|
||||
"canManageDocuments": {"staff": true, "admin": true},
|
||||
"canManageEntities": {"staff": true, "admin": true},
|
||||
"canManageHome": {},
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
"canImportAnnotations": {"researcher": true, "staff": true, "admin": true},
|
||||
// import needs to handle itemRequiresVideo=false first
|
||||
"canImportItems": {},
|
||||
"canTranscribeAudio": {},
|
||||
"canManageDocuments": {"member": true, "researcher": true, "staff": true, "admin": true},
|
||||
"canManageEntities": {"member": true, "researcher": true, "staff": true, "admin": true},
|
||||
"canManageHome": {"staff": true, "admin": true},
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from glob import glob
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
from glob import glob
|
||||
import unicodedata
|
||||
|
||||
import ox
|
||||
|
|
@ -379,11 +380,13 @@ actions.register(sortDocuments, cache=False)
|
|||
def file(request, id, name=None):
|
||||
document = get_document_or_404_json(request, id)
|
||||
accept = request.headers.get("Accept")
|
||||
mime_type = mimetypes.guess_type(document.file.path)[0]
|
||||
mime_type = 'image/%s' % document.extension
|
||||
if accept and 'image/' in accept and document.extension in (
|
||||
'webp', 'heif', 'heic', 'avif'
|
||||
) and document.extension not in accept:
|
||||
'webp', 'heif', 'heic', 'avif', 'tiff'
|
||||
) and mime_type not in accept:
|
||||
image_size = max(document.width, document.height)
|
||||
return HttpFileResponse(document.thumbnail(image_size))
|
||||
return HttpFileResponse(document.thumbnail(image_size, accept=accept))
|
||||
return HttpFileResponse(document.file.path)
|
||||
|
||||
def thumbnail(request, id, size=256, page=None):
|
||||
|
|
|
|||
|
|
@ -1004,7 +1004,9 @@ def download_source(request, id, part=None):
|
|||
response['Content-Disposition'] = "attachment; filename*=UTF-8''%s" % quote(filename.encode('utf-8'))
|
||||
return response
|
||||
|
||||
def download(request, id, resolution=None, format='webm', part=None):
|
||||
def download(request, id, resolution=None, format=None, part=None):
|
||||
if format is None:
|
||||
format = settings.CONFIG['video']['formats'][0]
|
||||
item = get_object_or_404(models.Item, public_id=id)
|
||||
if not resolution or int(resolution) not in settings.CONFIG['video']['resolutions']:
|
||||
resolution = max(settings.CONFIG['video']['resolutions'])
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ pandora.ui.uploadDocumentDialog = function(options, callback) {
|
|||
existingFiles = [],
|
||||
uploadFiles = [],
|
||||
|
||||
supportedExtensions = ['gif', 'jpg', 'jpeg', 'pdf', 'png', 'webp', 'heic', 'heif', 'avif'],
|
||||
|
||||
filename,
|
||||
|
||||
ids = [],
|
||||
|
|
@ -72,7 +70,7 @@ pandora.ui.uploadDocumentDialog = function(options, callback) {
|
|||
});
|
||||
|
||||
if (!Ox.every(extensions, function(extension) {
|
||||
return Ox.contains(supportedExtensions, extension)
|
||||
return Ox.contains(pandora.documentExtensions, extension)
|
||||
})) {
|
||||
return errorDialog(
|
||||
Ox._('Supported file types are GIF, JPG, PNG and PDF.')
|
||||
|
|
|
|||
|
|
@ -420,13 +420,28 @@ pandora.createLinks = function($element) {
|
|||
});
|
||||
};
|
||||
|
||||
pandora.imageExtensions = [
|
||||
'avif',
|
||||
'gif',
|
||||
'heic',
|
||||
'heif',
|
||||
'jpeg',
|
||||
'jpg',
|
||||
'png',
|
||||
'tiff',
|
||||
'webp'
|
||||
];
|
||||
|
||||
pandora.documentExtensions = [
|
||||
'pdf', /* 'epub', 'txt', */
|
||||
].concat(pandora.imageExtensions);
|
||||
|
||||
pandora.uploadDroppedFiles = function(files) {
|
||||
var documentExtensions = ['pdf', /* 'epub', 'txt', */ 'png', 'gif', 'jpg', 'jpeg', 'webp', 'heic', 'heif', 'avif'];
|
||||
files = Ox.map(files, function(file) { return file });
|
||||
|
||||
if (files.every(function(file) {
|
||||
var extension = file.name.split('.').pop().toLowerCase()
|
||||
return Ox.contains(documentExtensions, extension)
|
||||
return Ox.contains(pandora.documentExtensions, extension)
|
||||
})) {
|
||||
pandora.ui.uploadDocumentDialog({
|
||||
files: files
|
||||
|
|
@ -2132,9 +2147,7 @@ pandora.getSpan = function(state, val, callback) {
|
|||
} else {
|
||||
state.span = val;
|
||||
}
|
||||
} else if (Ox.contains([
|
||||
'gif', 'gif', 'jpg', 'png', 'webp', 'heic', 'heif', 'avif'
|
||||
], extension)) {
|
||||
} else if (Ox.contains(pandora.imageExtensions, extension)) {
|
||||
values = val.split(',');
|
||||
if (values.length == 4) {
|
||||
state.span = values.map(function(number, index) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue