owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.4k stars 182 forks source link

[WOPI] Add supported view modes to app providers in /app/list #7634

Open dschmidt opened 1 year ago

dschmidt commented 1 year ago

Is your feature request related to a problem? Please describe.

In oC Web we want to support opening collaborative files in view (readonly) mode and then allow the user to switch to edit mode (https://github.com/owncloud/web/issues/9255). To handle this correctly we need to know which providers support which modes for a specific mime-type.

Describe the solution you'd like

We would like to have an additional property in the response from /app/list:

{
            "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "ext": "docx",
            "app_providers": [
                {
                    "name": "Office365",
                    "icon": "https://res.cdn.office.net/officehub/images/content/images/favicon-8f211ea639.ico"
                },
                {
                    "name": "OnlyOffice",
                    "icon": "https://ocis.test/web-apps/apps/documenteditor/main/resources/img/favicon.ico"
                }
            ],
            "name": "Microsoft Word",
            "description": "Microsoft Word document",
            "allow_creation": true,
            "default_application": "OnlyOffice"
        },

Next to name and icon it would be great to have the available view_modes: [] .

Describe alternatives you've considered

Make it configurable in oC Web. Downside: configuration split between app provider and Web, I would consider having to configure properties of app providers in web to be an anti pattern.

wkloucek commented 1 year ago

/app/xxx ist just a translation layer for https://github.com/cs3org/cs3apis/blob/main/cs3/app/registry/v1beta1/resources.proto and https://github.com/cs3org/cs3apis/blob/main/cs3/app/provider/v1beta1/resources.proto

The translation layer lives in https://github.com/cs3org/reva/tree/edge/internal/http/services/appprovider

The app registry lives in https://github.com/cs3org/reva/tree/edge/pkg/app/registry and https://github.com/cs3org/reva/blob/edge/internal/grpc/services/appregistry/appregistry.go

The app provider lives mainly in https://github.com/cs3org/reva/blob/edge/pkg/app/provider/wopi/wopi.go, https://github.com/cs3org/reva/blob/edge/internal/grpc/services/appprovider/appprovider.go and https://github.com/cs3org/wopiserver/blob/5ebe37eb18fe48b0bab7a1973ae52f933c5b6a86/tools/wopiopen.py#L5. I only know about the CS3org WOPI integration and no other integration.

(a different approach for a WOPI integration without separate appprovider / wopi server could look like this: https://github.com/wkloucek/cs3-wopi-server)

When it comes to WOPI, the /hosting/discovery endpoint (eg. https://onlyoffice.owncloud.com/hosting/discovery) plays a key role. It's interpreted here: https://github.com/cs3org/reva/blob/9f40f0453b34d485825703ea4b05b1cad1289513/pkg/app/provider/wopi/wopi.go#L397-L451