-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Direct editing API to allow file editing using a one-time token #17625
Conversation
ec088b4
to
411fa94
Compare
❗ I also rebased |
276fe7a
to
799d0fa
Compare
Ready for a first round of review, I'll look into adding some tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice otherwise :)
799d0fa
to
3651878
Compare
3651878
to
43f0a0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nitpicks. The rest looks great!
After discussing with @tobiasKaminsky I moved the editor details to the files app capabilities as this will save us one additional request on the apps and will have a rather minimal performance impact on the server side, since most of the data should be static and coming from hardcoded values in php classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
3db38c1
to
75267c3
Compare
mobile apps Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
5061da1
to
dac7f00
Compare
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
dac7f00
to
bde624b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do this then!
Is this documentation somewhere available? |
Nope. @juliushaertl be sure to add it to the docs indeed |
Please update and verify the document: "API endpoints" because it's incorrect. thanks |
@juliushaertl the "Get the list of templates" if do not exists a templates do not return nothing, but the Richdocuments API return one record with template of name "Empty", can we use the same logic ? |
* LoadAdditionalScripts (@rullzer) - nextcloud/server#16641 * LoadViewerEvent (@skjnldsv) - nextcloud/viewer#271 * RegisterDirectEditorEvent (@juliushaertl) - nextcloud/server#17625 * typed events for files scanner (@ChristophWurst) - nextcloud/server#18351 * typed events for group mangement (@ChristophWurst) - nextcloud/server#18350 * AddContentSecurityPolicyEvent (@rullzer) - nextcloud/server#15730 * UserLiveStatusEvent (@georgehrke) - nextcloud/server#21186 * password_policy events (@ChristophWurst) - nextcloud/server#18019 * AddFeaturePolicyEvent (@rullzer) - nextcloud/server#16613 * ShareCreatedEvent (@rullzer) - nextcloud/server#18384 * LoadSettingsScriptsEvent (@blizzz) - nextcloud/server#21475 * flow events (@rullzer) - nextcloud/server#18535 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* LoadAdditionalScripts (@rullzer) - nextcloud/server#16641 * LoadViewerEvent (@skjnldsv) - nextcloud/viewer#271 * RegisterDirectEditorEvent (@juliushaertl) - nextcloud/server#17625 * typed events for files scanner (@ChristophWurst) - nextcloud/server#18351 * typed events for group mangement (@ChristophWurst) - nextcloud/server#18350 * AddContentSecurityPolicyEvent (@rullzer) - nextcloud/server#15730 * UserLiveStatusEvent (@georgehrke) - nextcloud/server#21186 * password_policy events (@ChristophWurst) - nextcloud/server#18019 * AddFeaturePolicyEvent (@rullzer) - nextcloud/server#16613 * ShareCreatedEvent (@rullzer) - nextcloud/server#18384 * LoadSettingsScriptsEvent (@blizzz) - nextcloud/server#21475 * flow events (@rullzer) - nextcloud/server#18535 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* LoadAdditionalScripts (@rullzer) - nextcloud/server#16641 * LoadViewerEvent (@skjnldsv) - nextcloud/viewer#271 * RegisterDirectEditorEvent (@juliushaertl) - nextcloud/server#17625 * typed events for files scanner (@ChristophWurst) - nextcloud/server#18351 * typed events for group mangement (@ChristophWurst) - nextcloud/server#18350 * AddContentSecurityPolicyEvent (@rullzer) - nextcloud/server#15730 * UserLiveStatusEvent (@georgehrke) - nextcloud/server#21186 * password_policy events (@ChristophWurst) - nextcloud/server#18019 * AddFeaturePolicyEvent (@rullzer) - nextcloud/server#16613 * ShareCreatedEvent (@rullzer) - nextcloud/server#18384 * LoadSettingsScriptsEvent (@blizzz) - nextcloud/server#21475 * flow events (@rullzer) - nextcloud/server#18535 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* LoadAdditionalScripts (@rullzer) - nextcloud/server#16641 * LoadViewerEvent (@skjnldsv) - nextcloud/viewer#271 * RegisterDirectEditorEvent (@juliushaertl) - nextcloud/server#17625 * typed events for files scanner (@ChristophWurst) - nextcloud/server#18351 * typed events for group mangement (@ChristophWurst) - nextcloud/server#18350 * AddContentSecurityPolicyEvent (@rullzer) - nextcloud/server#15730 * UserLiveStatusEvent (@georgehrke) - nextcloud/server#21186 * password_policy events (@ChristophWurst) - nextcloud/server#18019 * AddFeaturePolicyEvent (@rullzer) - nextcloud/server#16613 * ShareCreatedEvent (@rullzer) - nextcloud/server#18384 * LoadSettingsScriptsEvent (@blizzz) - nextcloud/server#21475 * flow events (@rullzer) - nextcloud/server#18535 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Early draft PR so @tobiasKaminsky has something to play with 😉
The idea is to unify the token generation and endpoints into a server API, so mobile apps and the desktop client can just query one endpoint instead of requiring individual implementation for every app. The basic concept is that mobile apps now can request a one time url to edit a file, which can be opened in an unauthenticated webview by the apps.
Editor class
This class defines how your app is presented in the frontend (name), which filetypes it can handle as well as the endpoint that will be shown when the one-time link is opened. Inside of the open method you can then just load the onlyoffice editor with the file that is provided in the
$token
parameter.https://github.com/nextcloud/text/blob/db42744a5c651666ca91d66219f77ae5775f949c/lib/DirectEditing/TextDirectEditor.php
Register the editor class in your lib/AppInfo/Application.php
Add document creators:
Creators are used to show entries in the mobile apps like "Create a new
spreadsheet" Furthermore you can also prefill the file with some content
if that is needed for the specific mimetype. Once you have added a class
it also needs to be registered in your Editor class.
https://github.com/nextcloud/text/blob/db42744a5c651666ca91d66219f77ae5775f949c/lib/DirectEditing/TextDocumentCreator.php
API endpoints
Obtain editor details
curl 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing?format=json' -H 'OCS-APIRequest: true'
Get the list of templates
curl 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing/templates/text/textdocumenttemplate?format=json' -H 'OCS-APIRequest: true'
Create an empty file
curl -X POST 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing/create?path=/foo1.md&editorId=text&creatorId=textdocument&format=json' -H 'OCS-APIRequest: true'
Create a file from a template
curl -X POST 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing/create?path=/foo1.md&editorId=text&creatorId=textdocumenttemplate&templateId=1&format=json' -H 'OCS-APIRequest: true'
Open a file
curl -X POST 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing/open?path=/subfolder/123.txt&editorId=text&format=json' -H 'OCS-APIRequest: true'