Skip to content

Commit

Permalink
allow disabling wopi chat
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Jun 16, 2023
1 parent 612ab00 commit 9853bf0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/wopi-disable-chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Allow disabling wopi chat

Allow disabling the chat in wopi (support for onlyoffice only)

https://github.com/cs3org/reva/pull/3986
20 changes: 12 additions & 8 deletions pkg/app/provider/wopi/wopi.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type config struct {
JWTSecret string `mapstructure:"jwt_secret" docs:";The JWT secret to be used to retrieve the token TTL."`
AppDesktopOnly bool `mapstructure:"app_desktop_only" docs:"false;Specifies if the app can be opened only on desktop."`
InsecureConnections bool `mapstructure:"insecure_connections"`
AppDisableChat bool `mapstructure:"app_disable_chat"`
}

func parseConfig(m map[string]interface{}) (*config, error) {
Expand Down Expand Up @@ -246,20 +247,23 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
return nil, err
}

appFullURL := result["app-url"].(string)
url, err := url.Parse(result["app-url"].(string))
if err != nil {
return nil, err
}

urlQuery := url.Query()
if language != "" {
url, err := url.Parse(appFullURL)
if err != nil {
return nil, err
}
urlQuery := url.Query()
urlQuery.Set("ui", language) // OnlyOffice
urlQuery.Set("lang", language) // Collabora
urlQuery.Set("UI_LLCC", language) // Office365
url.RawQuery = urlQuery.Encode()
appFullURL = url.String()
}
if p.conf.AppDisableChat {
urlQuery.Set("dchat", "1") // OnlyOffice disable chat
}

url.RawQuery = urlQuery.Encode()
appFullURL := url.String()

// Depending on whether wopi server returned any form parameters or not,
// we decide whether the request method is POST or GET
Expand Down

0 comments on commit 9853bf0

Please sign in to comment.