So I have the all in one version of nextcloud and I am trying to use preview generator to generate previews mainly for pdf files.
I installed image-magick and ghostscript and disabled some of image-magick’s security policies.
I ran the generate-all method and have the pre-generate one in a every 10 minute cronjob.
The problem is the only way those previews work is in a mobile browser (or desktop with mobile dev tools mode), it doesn’t work in the app or full sized desktop.
The reason seems to be that in the mobile version it requests a 750x750 image but 250x250 for desktop.
Example queries :
Also only for desktop the service worker doesn’t start.
ServiceWorker.js:31 Refused to create a worker from 'https://xx.xx.com/index.php/apps/files/preview-service-worker.js' because it violates the following Content Security Policy directive: "script-src 'nonce-NWc4UnZmLzFyWC9iYnc4YVhmSVRWN1Y4SnQ0ZDc1MkRxdkdXcGtaK1VHQT06c25sMGliV2E5UXFqV21Bdk00dGhKSTB4RkpaSTE4bXc2NGJleVhBMUkxWT0='". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.
But I’ve heard that it’s only a speed optimization thing so I don’t know.
There is 2 types of requests :
- The ones initiated by merged-index.js
- The ones from the service worker
merged-index request status :
400 (from service worker)
So I think merged-index is calling the service worker but it hasn’t started so it fails.
Relevant part of config.php :
<?php $CONFIG = array ( 'preview_max_x' => '2048', 'preview_max_y' => '2048', 'jpeg_quality' => '60', 'enabledPreviewProviders' => array ( 1 => 'OC\\Preview\\Image', 2 => 'OC\\Preview\\MarkDown', 3 => 'OC\\Preview\\MP3', 4 => 'OC\\Preview\\TXT', 5 => 'OC\\Preview\\OpenDocument', 6 => 'OC\\Preview\\Movie', 7 => 'OC\\Preview\\Krita', 8 => 'OC\\Preview\\PDF', 9 => 'OC\\Preview\\SVG', 10 => 'OC\\Preview\\JPEG', 11 => 'OC\\Preview\\GIF', 12 => 'OC\\Preview\\MSOfficeDoc', 13 => 'OC\\Preview\\MSOffice2003', 14 => 'OC\\Preview\\MSOffice2007', 15 => 'OC\\Preview\\TIFF', 16 => 'OC\\Preview\\Movie', 17 => 'OC\\Preview\\HEIC', 18 => 'OC\\Preview\\PNG', 19 => 'OC\\Preview\\XBitmap', 0 => 'OC\\Preview\\Imaginary', ), 'enable_previews' => true, 'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000', );
Does anyone have a clue on this ? Thanks.