Uh oh!
There was an error while loading. Please reload this page.
Direct editing API to allow file editing using a one-time token - #17625
Conversation
Uh oh!
There was an error while loading. Please reload this page.
ec088b4 to
411fa94ComparetobiasKaminsky
commented
Oct 31, 2019
❗ I also rebased |
276fe7a to
799d0faComparejuliusknorr
commented
Nov 13, 2019
Ready for a first round of review, I'll look into adding some tests |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
799d0fa to
3651878Compare3651878 to
43f0a0eCompare
ChristophWurst
left a comment
There was a problem hiding this comment.
Just a few nitpicks. The rest looks great!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
juliusknorr
commented
Nov 25, 2019
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. |
3db38c1 to
75267c3CompareUh oh!
There was an error while loading. Please reload this page.
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>
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
bde624bComparetobiasKaminsky
commented
Dec 10, 2019
Is this documentation somewhere available? |
rullzer
commented
Dec 10, 2019
Nope. @juliushaertl be sure to add it to the docs indeed |
Please update and verify the document: "API endpoints" because it's incorrect. thanks |
marinofaggiana
commented
Dec 13, 2019
@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
$tokenparameter.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'