-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide JS Files API classes to access and manipulate files #13905
Comments
The JS Files API could also be written in a way similar to pyocclient: https://github.com/PVince81/pyocclient |
so this files api for javascript is then more a kind of "ownCloud Files SDK for JavaScript" - right? |
I would say so, yes. A JS SDK designed to run in the browser (not Node JS). It would be based on WebDAV and contain the workarounds required to upload files in IE 8 or browsers that might not support FormData/FileReader/etc. The interesting part is that it abstracts away the file access logic and also can be implemented by the trashbin to provide a view to access trashbin files through the same methods. I still need to think it through to make sure it:
|
I can only say this is very welcome! |
+1. Every app is currently using their own controller to do this |
In OC 9.0 there is now However it doesn't support uploading yet, might be tricky though. |
I've tested it in Gallery for the move operation and it worked as expected, looking forward to |
Upload is very tricky because it requires a hidden "input type=file" field to exist. Also one needs to trigger the file selection dialog by setting the focus on the field to make the browser trigger the dialog. Maybe you have some ideas ? 😄 Note that this PR #21237 brings webdav PUT upload but would need further refactoring to allow cramming the logic into this API. |
Well, thinking of it, the API might still look simple: client.triggerUploadDialog(targetFolder, options).then(function(data) {
// do stuff after the upload, data contains the uploaded files metadata
}); The call would have to generate the input field and direclty trigger it to make the dialog appear. Then it would perform the upload into the given |
apps could actually use this library: https://github.com/noveens/js-owncloud-client |
Currently apps and file viewers need to resort to their own URL generation schemes and have no direct way of doing file operations like "retrieving the file list" (ex: gallery), "downloading a file", etc.
Instead of having every app or file viewers invent their own way of accessing files, a JS Files API should be developed to provide file operations like:
Ideally this API should be implemented base directly WebDAV (see #12353).
Once this API is available, the following will be possible:
@DeepDiver1975 @icewind1991 @schiesbn @MorrisJobke @Raydiation what do you think ?
The text was updated successfully, but these errors were encountered: