Skip to content
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

Allow disabling wopi chat #3986

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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