diff --git a/pkg/app/provider/wopi/wopi.go b/pkg/app/provider/wopi/wopi.go index ba64e614d3a..03ebdee70af 100644 --- a/pkg/app/provider/wopi/wopi.go +++ b/pkg/app/provider/wopi/wopi.go @@ -59,6 +59,7 @@ func init() { type config struct { IOPSecret string `mapstructure:"iop_secret" docs:";The IOP secret used to connect to the wopiserver."` WopiURL string `mapstructure:"wopi_url" docs:";The wopiserver's URL."` + PrivateLinkBaseURL string `mapstructure:"private_link_base_url" docs:";The base URL to generate private links to navigate back from apps."` AppName string `mapstructure:"app_name" docs:";The App user-friendly name."` AppIconURI string `mapstructure:"app_icon_uri" docs:";A URI to a static asset which represents the app icon."` AppURL string `mapstructure:"app_url" docs:";The App URL."` @@ -140,6 +141,13 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc q.Add("fileid", resource.GetId().OpaqueId) q.Add("viewmode", viewMode.String()) + privateLinkBaseURl, err := url.Parse(p.conf.PrivateLinkBaseURL) + if err != nil { + return nil, err + } + privateLinkBaseURl.Path = path.Join(privateLinkBaseURl.Path, "f", storagespace.FormatResourceID(*resource.GetId())) + q.Add("folderurl", privateLinkBaseURl.String()) + u, ok := ctxpkg.ContextGetUser(ctx) if ok { // else defaults to "Guest xyz" if u.Id.Type == userpb.UserType_USER_TYPE_LIGHTWEIGHT || u.Id.Type == userpb.UserType_USER_TYPE_FEDERATED { @@ -242,10 +250,9 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc return nil, err } urlQuery := url.Query() - // we could improve this by using the UI_LLCC value from the wopi discovery url - // https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/online/discovery#ui_llcc - urlQuery.Set("ui", language) // OnlyOffice - urlQuery.Set("lang", language) // Collabora + urlQuery.Set("ui", language) // OnlyOffice + urlQuery.Set("lang", language) // Collabora + urlQuery.Set("UI_LLCC", language) // Office365 url.RawQuery = urlQuery.Encode() appFullURL = url.String() }