Skip to content

Commit 27a5223

Browse files
2403905mmattel
andauthored
feat: [issues/OCISDEV-305] Enable the mobile web view for OnlyOffice … (#11661)
* feat: [issues/OCISDEV-305] Enable the mobile web view for OnlyOffice (EE) * Update services/collaboration/README.md Co-authored-by: Martin <[email protected]> * Update services/collaboration/README.md Co-authored-by: Martin <[email protected]> * Update services/collaboration/pkg/config/app.go Co-authored-by: Martin <[email protected]> * Update services/collaboration/pkg/config/wopi.go Co-authored-by: Martin <[email protected]> --------- Co-authored-by: Martin <[email protected]>
1 parent efc4034 commit 27a5223

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

services/collaboration/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ There are a few variables that you need to set:
3333
The product name of the connected WebOffice app, which can be one of the following:\
3434
`Collabora`, `OnlyOffice`, `Microsoft365` or `MicrosoftOfficeOnline`. This is used to internally control the behavior according to the different features of the used products.
3535

36+
* `COLLABORATION_APP_PRODUCT_EDITION`:\
37+
The product edition of the WebOffice app defines the app's specific capabilities.
38+
The supported editions of OnlyOffice are: `ce` (community edition), `de` (developer edition), `ee` (enterprise edition) or `default:empty` which equals to `ce`. These are used to control internal behavior according to the features of the products used.
39+
3640
* `COLLABORATION_APP_ADDR`:\
3741
The URL of the collaborative editing app (onlyoffice, collabora, etc).\
3842
For example: `https://office.example.com`.
@@ -47,6 +51,9 @@ There are a few variables that you need to set:
4751
* `COLLABORATION_WOPI_SHORTTOKENS`:\
4852
Needs to be set if the office application like `Microsoft Office Online` complains about the URL is too long (which contains the access token) and refuses to work. If enabled, a store must be configured.
4953

54+
* `COLLABORATION_WOPI_ENABLE_MOBILE`:\
55+
This option enables the mobile view for the Office Web App and only applies to OnlyOffice. While OnlyOffice `ce` supports mobile view mode only, the `ee` and `de` versions support mobile view in both view and edit modes. Set the product edition accordingly via `COLLABORATION_APP_PRODUCT_EDITION`.
56+
5057
The application can be customized further by changing the `COLLABORATION_APP_*` options to better describe the application.
5158

5259
## Storing

services/collaboration/pkg/config/app.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package config
22

33
// App defines the available app configuration.
44
type App struct {
5-
Name string `yaml:"name" env:"COLLABORATION_APP_NAME" desc:"The name of the app which is shown to the user. You can chose freely but you are limited to a single word without special characters or whitespaces. We recommend to use pascalCase like 'CollaboraOnline'." introductionVersion:"6.0.0"`
6-
Product string `yaml:"product" env:"COLLABORATION_APP_PRODUCT" desc:"The WebOffice app, either Collabora, OnlyOffice, Microsoft365 or MicrosoftOfficeOnline." introductionVersion:"7.0.0"`
7-
Description string `yaml:"description" env:"COLLABORATION_APP_DESCRIPTION" desc:"App description" introductionVersion:"6.0.0"`
8-
Icon string `yaml:"icon" env:"COLLABORATION_APP_ICON" desc:"Icon for the app" introductionVersion:"6.0.0"`
5+
Name string `yaml:"name" env:"COLLABORATION_APP_NAME" desc:"The name of the app which is shown to the user. You can chose freely but you are limited to a single word without special characters or whitespaces. We recommend to use pascalCase like 'CollaboraOnline'." introductionVersion:"6.0.0"`
6+
Product string `yaml:"product" env:"COLLABORATION_APP_PRODUCT" desc:"The WebOffice app, either Collabora, OnlyOffice, Microsoft365 or MicrosoftOfficeOnline." introductionVersion:"7.0.0"`
7+
ProductEdition string `yaml:"productedition" env:"COLLABORATION_APP_PRODUCT_EDITION" desc:"The WebOffice app edition defines the capabilities specific to the product such as CE - Community Edition, EE - Enterprise Edition DE - Developer Edition, etc. Currently supported values are limited to OnlyOffice and are: 'ce', 'ee' or 'de' and default to empty which is equal to ce). See the documentation for more details." introductionVersion:"Balch"`
8+
Description string `yaml:"description" env:"COLLABORATION_APP_DESCRIPTION" desc:"App description" introductionVersion:"6.0.0"`
9+
Icon string `yaml:"icon" env:"COLLABORATION_APP_ICON" desc:"Icon for the app" introductionVersion:"6.0.0"`
910

1011
Addr string `yaml:"addr" env:"COLLABORATION_APP_ADDR" desc:"The URL where the WOPI app is located, such as https://127.0.0.1:8080." introductionVersion:"6.0.0"`
1112
Insecure bool `yaml:"insecure" env:"COLLABORATION_APP_INSECURE" desc:"Skip TLS certificate verification when connecting to the WOPI app" introductionVersion:"6.0.0"`

services/collaboration/pkg/config/wopi.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package config
22

33
// Wopi defines the available configuration for the WOPI endpoint.
44
type Wopi struct {
5-
WopiSrc string `yaml:"wopisrc" env:"COLLABORATION_WOPI_SRC" desc:"The WOPI source base URL containing schema, host and port. Set this to the schema and domain where the collaboration service is reachable for the wopi app, such as https://office.owncloud.test." introductionVersion:"6.0.0"`
6-
Secret string `yaml:"secret" env:"COLLABORATION_WOPI_SECRET" desc:"Used to mint and verify WOPI JWT tokens and encrypt and decrypt the REVA JWT token embedded in the WOPI JWT token." introductionVersion:"6.0.0"`
7-
DisableChat bool `yaml:"disable_chat" env:"COLLABORATION_WOPI_DISABLE_CHAT;OCIS_WOPI_DISABLE_CHAT" desc:"Disable chat in the office web frontend. This feature applies to OnlyOffice and Microsoft." introductionVersion:"7.0.0"`
8-
ProxyURL string `yaml:"proxy_url" env:"COLLABORATION_WOPI_PROXY_URL" desc:"The URL to the ownCloud Office365 WOPI proxy. Optional. To use this feature, you need an office365 proxy subscription. If you become part of the Microsoft CSP program (https://learn.microsoft.com/en-us/partner-center/enroll/csp-overview), you can use WebOffice without a proxy." introductionVersion:"7.0.0"`
9-
ProxySecret string `yaml:"proxy_secret" env:"COLLABORATION_WOPI_PROXY_SECRET" desc:"Optional, the secret to authenticate against the ownCloud Office365 WOPI proxy. This secret can be obtained from ownCloud via the office365 proxy subscription." introductionVersion:"7.0.0"`
10-
ShortTokens bool `yaml:"short_tokens" env:"COLLABORATION_WOPI_SHORTTOKENS" desc:"Use short access tokens for WOPI access. This is useful for office packages, like Microsoft Office Online, which have URL length restrictions. If enabled, a persistent store must be configured." introductionVersion:"7.0.0"`
5+
WopiSrc string `yaml:"wopisrc" env:"COLLABORATION_WOPI_SRC" desc:"The WOPI source base URL containing schema, host and port. Set this to the schema and domain where the collaboration service is reachable for the wopi app, such as https://office.owncloud.test." introductionVersion:"6.0.0"`
6+
Secret string `yaml:"secret" env:"COLLABORATION_WOPI_SECRET" desc:"Used to mint and verify WOPI JWT tokens and encrypt and decrypt the REVA JWT token embedded in the WOPI JWT token." introductionVersion:"6.0.0"`
7+
DisableChat bool `yaml:"disable_chat" env:"COLLABORATION_WOPI_DISABLE_CHAT;OCIS_WOPI_DISABLE_CHAT" desc:"Disable chat in the office web frontend. This feature applies to OnlyOffice and Microsoft." introductionVersion:"7.0.0"`
8+
EnableMobile bool `yaml:"enable_mobile" env:"COLLABORATION_WOPI_ENABLE_MOBILE" desc:"Enable the mobile web view for office app. This feature applies to OnlyOffice. See the documentation for more details." introductionVersion:"Balch"`
9+
ProxyURL string `yaml:"proxy_url" env:"COLLABORATION_WOPI_PROXY_URL" desc:"The URL to the ownCloud Office365 WOPI proxy. Optional. To use this feature, you need an office365 proxy subscription. If you become part of the Microsoft CSP program (https://learn.microsoft.com/en-us/partner-center/enroll/csp-overview), you can use WebOffice without a proxy." introductionVersion:"7.0.0"`
10+
ProxySecret string `yaml:"proxy_secret" env:"COLLABORATION_WOPI_PROXY_SECRET" desc:"Optional, the secret to authenticate against the ownCloud Office365 WOPI proxy. This secret can be obtained from ownCloud via the office365 proxy subscription." introductionVersion:"7.0.0"`
11+
ShortTokens bool `yaml:"short_tokens" env:"COLLABORATION_WOPI_SHORTTOKENS" desc:"Use short access tokens for WOPI access. This is useful for office packages, like Microsoft Office Online, which have URL length restrictions. If enabled, a persistent store must be configured." introductionVersion:"7.0.0"`
1112
}

services/collaboration/pkg/service/grpc/v0/service.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,16 @@ func (s *Service) addQueryToURL(baseURL string, req *appproviderv1beta1.OpenInAp
247247
q.Add("dchat", "1")
248248
}
249249

250+
// The option enables the mobile web view for OnlyOffice.
251+
if strings.ToLower(s.config.App.Product) == "onlyoffice" && s.config.Wopi.EnableMobile {
252+
mobile := utils.ReadPlainFromOpaque(req.GetOpaque(), "mobile")
253+
if s.config.App.ProductEdition == "ee" || s.config.App.ProductEdition == "de" {
254+
q.Add("mobile", mobile)
255+
} else if req.GetViewMode() != appproviderv1beta1.ViewMode_VIEW_MODE_READ_WRITE {
256+
q.Add("mobile", mobile)
257+
}
258+
}
259+
250260
lang := utils.ReadPlainFromOpaque(req.GetOpaque(), "lang")
251261

252262
// @TODO: this is a temporary solution until we figure out how to send these from oc web

0 commit comments

Comments
 (0)