cwilby / nextcloud-workflow-media-converter

An automated media conversion plugin for NextCloud
https://apps.nextcloud.com/apps/workflow_media_converter
GNU Affero General Public License v3.0
35 stars 15 forks source link

Choose Folder option in flow does not work. #409

Closed sveken closed 4 months ago

sveken commented 8 months ago

Steps to reproduce

  1. Create flow for media conversion
  2. Choose any of the move options like after output is ready "Move output to specific folder"
  3. The "choose folder" option does not do anything/open any picker

Expected behaviour

The choose folder picker should pop up or some form of text field to enter path

Actual behaviour

Nothing happens.

Workflow Media Converter app

Workflow Media Converter app version: (see apps admin page: /index.php/settings/apps) 1.9.0

Server configuration

Operating system: Ubuntu/RedHat/... Truenas Scale/ Debian

Web server: Apache/Nginx Nginx Database: MySQL/Maria/SQLite/PostgreSQL PostgresSQL

PHP version: 8.2.14

Nextcloud Version: (see admin page) 28.0.1

Where did you install Nextcloud from: Truecharts Catalogue

Signing status:

Login as admin user into your Nextcloud and access
http://example.com/index.php/settings/integrity/failed
paste the results here.

No errors have been found.

List of activated apps: Activity Announcment Center Automated Media Conversion Brute-force Settings Calender Camera RAW Previews Circles CLient Push Collaborative Tags Comments Configurable share links Contacts Contacts interaction Dashboard Deck Deleted files End-end encryption excalidraw integration External Storage Federation FIle remidners File sharing FIle automated Tagging First run wiz Forms Guests Log Reader Memories Monitoring Nextcloud Announcments Nextcloud Office Notes Notications PAssword Policy Passwords Passwords andbook PDF Viewer PhoneTrack Photos Polls Preview Generator Privacy Recongize Reccomendations Registration Related Resources Share by Mail Support talk Tasks text 2FA TOPP Provider 2FA Webauthn Usage Survey Update Notication User Status Versions Weather Status

WantSleep0419 commented 8 months ago

I encountered this problem in Google Chrome, and it was solved when I switched back to Edge browser. I suspected that the ad plug-in was blocking it. You can try switching to a different browser or checking the browser plug-in.

sveken commented 8 months ago

I have just tried in firefox, Chrome, and edge, also in incognito. Also tried Chrome on my phone via cell connection. Behavior stays the same.

Misls commented 8 months ago

Same behavior here with the following setup:

Ubuntu Server 22.04 LTS Nextcloud version 27.1.5 PHP version 8.1.27 MySQL version 10.6.12 Apache 2.4

Also tried different browsers (chrome, firefox) with different browser protection setups without effect on the "Choose Folder" Button

printplaatreparatie commented 7 months ago

I think it might have something to do with the fact that my/our Nextcloud installation is in a in a directory, and not directly in the index domainname (eg. example.com/nextcloud). Here are my browser logs:

You need to fill either the text or the ariaLabel props in the button component.
Object { text: undefined, ariaLabel: null }

Object { _uid: 6, _isVue: true, __v_skip: true, _scope: {…}, "$options": {…}, _renderProxy: {…}, _self: {…}, "$parent": {…}, "$root": {…}, "$children": [], … }
workflow_media_converter-personalSettings.js:2:701499
Loading failed for the <script> with source “https://[REDACTED]/apps/workflow_media_converter/js/workflow_media_converter-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-7228d0.js?v=5959475e462b19fc49c0”. workflow_media_converter:1:1
Loading failed for the <script> with source “https://[REDACTED]/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_legacy_mjs.js?v=a5e97bb3a2cce054c0bb”. workflow_media_converter:1:1
Content-Security-Policy: The page’s settings blocked the loading of a resource at https://[REDACTED]/apps/workflow_media_converter/js/workflow_media_converter-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-7228d0.js?v=5959475e462b19fc49c0 (“script-src”). workflow_media_converter-personalSettings.js:2:663869
ChunkLoadError: Loading chunk vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-7228d0 failed.
(error: https://[REDACTED]/apps/workflow_media_converter/js/workflow_media_converter-vendors-node_modules_path-browserify_index_js-node_modules_nextcloud_dialogs_dist_chunks_Dial-7228d0.js?v=5959475e462b19fc49c0)
    j https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    e https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    e https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    pick https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    t https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    c https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    F https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    N https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    Ws https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    i https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    openFilePicker https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    openFilePicker https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    openFilePicker https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    click https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    Cs https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    s https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
    _wrapper https://[REDACTED]/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-personalSettings.js?v=72f01f5b-40:2
workflow_media_converter-personalSettings.js:2:231421
Content-Security-Policy: The page’s settings blocked the loading of a resource at https://[REDACTED]/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_legacy_mjs.js?v=a5e97bb3a2cce054c0bb (“script-src”). workflow_media_converter-personalSettings.js:2:663869
GET
https://[REDACTED]/nextcloud/apps/theming/image/logo?v=40
[HTTP/2 404  920ms]

GET
https://[REDACTED]/nextcloud/apps/theming/image/logo?v=40
[HTTP/2 404  630ms]
printplaatreparatie commented 7 months ago

Note that the failed command is trying to fetch a resource from domainname.example/apps instead of domainname.example/nextcloud/apps

sveken commented 7 months ago

My nextcloud is installed at the root of the domain, and I still have this issue.

I'll get those logs as soon as I can tomorrow.

printplaatreparatie commented 7 months ago

Are there helpful logs that you can share?

sveken commented 7 months ago

mediaconvert-1706132819743.log Here we go. Seems to be 404ing on the button.

printplaatreparatie commented 7 months ago

The button stopped working in my setup somewhere after Dec. 12th, 2023. It still worked when I did some tests for this reply.

It could have something to do with commit 048f0ce that enables the use of command line flags. This line maybe?

https://github.com/cwilby/nextcloud-workflow-media-converter/blob/165d24b4c499e0e7567f6f6a16de7b3352cc593e/src/mixins/filepicker.js#L2

n0paleon commented 6 months ago

I think the problem is with writing /apps/ in the url path, shouldn't it be /custom_apps/? I tried accessing it manually, the requested js file can be accessed normally

printplaatreparatie commented 6 months ago

Not for me. It has definitely something to do with referring to the root folder. I can reach https://domainname.example/nextcloud/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-xxxxx_mjs.js but the button directs to https://domainname.example/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-xxxxx_mjs.js'.

mmuman commented 5 months ago

I installed this to test converting stuff for some DLNA setup but I found this bug… Oddly Chromium gives more info than Firefox which only mentions CSP as a reason for the block:

workflow_media_converter-personalSettings.js?v=f505562d-0:2 Refused to load the script 'https://[domain]/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-csK3cpe5_mjs.js?v=bc706ee6becf1a314d5a' because it violates the following Content Security Policy directive: "script-src 'nonce-L3d5QVRYNnNRU1FDb0tuTSsyOXJkenBBTVNaSnBvMDA5R29TdnNIYzFVND06emp2ckNqTFBObFpMbVoraXlUNG5JVk16WmtnUjN1cHhoUVZma2FMcCtqcz0='". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

r.l @ workflow_media_converter-personalSettings.js?v=f505562d-0:2

workflow_media_converter-personalSettings.js?v=f505562d-0:2 ChunkLoadError: Loading chunk node_modules_nextcloud_dialogs_dist_chunks_index-csK3cpe5_mjs failed.
(error: https://[domain]/apps/workflow_media_converter/js/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-csK3cpe5_mjs.js?v=bc706ee6becf1a314d5a)
    at r.f.j (workflow_media_converter-personalSettings.js?v=f505562d-0:2:888379)
    at workflow_media_converter-personalSettings.js?v=f505562d-0:2:886607
    at Array.reduce (<anonymous>)
    at r.e (workflow_media_converter-personalSettings.js?v=f505562d-0:2:886585)
    at u.pick (workflow_media_converter-personalSettings.js?v=f505562d-0:2:889765)
    at workflow_media_converter-personalSettings.js?v=f505562d-0:2:905160
    at v (workflow_media_converter-personalSettings.js?v=f505562d-0:2:898868)
    at Generator.<anonymous> (workflow_media_converter-personalSettings.js?v=f505562d-0:2:900214)
    at Generator.next (workflow_media_converter-personalSettings.js?v=f505562d-0:2:899297)
    at V (workflow_media_converter-personalSettings.js?v=f505562d-0:2:904783)

Does the script need to be declared in some way to the core to get that nonce forwarded or something?

mmuman commented 5 months ago

So from what I understand personalSettings.js attemps to load this …chunks_index….js without passing around that nonce that itself was loaded with, when the CSP forbids that.

Could it be we just need a --no-unsafe-inline arg to npm!?

I don't even know how people are supposed to build this, there's nothing in the README about that… and no ./configure :-P

mmuman commented 5 months ago

Ohhh, a Makefile :heart_eyes:

mmuman commented 5 months ago

Still no idea where to fix that though…

mmuman commented 5 months ago

Got a fix \o/

mmuman commented 5 months ago

All these hours for a oneliner :tired_face:

sveken commented 5 months ago

mediaconvert-log.log Installed the update today and still no change on my end. Tried restarting the container after the update, cleared browser cache.

printplaatreparatie commented 5 months ago

Same here, @cwilby please reopen this issue.

mmuman commented 5 months ago

Are you using HTTP or a properly configured HTTPS server?

printplaatreparatie commented 5 months ago

HTTPS

mmuman commented 5 months ago

Maybe the NC version ? Here I'm using 27.1.2…

cwilby commented 5 months ago

Kind of staring into a black box on this one. I'm pushing a change to the build script, it may be that the dev build is being released instead of the production build.

sveken commented 5 months ago

Im using HTTPS and 28.0.3

oliut commented 5 months ago

Nextcloud 28.0.4 (docker/apache) workflow-media-converter 1.10.3 with ssl offload on nginx (restart container, remove - reinstall media converter - does not help)

settings/user/workflow_media_converter

Choose folder button do not work with Error (in Chrome)

https://[my-server]/custom_apps/workflow_media_converter/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-RkOaxczZ_mjs.js?v=b503adf395d4b1c57cc4

Request Method: GET Status Code: 404 Not Found

Same in Edge

at r.f.j (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:943334)
at workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:941562
at Array.reduce (<anonymous>)
at r.e (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:941540)
at y.pick (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:946409)
at workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:961784
at v (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:955504)
at Generator.<anonymous> (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:956846)
at Generator.next (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:955933)
at X (workflow_media_converter-personalSettings.js?v=2dc04f56-22:2:961407)

nginx log

[03/Apr/2024:11:29:12 +0300] "GET /custom_apps/workflow_media_converter/workflow_media_converter-node_modules_nextcloud_dialogs_dist_chunks_index-RkOaxczZ_mjs.js?v=b503adf395d4b1c57cc4 HTTP/2.0" 404 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"

mmuman commented 5 months ago

Oh I didn't notice you were using a flow, I never actually tried before. Still I just tried creating one and it works here.

mmuman commented 5 months ago

I don't get where this "custom_apps" is used, I have no URL with that loaded anywhere when I use it… Is that introduced in version 28?

oliut commented 5 months ago

/custom_apps/ is the second app folder that is writable. if I reinstall workflow-media-converter in /apps/ folder - error (button not work) stays the same. And some previous versions of workflow-media-converter (1.9.3) I was able to "fix" by moving it from custom_apps to apps. but for current version (1.10.3) this workaround not work any more.

barrettsoftware commented 5 months ago

I am also experiencing this issue on a new deployment of an LXC container.

oliut commented 5 months ago

cp /var/www/html/apps/workflow_media_converter/js/*.js /var/www/html/apps/workflow_media_converter/

workaround for v1.10.3 that makes button work for me

printplaatreparatie commented 5 months ago

@oliut This works for me as well, nice!

Note that the problem with the web root described here was already solved with one of the last updates.

barrettsoftware commented 5 months ago

cp /var/www/html/apps/workflow_media_converter/js/*.js /var/www/html/apps/workflow_media_converter/

workaround for v1.10.3 that makes button work for me

this fix worked for me after I edited the paths to match my environment

moox64 commented 4 months ago

Same Problem , no action work on Button "choose Folder". I tried to move Folder "workflow_media_converter" from custom_app to apps (as oliut solution) . Still same for me, no working! anyone cet another solution ?

sveken commented 4 months ago

Just updated to NC29 Issue persists.

AlexandruNegura commented 4 months ago

So for this issue I did the following on an AIO v29 instalation:

  1. Moved the app from 'custom_apps' folder to 'apps' folder using: mv /var/www/html/custom_apps/workflow_media_converter /var/www/html/apps/workflow_media_converter
  2. Copy the JS files as in the answer above: cp /var/www/html/apps/workflow_media_converter/js/*.js /var/www/html/apps/workflow_media_converter/
cwilby commented 4 months ago

Fixed, needed to set __webpack_public_path__ correctly. (See above commit) This fixed the file picker issue on my Nextcloud instance, which has been having this same issue. It should also solve for people who install via the app store or install it directly into custom_apps etc.

sveken commented 4 months ago

This has fixed the file picker for the batch conversion area. However the folder select still does not work when configuring a flow with media converter. For example a flow that moves the source to a specific folder after run etc. image

cwilby commented 4 months ago

@sveken - Also needed to apply the above fix to the flow operator. Released in v1.11.7, please re-test and let me know if it isn't resolved.

sveken commented 4 months ago

Thank you. V1.11.7 fixes flow as well.