WARP-LAB / files_3dmodelviewer

3D Model Viewer for Nextcloud
GNU Affero General Public License v3.0
31 stars 6 forks source link

For the downloaded FBX format 3D model package, it cannot be previewed directly in Nextcloud after decompression. #13

Open MiloGeimer opened 1 year ago

MiloGeimer commented 1 year ago

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

I have checked that the files are not corrupted

Yes, file is working when I open it in...

Screenshots

Browser log

How to access your browser console (Click to expand) ### Chrome 1. Press either CTRL + SHIFT + I / CMD + ALT + I or F12 to open the Developer Tools. 2. Click the “console” tab. ### Safari 1. Press CMD + ALT + I to open the Web Inspector. 2. See Chrome’s step 2. (Chrome and Safari have pretty much identical dev tools.) ### IE 1. Press F12 to open the developer tools. 2. Click the “console” tab. ### Firefox 1. Press CTRL + SHIFT + K to open the Web console (COMMAND + SHIFT + K on Macs). 2. or, if Firebug is installed (recommended): 1. Press F12 to open Firebug. 2. Click on the “console” tab. ### Opera 1. Press CTRL + SHIFT + I to open Dragonfly. 2. Click on the “console” tab.

Installation and configuration

How the app was installed?

App server configuration Parameters

Versions

3D Model Viewer

Nextcloud

Desktop

Handheld

Additional context

MiloGeimer commented 1 year ago

"Failed to import model.(TypeError: Failed to fetch)"

kroko commented 1 year ago

pleas use one of three templates for issues. i just filled in bug template in your initial comment, please edit it to fill it out.

ghost commented 1 year ago

Same problem is happening to me,im at Nextcloud 26.0.0 I installed the app via App Store

Just wont load any FBX

kroko commented 1 year ago

well, the bugreport quality... I have no idea about any of the required info that OP @MiloGeimer failed to fill, except

anyways, I just checked some models. i can replicate issues with FBX, that has embedded textures. for example this fbx works (no textures). does the FBX in the link work for @MiloGeimer and @Altair1231?

it seems that it is upstream issu that I will attend at some point.

DevinWinata commented 1 year ago

Hi, I have the same issue and using the mentioned FBX file still can't be previewed. From browser console logs, it seems CSP is blocking blob: when previewing the FBX file.

Refused to connect to 'blob:https://example.com/acda3f2d-c3ab-4855-b334-95ebc0af36fa' because it violates the following Content Security Policy directive: "connect-src 'self'".

image Instance info: Nextcloud 27 docker (nextcloud with apache built-in docker image nextcloud:latest with Caddy as reverse proxy) Via app store

kroko commented 1 year ago

@MiloGeimer, @Altair1231 can you please try 0.0.11. if it fails, please provide link to exact FBX file that it fails for. @DevinWinata Refused to connect to 'blob:https://example.com/acda3f2d-c3ab-4855-b334-95ebc0af36fa' because it violates the following Content Security Policy directive: "connect-src 'self'". is unrelated, IMHO the issue lies somewhere else in your case.

ivan4os commented 8 months ago

failed to import model typeerror: failed to fetch (3D Model Viewer app) files_3dmodelviewer.js?v=13e99c0e-57:1 Refused to connect to 'blob:https://????????/cffe6d08-6aab-48ea-a13c-6bac1da49555' because it violates the following Content Security Policy directive: "connect-src 'self'". Help me!!!

DerLeole commented 3 months ago

I have encountered the same issue and it seems like the csp is actually to blame, since other models load just fine. when they aren't loaded via blob.

smarinier commented 1 month ago

@DerLeole @DevinWinata @MiloGeimer @ivan4os Could you use the "Developer Tools" from your browser (Google Chrome ?), load the NexCloud page, go in "network" tab, and give the whole content of "Content-Security-policy" ?

DevTools_-_home_smarinier_net_nc28-dev_index_php_apps_files_files_1437_dir___openfile_true

DevinWinata commented 1 month ago

@smarinier here's CSP from my nextcloud instance

default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-RkU3OVZiR0t5aWpYZ0tJa3E5bm9pRE5PZmM2Y2RVZWRMalJWTTFZSTNkWT06ZlNQSU9Ndk1uMStGNmZaOW5PNkV6SDhoUEpuTU9pLzRWRkFpZVNaaTlvND0=' 'self' drive.example.com 'unsafe-eval';script-src-elem 'strict-dynamic' 'nonce-RkU3OVZiR0t5aWpYZ0tJa3E5bm9pRE5PZmM2Y2RVZWRMalJWTTFZSTNkWT06ZlNQSU9Ndk1uMStGNmZaOW5PNkV6SDhoUEpuTU9pLzRWRkFpZVNaaTlvND0=' 'self' drive.example.com 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: * https://*.tile.openstreetmap.org https://office.example.com;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src 'self' nc: https://office.example.com;frame-ancestors 'self' https://office.example.com;worker-src 'self';form-action 'self' https://office.example.com
smarinier commented 1 month ago

@DevinWinata could you try to (temporarily) install and active the "Talk" application in NextCloud. And tell me if it's ok now for the FBX preview ?

DevinWinata commented 1 month ago

@smarinier hi, it's now able to preview FBX files.

smarinier commented 1 month ago

Ok. I see what the fix could be.

smarinier commented 1 month ago

Hi @kroko,

Could you have a look on the very simple PR #26 ?

Thanks

kroko commented 1 month ago

@smarinier merged and pushed as a new release v0.0.14 in NC appstore, thanks! wait till it lands and test it out. while first getting this plugin up and running CSP was headache, especially because for some file type loaders it has to lazyload extra js and wasm however based on what plugins user has installed (i specially installed A LOT in the dev instance) the whole CSP policy goes haywire.