files_external_dropbox icon indicating copy to clipboard operation
files_external_dropbox copied to clipboard

plans for NC v 21

Open RichardBeisser opened this issue 4 years ago • 20 comments

Hello,

at the moment, NC v21 RC1 was released, so in the near future, NC21 get stable. Have you any plans for supporting NC21 with you NC-App?

at the moment, the app cannot be used in NC21 --> Server-Error thanks

RichardBeisser avatar Feb 05 '21 15:02 RichardBeisser

NC 21 is stable now, will it be supported?

bendschs avatar May 31 '21 21:05 bendschs

As a proof-of-concept I cloned this repo and the following two dependencies:

  • kunalvarma05/dropbox-php-sdk
  • Hemant-Mann/flysystem-dropbox

In dropbox-php-sdk I changed the depended version of guzzlehttp/guzzle to ~7.0 in composer.json. In flysystem-dropbox I added the repository of my cloned dropbox-php-sdk to composer.json and changed the depended version to dev-master. In the clone of this repo, I added the repos of my cloned dropbox-php-sdk and flysystem-dropbox to composer.json and changed both of their versions to dev-master.

I then ran make dist and copied the resulting folder to my Nextcloud 21 installation. I can confirm that the server errors are gone and the app works as expected. So, in order to get this app working with NC21, we "just" need to convince kunalvarma05/dropbox-php-sdk to change their depended on version of guzzle to ~7.0 and then wait for Hemant-Mann/flysystem-dropbox to release an updated version. I have no idea if that's ever going to happen.

fritteli avatar Jul 07 '21 21:07 fritteli

hi everyone, I am distracted and I have not disabled the integration so after the update I am in server error. is there a quick way to temporarily disable the extension and get everything working again? Thanks for your help!

TheRealDidi avatar Aug 19 '21 12:08 TheRealDidi

You could try renaming the folder /apps/files_external_dropbox to something else. I assume, Nextcloud would then no longer load the extension.

fritteli avatar Aug 22 '21 12:08 fritteli

Many thanks for the support, now everything works fine again.

TheRealDidi avatar Aug 22 '21 19:08 TheRealDidi

Glad to hear that! 👍

fritteli avatar Aug 22 '21 20:08 fritteli

Hey @fritteli, thanks for looking into this. I have tried out your external app and unfortunately I'm not having luck with it yet. Since Dropbox now seems to default use scoped apps, I have also gone to the permissions tab and enabled following scopes: files.metadata.read, files.metadata.write, files.content.read, files.content.write

I get all files but when I try to for example open or download a PDF from Dropbox I get this exception:

[webdav] Fatal: TypeError: Argument 1 passed to League\MimeTypeDetection\FinfoMimeTypeDetector::detectMimeTypeFromPath() must be of the type string, null given, called in /var/www/html/custom_apps/files_external_dropbox/vendor/league/flysystem/src/Util/MimeType.php on line 70 at <<closure>>

 0. /var/www/html/custom_apps/files_external_dropbox/vendor/league/flysystem/src/Util/MimeType.php line 70
    League\MimeTypeDetection\FinfoMimeTypeDetector->detectMimeTypeFromPath(null)
 1. /var/www/html/custom_apps/files_external_dropbox/vendor/hemant-mann/flysystem-dropbox/src/Adapter.php line 271
    League\Flysystem\Util\MimeType::detectByFilename(null)
 2. /var/www/html/custom_apps/files_external_dropbox/lib/Storage/Adapter.php line 29
    HemantMann\Flysystem\Dropbox\Adapter->normalizeResponse(Kunnu\Dropbox\Models\FileMetadata {})
 3. /var/www/html/custom_apps/files_external_dropbox/vendor/hemant-mann/flysystem-dropbox/src/Adapter.php line 96
    OCA\Files_external_dropbox\Storage\Adapter->normalizeResponse(Kunnu\Dropbox\Models\FileMetadata {})
 4. /var/www/html/custom_apps/files_external_dropbox/vendor/league/flysystem/src/Filesystem.php line 197
    HemantMann\Flysystem\Dropbox\Adapter->readStream("Apps/onyx-knote ... f")
 5. /var/www/html/lib/private/Files/Storage/Flysystem.php line 189
    League\Flysystem\Filesystem->readStream("Apps/onyx-knote ... f")
 6. /var/www/html/custom_apps/files_external_dropbox/lib/Storage/CacheableFlysystemAdapter.php line 129
    OC\Files\Storage\Flysystem->fopen("Apps/onyx-knote ... f", "r")
 7. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 302
    OCA\Files_external_dropbox\Storage\CacheableFlysystemAdapter->fopen("Apps/onyx-knote ... f", "r")
 8. /var/www/html/lib/private/Files/Storage/Wrapper/PermissionsMask.php line 118
    OC\Files\Storage\Wrapper\Wrapper->fopen("Apps/onyx-knote ... f", "r")
 9. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 302
    OC\Files\Storage\Wrapper\PermissionsMask->fopen("Apps/onyx-knote ... f", "r")
10. /var/www/html/lib/private/Files/Storage/Wrapper/Availability.php line 315
    OC\Files\Storage\Wrapper\Wrapper->fopen("Apps/onyx-knote ... f", "r")
11. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 302
    OC\Files\Storage\Wrapper\Availability->fopen("Apps/onyx-knote ... f", "r")
12. /var/www/html/lib/private/Files/View.php line 1166
    OC\Files\Storage\Wrapper\Wrapper->fopen("Apps/onyx-knote ... f", "r")
13. /var/www/html/lib/private/Files/View.php line 1002
    OC\Files\View->basicOperation("fopen", "/Dropbox/Apps/o ... f", ["read"], "r")
14. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 434
    OC\Files\View->fopen("Dropbox/Apps/on ... f", "r")
15. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 85
    OCA\DAV\Connector\Sabre\File->get()
16. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpGet(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
17. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit("method:GET", [Sabre\HTTP\Requ ... }])
18. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
19. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
20. /var/www/html/apps/dav/lib/Server.php line 332
    Sabre\DAV\Server->exec()
21. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
22. /var/www/html/remote.php line 167
    require_once("/var/www/html/a ... p")

GET /remote.php/dav/files/[my-name]/notepads/Notepad1.pdf
from 188.60.193.25 by [my-name] at 2021-08-22T21:19:01+00:00

Is your instance still working fine? Have I missed a specific permission? It looks like the app is failing to fetch the metadata from the path.

TheTimeWalker avatar Aug 22 '21 21:08 TheTimeWalker

Hi @TheTimeWalker , you're right, I'm getting the same error as you are ... :(

fritteli avatar Sep 08 '21 06:09 fritteli

Hey @TheTimeWalker, I may have good news for you, as I was able to access files stored in my external dropbox storage. GIve me some time to further test it, and I'll post an updated guide for getting the external dropbox storage backend to work. Wish me luck :)

fritteli avatar Nov 26 '21 11:11 fritteli

Note: These instructions are outdated. See https://github.com/DJaeger/files_external_dropbox/issues/32#issuecomment-989827346 The pullrequest kunalvarma05/dropbox-php-sdk#185 has been merged. Therefore, building the extension becomes a little bit easier. Here's an updated guide.

  1. Clone this repository: git clone [email protected]:DJaeger/files_external_dropbox.git
  2. In composer.json, remove the custom repository section for Hemant-Mann/dropbox-php-sdk and change the URL for flysystem-dropbox to https://github.com/fritteli/flysystem-dropbox. Also, change the version for kunalvarma05/dropbox-sdk-bin from v0.2.1 to dev-master. Here's a complete patch that shows all required changes:
diff --git a/composer.json b/composer.json
index b9b41d5..339dc2c 100644
--- a/composer.json
+++ b/composer.json
@@ -2,15 +2,11 @@
     "repositories": [
         {
             "type": "vcs",
-            "url": "https://github.com/Hemant-Mann/dropbox-php-sdk"
-        },
-        {
-            "type": "vcs",
-            "url": "https://github.com/Hemant-Mann/flysystem-dropbox"
+            "url": "https://github.com/fritteli/flysystem-dropbox"
         }
     ],
     "require": {
-        "kunalvarma05/dropbox-php-sdk": "v0.2.1",
+        "kunalvarma05/dropbox-php-sdk": "dev-master",
         "hemant-mann/flysystem-dropbox": "dev-master",
         "tightenco/collect": "v5.4.33"
     },
  1. Delete composer.lock
  2. Run make dist. It will (probably) fail, saying it can't find the file composer.lock (which you just deleted).
  3. Run php build/composer.phar install
  4. Run make dist again
  5. You should now find the file build/dist/files_external_dropbox.tar.gz, which you can copy to your Nextcloud's apps directory and unpack there.

For me, this seems to create a working installation of the external dropbox storage backend.

For the curious among you: The only thing I changed in my fork of fritteli/flysystem-dropbox is the following:

diff -u -r --color flysystem-dropbox-original/composer.json flysystem-dropbox/composer.json
--- a/composer.json	2021-11-26 13:17:02.717465080 +0100
+++ b/composer.json	2021-11-26 13:15:45.101942623 +0100
@@ -12,7 +12,7 @@
     "require": {
         "php": ">=5.6.0",
     	"league/flysystem": "^1.0",
-        "kunalvarma05/dropbox-php-sdk": "^0.2.0"
+        "kunalvarma05/dropbox-php-sdk": "dev-master"
     },
     "require-dev": {
         "phpunit/phpunit": "^5.7"

fritteli avatar Nov 26 '21 12:11 fritteli

I should probably mention that in the mean time I'm on Nextcloud 22.2.3.

fritteli avatar Nov 26 '21 12:11 fritteli

👍

On Fri, 26 Nov 2021 at 13:27 fritteli @.***> wrote:

I should probably mention that in the mean time I'm on Nextcloud 22.2.3.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DJaeger/files_external_dropbox/issues/32#issuecomment-979943101, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARLP6GQLCQUELRWHSC2BH73UN54MFANCNFSM4XE5OEZQ .

-- Maciej Żmudzki

zmudm avatar Nov 26 '21 15:11 zmudm

We're one step further: kunalvarma05/dropbox-php-sdk was tagged version 0.2.2; I created the pull request Hemant-Mann/flysystem-dropbox#1. If that gets merged (and subsequently a release is made of flysystem-dropbox), we could lift the dependency in this repo (files_external_dropbox), and we'd be done!

fritteli avatar Nov 27 '21 12:11 fritteli

Okay, pullrequest is open: #35. Everybody go and up-vote :)

fritteli avatar Nov 29 '21 21:11 fritteli

Thanks for your work on this @fritteli I have seen that this issue was caused within the deps, but had no time to go deeper After testing your build I will merge and deploy it asap Feedback for your merge by other people would be appreciated

BTW: You can replace your steps 3 to 6 by simply running make without dist, but the README needs an update anyway

DJaeger avatar Nov 30 '21 15:11 DJaeger

Tried to follow @fritteli 's instructions above, but ran in to a few issues which I tried to fix along the way but ultimately my Dropbox integration isn't working afterwards (NC v22.2.3)

  1. git clone command gives a permission denied. Downloaded the master.zip instead
  2. editted the file as necessary
  3. ok
  4. ok
  5. Returns an problem: " - hemant-mann/flysystem-dropbox dev-master requires kunalvarma05/dropbox-php-sdk ^0.2.2 -> found kunalvarma05/dropbox-php-sdk[v0.2.2] but it conflicts with your root composer.json require (dev-master). "

Changed this to v0.2.2 instead - think this the comment/fix from 27th Nov above

  1. Gives a "Skipping signing" message - this ok?
  2. Added to apps, configured with Dropbox dev console, etc. etc (I've done this before with other apps, so know the process)

Get a red exclamation and a long error "Creating \OCA\Files_external_dropbox\Storage\Dropbox storage failed" in the logs. (can provide)

Thanks for your hard work on this, it's been the main blocker for me moving from OwnCloud > NextCloud and I'm now so close!

bertieuk avatar Dec 09 '21 10:12 bertieuk

Hi @bertieuk, the instructions are outdated. Can you try the following steps based on the branch from my repository (the one that's used in the pullrequest #35 and then running through the following steps?

  1. Check out https://github.com/fritteli/files_external_dropbox.git; alternatively you can download the ZIP file: https://github.com/fritteli/files_external_dropbox/archive/refs/heads/master.zip
  2. In the created directory, run make.
  3. Run build/composer.phar update.
  4. Run make dist.
  5. You'll find the generated zip file at build/dist/files_external_dropbox.tar.gz.

Could you try that?

fritteli avatar Dec 09 '21 12:12 fritteli

@fritteli Thanks for the reply

Fully removed the previous app version and followed your new post, no errors building it but still get "Creating \OCA\Files_external_dropbox\Storage\Dropbox storage failed" in the logs and red exclamation. Tried setting it up both global and user.

I do now get the redirect to dropbox.com when clicking Grant Access, which I wasn't before - but this could be because I deleted the app in dropbox console and re-created just to be sure.

p.s Dropbox redirect URIs in the readme need to be: https://mynextcloud.example.com/index.php/settings/user/externalstorages https://mynextcloud.example.com/index.php/settings/admin/externalstorages (but I'm sure you know that)

bertieuk avatar Dec 09 '21 14:12 bertieuk

Hm, I don't get any errors, but I did not re-setup the connection. I'll try and see what happens if I set up a completely new connection to dropbox on my test instance of nextcloud. Perhaps I'll be able to reproduce your problem.

fritteli avatar Dec 10 '21 19:12 fritteli

😞 I can reproduce your problem when trying to create a new dropbox share on my test instance of nextcloud. Using the existing dropbox connection on my production instance works, though. I'm not at all sure, but ... when I set up the test connection (which fails), I was presented with this screen: dropbox-scoped-app The app that was created is labelled "Permission type: Scoped App": dropbox-not-working The app that I created years ago for my production instance (the connection that is working) is labelled "Permission type: Full Dropbox": dropbox-working

Perhaps it has got something to do with this?

fritteli avatar Dec 10 '21 20:12 fritteli