diff --git a/services/collaboration/README.md b/services/collaboration/README.md index af0ac72b8c..7fab8f3633 100644 --- a/services/collaboration/README.md +++ b/services/collaboration/README.md @@ -1,8 +1,8 @@ # Collaboration -The collaboration service connects ocis with document servers such as Collabora, ONLYOFFICE or Microsoft using the WOPI protocol. +The collaboration service connects opencloud with document servers such as Collabora, ONLYOFFICE or Microsoft using the WOPI protocol. -Since this service requires an external document server, it won't start by default when using `ocis server`. You must start it manually with the `ocis collaboration server` command. +Since this service requires an external document server, it won't start by default when using `opencloud server`. You must start it manually with the `opencloud collaboration server` command. Because the collaboration service needs to be started manually, the following prerequisite applies: On collaboration service startup, particular environment variables are required to be populated. If environment variables have a default like the `MICRO_REGISTRY_ADDRESS`, the default will be used, if not set otherwise. Use for all others the instance values as defined. If these environment variables are not provided or misconfigured, the collaboration service will not start up. @@ -20,7 +20,7 @@ The collaboration service requires the target document server (ONLYOFFICE, Colla * The gateway service. * The app-registry service. -If any of the named services above have not been started or are not reachable, the collaboration service won't start. For the binary or the docker release of Infinite Scale, check with the `ocis list` command if they have been started. If not, you must start them manually upfront before starting the collaboration service. +If any of the named services above have not been started or are not reachable, the collaboration service won't start. For the binary or the docker release of Infinite Scale, check with the `opencloud list` command if they have been started. If not, you must start them manually upfront before starting the collaboration service. ## WOPI Configuration diff --git a/services/collaboration/pkg/command/root.go b/services/collaboration/pkg/command/root.go index 89c08266ae..402bba75f9 100644 --- a/services/collaboration/pkg/command/root.go +++ b/services/collaboration/pkg/command/root.go @@ -21,7 +21,7 @@ func GetCommands(cfg *config.Config) cli.Commands { func Execute(cfg *config.Config) error { app := clihelper.DefaultApp(&cli.App{ Name: "collaboration", - Usage: "Serve WOPI for oCIS", + Usage: "Serve WOPI for OpenCloud", Commands: GetCommands(cfg), }) diff --git a/services/collaboration/pkg/command/server.go b/services/collaboration/pkg/command/server.go index 735ec29678..3e8d25343c 100644 --- a/services/collaboration/pkg/command/server.go +++ b/services/collaboration/pkg/command/server.go @@ -44,7 +44,7 @@ func Server(cfg *config.Config) *cli.Command { defer cancel() // prepare components - if err := helpers.RegisterOcisService(ctx, cfg, logger); err != nil { + if err := helpers.RegisterOpenCloudService(ctx, cfg, logger); err != nil { return err } diff --git a/services/collaboration/pkg/config/parser/parse.go b/services/collaboration/pkg/config/parser/parse.go index 2aa5160911..fcdaf78aa5 100644 --- a/services/collaboration/pkg/config/parser/parse.go +++ b/services/collaboration/pkg/config/parser/parse.go @@ -6,7 +6,7 @@ import ( "net/url" occfg "github.com/opencloud-eu/opencloud/pkg/config" - ocisdefaults "github.com/opencloud-eu/opencloud/pkg/config/defaults" + ocdefaults "github.com/opencloud-eu/opencloud/pkg/config/defaults" "github.com/opencloud-eu/opencloud/pkg/config/envdecode" "github.com/opencloud-eu/opencloud/pkg/shared" "github.com/opencloud-eu/opencloud/services/collaboration/pkg/config" @@ -49,14 +49,14 @@ func Validate(cfg *config.Config) error { "Make sure your %s config contains the proper values "+ "(e.g. by running opencloud init or setting it manually in "+ "the config/corresponding environment variable): %s", - cfg.Service.Name, ocisdefaults.BaseConfigPath(), err.Error()) + cfg.Service.Name, ocdefaults.BaseConfigPath(), err.Error()) } if url.Path != "" { return fmt.Errorf("The WOPI Src must not contain a path in your config for %s. "+ "Make sure your %s config contains the proper values "+ "(e.g. by running opencloud init or setting it manually in "+ "the config/corresponding environment variable)", - cfg.Service.Name, ocisdefaults.BaseConfigPath()) + cfg.Service.Name, ocdefaults.BaseConfigPath()) } return nil diff --git a/services/collaboration/pkg/config/wopi.go b/services/collaboration/pkg/config/wopi.go index 9a428a5818..d240eefd3c 100644 --- a/services/collaboration/pkg/config/wopi.go +++ b/services/collaboration/pkg/config/wopi.go @@ -2,10 +2,10 @@ package config // Wopi defines the available configuration for the WOPI endpoint. type Wopi struct { - 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"` + 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.example.test." introductionVersion:"6.0.0"` 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"` DisableChat bool `yaml:"disable_chat" env:"COLLABORATION_WOPI_DISABLE_CHAT;OC_WOPI_DISABLE_CHAT" desc:"Disable chat in the office web frontend. This feature applies to OnlyOffice and Microsoft." introductionVersion:"7.0.0"` - 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"` - 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"` + ProxyURL string `yaml:"proxy_url" env:"COLLABORATION_WOPI_PROXY_URL" desc:"The URL to the OpenCloud 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"` + ProxySecret string `yaml:"proxy_secret" env:"COLLABORATION_WOPI_PROXY_SECRET" desc:"Optional, the secret to authenticate against the OpenCloud WOPI proxy. This secret can be obtained from ownCloud via the office365 proxy subscription." introductionVersion:"7.0.0"` 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"` } diff --git a/services/collaboration/pkg/connector/fileconnector.go b/services/collaboration/pkg/connector/fileconnector.go index 7fd2dadd52..98ae5b3131 100644 --- a/services/collaboration/pkg/connector/fileconnector.go +++ b/services/collaboration/pkg/connector/fileconnector.go @@ -1215,7 +1215,7 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse, breadcrumbFolderName = statRes.GetInfo().GetSpace().GetName() } - ocisURL, err := url.Parse(f.cfg.Commons.OcisURL) + ocURL, err := url.Parse(f.cfg.Commons.OcisURL) if err != nil { return nil, err } @@ -1224,17 +1224,17 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse, return nil, err } privateLinkURL := &url.URL{} - *privateLinkURL = *ocisURL - privateLinkURL.Path = path.Join(ocisURL.Path, "f", storagespace.FormatResourceID(statRes.GetInfo().GetId())) + *privateLinkURL = *ocURL + privateLinkURL.Path = path.Join(ocURL.Path, "f", storagespace.FormatResourceID(statRes.GetInfo().GetId())) parentFolderURL := &url.URL{} - *parentFolderURL = *ocisURL + *parentFolderURL = *ocURL if !isPublicShare { - parentFolderURL.Path = path.Join(ocisURL.Path, "f", storagespace.FormatResourceID(statRes.GetInfo().GetParentId())) + parentFolderURL.Path = path.Join(ocURL.Path, "f", storagespace.FormatResourceID(statRes.GetInfo().GetParentId())) } else { if scopes, ok := ctxpkg.ContextGetScopes(ctx); ok { publicShare := &link.PublicShare{} if err := f.getScopeByKeyPrefix(scopes, "publicshare:", publicShare); err == nil { - parentFolderURL.Path = path.Join(ocisURL.Path, "s", publicShare.GetToken()) + parentFolderURL.Path = path.Join(ocURL.Path, "s", publicShare.GetToken()) } else { logger.Error().Err(err).Msg("CheckFileInfo: error getting public share scope") } @@ -1253,8 +1253,8 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse, fileinfo.KeyBreadcrumbFolderName: breadcrumbFolderName, fileinfo.KeyBreadcrumbFolderURL: parentFolderURL.String(), - fileinfo.KeyHostViewURL: createHostUrl("view", ocisURL, f.cfg.App.Name, statRes.GetInfo()), - fileinfo.KeyHostEditURL: createHostUrl("write", ocisURL, f.cfg.App.Name, statRes.GetInfo()), + fileinfo.KeyHostViewURL: createHostUrl("view", ocURL, f.cfg.App.Name, statRes.GetInfo()), + fileinfo.KeyHostEditURL: createHostUrl("write", ocURL, f.cfg.App.Name, statRes.GetInfo()), fileinfo.KeyFileSharingURL: createShareUrl(privateLinkURL), fileinfo.KeyFileVersionURL: createVersionsUrl(privateLinkURL), @@ -1328,20 +1328,20 @@ func (f *FileConnector) createDownloadURL(wopiContext middleware.WopiContext, co return downloadURL.String(), nil } -func createHostUrl(mode string, ocisUrl *url.URL, appName string, info *providerv1beta1.ResourceInfo) string { - webUrl := createAppExternalURL(ocisUrl, appName, info) +func createHostUrl(mode string, u *url.URL, appName string, info *providerv1beta1.ResourceInfo) string { + webUrl := createAppExternalURL(u, appName, info) addURLParams(webUrl, map[string]string{"view_mode": mode}) return webUrl.String() } -func createShareUrl(ocisURL *url.URL) string { - shareURL := *ocisURL +func createShareUrl(u *url.URL) string { + shareURL := *u addURLParams(&shareURL, map[string]string{"details": "sharing"}) return shareURL.String() } -func createVersionsUrl(ocisURL *url.URL) string { - versionsURL := *ocisURL +func createVersionsUrl(u *url.URL) string { + versionsURL := *u addURLParams(&versionsURL, map[string]string{"details": "versions"}) return versionsURL.String() } @@ -1354,11 +1354,11 @@ func addURLParams(u *url.URL, params map[string]string) { u.RawQuery = q.Encode() } -func createAppExternalURL(ocisURL *url.URL, appName string, info *providerv1beta1.ResourceInfo) *url.URL { +func createAppExternalURL(u *url.URL, appName string, info *providerv1beta1.ResourceInfo) *url.URL { spaceAlias := utils.ReadPlainFromOpaque(info.GetSpace().GetOpaque(), "spaceAlias") - appExternalURL := *ocisURL - appExternalURL.Path = path.Join(ocisURL.Path, "external-"+strings.ToLower(appName), spaceAlias, info.GetPath()) - q := ocisURL.Query() + appExternalURL := *u + appExternalURL.Path = path.Join(u.Path, "external-"+strings.ToLower(appName), spaceAlias, info.GetPath()) + q := u.Query() q.Add("fileId", storagespace.FormatResourceID(info.GetId())) appExternalURL.RawQuery = q.Encode() return &appExternalURL diff --git a/services/collaboration/pkg/connector/fileconnector_test.go b/services/collaboration/pkg/connector/fileconnector_test.go index ba5cd04bfc..a008c5d4e7 100644 --- a/services/collaboration/pkg/connector/fileconnector_test.go +++ b/services/collaboration/pkg/connector/fileconnector_test.go @@ -46,14 +46,14 @@ var _ = Describe("FileConnector", func() { BeforeEach(func() { cfg = &config.Config{ Commons: &shared.Commons{ - OcisURL: "https://ocis.example.prv", + OcisURL: "https://cloud.opencloud.test", }, App: config.App{ Name: "test", Product: "Microsoft", }, Wopi: config.Wopi{ - WopiSrc: "https://ocis.server.prv", + WopiSrc: "https://wopi.opencloud.test", Secret: "topsecret", }, TokenManager: &config.TokenManager{JWTSecret: "secret"}, @@ -956,9 +956,9 @@ var _ = Describe("FileConnector", func() { Expect(response.Headers).To(BeNil()) rBody := response.Body.(map[string]interface{}) Expect(rBody["Name"]).To(Equal("newDocument.docx")) - Expect(rBody["Url"]).To(HavePrefix("https://ocis.server.prv/wopi/files/")) // skip checking the actual reference - Expect(rBody["HostEditUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) - Expect(rBody["HostViewUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) + Expect(rBody["Url"]).To(HavePrefix("https://wopi.opencloud.test/wopi/files/")) // skip checking the actual reference + Expect(rBody["HostEditUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) + Expect(rBody["HostViewUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) }) It("PutRelativeFileSuggested success only extension", func() { @@ -1011,9 +1011,9 @@ var _ = Describe("FileConnector", func() { Expect(response.Headers).To(BeNil()) rBody := response.Body.(map[string]interface{}) Expect(rBody["Name"]).To(Equal("file.pdf")) - Expect(rBody["Url"]).To(HavePrefix("https://ocis.server.prv/wopi/files/")) // skip checking the actual reference - Expect(rBody["HostEditUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/file.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) - Expect(rBody["HostViewUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/file.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) + Expect(rBody["Url"]).To(HavePrefix("https://wopi.opencloud.test/wopi/files/")) // skip checking the actual reference + Expect(rBody["HostEditUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/file.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) + Expect(rBody["HostViewUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/file.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) }) It("PutRelativeFileSuggested success conflict", func() { @@ -1083,9 +1083,9 @@ var _ = Describe("FileConnector", func() { Expect(response.Headers).To(BeNil()) rBody := response.Body.(map[string]interface{}) Expect(rBody["Name"]).To(MatchRegexp(`[a-zA-Z0-9_-] file\.pdf`)) - Expect(rBody["Url"]).To(HavePrefix("https://ocis.server.prv/wopi/files/")) // skip checking the actual reference - Expect(rBody["HostEditUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/" + url.PathEscape(path.Base(*newFilePath)) + "?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) - Expect(rBody["HostViewUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/" + url.PathEscape(path.Base(*newFilePath)) + "?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) + Expect(rBody["Url"]).To(HavePrefix("https://wopi.opencloud.test/wopi/files/")) // skip checking the actual reference + Expect(rBody["HostEditUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/" + url.PathEscape(path.Base(*newFilePath)) + "?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) + Expect(rBody["HostViewUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/" + url.PathEscape(path.Base(*newFilePath)) + "?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) }) It("PutRelativeFileSuggested put file fails", func() { @@ -1207,9 +1207,9 @@ var _ = Describe("FileConnector", func() { Expect(response.Headers).To(BeNil()) rBody := response.Body.(map[string]interface{}) Expect(rBody["Name"]).To(Equal("newDocument.docx")) - Expect(rBody["Url"]).To(HavePrefix("https://ocis.server.prv/wopi/files/")) // skip checking the actual reference - Expect(rBody["HostEditUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) - Expect(rBody["HostViewUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) + Expect(rBody["Url"]).To(HavePrefix("https://wopi.opencloud.test/wopi/files/")) // skip checking the actual reference + Expect(rBody["HostEditUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) + Expect(rBody["HostViewUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/newDocument.docx?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) }) It("PutRelativeFileRelative conflict", func() { @@ -1266,9 +1266,9 @@ var _ = Describe("FileConnector", func() { Expect(response.Headers[connector.HeaderWopiValidRT]).To(MatchRegexp(`[a-zA-Z0-9_-] convFile\.pdf`)) rBody := response.Body.(map[string]interface{}) Expect(rBody["Name"]).To(Equal("convFile.pdf")) - Expect(rBody["Url"]).To(HavePrefix("https://ocis.server.prv/wopi/files/")) // skip checking the actual reference - Expect(rBody["HostEditUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/convFile.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) - Expect(rBody["HostViewUrl"]).To(Equal("https://ocis.example.prv/external-test/personal/path/to/convFile.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) + Expect(rBody["Url"]).To(HavePrefix("https://wopi.opencloud.test/wopi/files/")) // skip checking the actual reference + Expect(rBody["HostEditUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/convFile.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=write")) + Expect(rBody["HostViewUrl"]).To(Equal("https://cloud.opencloud.test/external-test/personal/path/to/convFile.pdf?fileId=storageid%24spaceid%21opaqueid_newDoc&view_mode=view")) }) It("PutRelativeFileRelative put file fails", func() { @@ -1704,7 +1704,7 @@ var _ = Describe("FileConnector", func() { BaseFileName: "test.txt", BreadcrumbDocName: "test.txt", BreadcrumbFolderName: "/path/to", - BreadcrumbFolderURL: "https://ocis.example.prv/f/storageid$spaceid%21parentopaqueid", + BreadcrumbFolderURL: "https://cloud.opencloud.test/f/storageid$spaceid%21parentopaqueid", UserCanNotWriteRelative: false, SupportsExtendedLockLength: true, SupportsGetLock: true, @@ -1716,10 +1716,10 @@ var _ = Describe("FileConnector", func() { UserCanRename: true, UserID: "61646d696e40637573746f6d496470", // hex of admin@customIdp UserFriendlyName: "Pet Shaft", - FileSharingURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=sharing", - FileVersionURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=versions", - HostEditURL: "https://ocis.example.prv/external-test/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", - HostViewURL: "https://ocis.example.prv/external-test/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=view", + FileSharingURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=sharing", + FileVersionURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=versions", + HostEditURL: "https://cloud.opencloud.test/external-test/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", + HostViewURL: "https://cloud.opencloud.test/external-test/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=view", } response, err := fc.CheckFileInfo(ctx) @@ -1791,7 +1791,7 @@ var _ = Describe("FileConnector", func() { SupportsRename: true, UserCanRename: false, BreadcrumbDocName: "test.txt", - PostMessageOrigin: "https://ocis.example.prv", + PostMessageOrigin: "https://cloud.opencloud.test", } response, err := fc.CheckFileInfo(ctx) @@ -1879,7 +1879,7 @@ var _ = Describe("FileConnector", func() { BaseFileName: "test.txt", BreadcrumbDocName: "test.txt", BreadcrumbFolderName: "/path/to", - BreadcrumbFolderURL: "https://ocis.example.prv/s/ABC123", + BreadcrumbFolderURL: "https://cloud.opencloud.test/s/ABC123", DisablePrint: true, UserCanNotWriteRelative: false, SupportsLocks: true, @@ -1892,10 +1892,10 @@ var _ = Describe("FileConnector", func() { EnableInsertRemoteImage: false, UserID: "guest-zzz000", UserFriendlyName: "guest zzz000", - FileSharingURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=sharing", - FileVersionURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=versions", - HostEditURL: "https://ocis.example.prv/external-onlyoffice/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", - PostMessageOrigin: "https://ocis.example.prv", + FileSharingURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=sharing", + FileVersionURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=versions", + HostEditURL: "https://cloud.opencloud.test/external-onlyoffice/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", + PostMessageOrigin: "https://cloud.opencloud.test", } response, err := fc.CheckFileInfo(ctx) @@ -1974,7 +1974,7 @@ var _ = Describe("FileConnector", func() { SupportsRename: true, UserCanRename: false, BreadcrumbDocName: "test.txt", - PostMessageOrigin: "https://ocis.example.prv", + PostMessageOrigin: "https://cloud.opencloud.test", } response, err := fc.CheckFileInfo(ctx) @@ -2032,7 +2032,7 @@ var _ = Describe("FileConnector", func() { BaseFileName: "test.txt", BreadcrumbDocName: "test.txt", BreadcrumbFolderName: "/path/to", - BreadcrumbFolderURL: "https://ocis.example.prv/f/storageid$spaceid%21parentopaqueid", + BreadcrumbFolderURL: "https://cloud.opencloud.test/f/storageid$spaceid%21parentopaqueid", UserCanNotWriteRelative: false, SupportsLocks: true, SupportsUpdate: true, @@ -2041,10 +2041,10 @@ var _ = Describe("FileConnector", func() { UserCanRename: true, UserID: "61646d696e40637573746f6d496470", // hex of admin@customIdp UserFriendlyName: "Pet Shaft", - FileSharingURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=sharing", - FileVersionURL: "https://ocis.example.prv/f/storageid$spaceid%21opaqueid?details=versions", - HostEditURL: "https://ocis.example.prv/external-onlyoffice/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", - PostMessageOrigin: "https://ocis.example.prv", + FileSharingURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=sharing", + FileVersionURL: "https://cloud.opencloud.test/f/storageid$spaceid%21opaqueid?details=versions", + HostEditURL: "https://cloud.opencloud.test/external-onlyoffice/path/to/test.txt?fileId=storageid%24spaceid%21opaqueid&view_mode=write", + PostMessageOrigin: "https://cloud.opencloud.test", } // change wopi app provider @@ -2057,7 +2057,7 @@ var _ = Describe("FileConnector", func() { returnedFileInfo := response.Body.(*fileinfo.OnlyOffice) templateSource := returnedFileInfo.TemplateSource - expectedTemplateSource := "https://ocis.server.prv/wopi/templates/a340d017568d0d579ee061a9ac02109e32fb07082d35c40aa175864303bd9107?access_token=" + expectedTemplateSource := "https://wopi.opencloud.test/wopi/templates/a340d017568d0d579ee061a9ac02109e32fb07082d35c40aa175864303bd9107?access_token=" // take TemplateSource out of the response for easier comparison returnedFileInfo.TemplateSource = "" diff --git a/services/collaboration/pkg/helpers/discovery_test.go b/services/collaboration/pkg/helpers/discovery_test.go index a9153bbec8..2db298527f 100644 --- a/services/collaboration/pkg/helpers/discovery_test.go +++ b/services/collaboration/pkg/helpers/discovery_test.go @@ -23,26 +23,26 @@ var _ = Describe("Discovery", func() { - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + - + @@ -78,14 +78,14 @@ var _ = Describe("Discovery", func() { expectedAppUrls := map[string]map[string]string{ "view": map[string]string{ - ".pdf": "https://test.server.prv/hosting/wopi/word/view", - ".djvu": "https://test.server.prv/hosting/wopi/word/view", - ".docx": "https://test.server.prv/hosting/wopi/word/view", - ".xls": "https://test.server.prv/hosting/wopi/cell/view", - ".xlsb": "https://test.server.prv/hosting/wopi/cell/view", + ".pdf": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".djvu": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".docx": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".xls": "https://cloud.opencloud.test/hosting/wopi/cell/view", + ".xlsb": "https://cloud.opencloud.test/hosting/wopi/cell/view", }, "edit": map[string]string{ - ".docx": "https://test.server.prv/hosting/wopi/word/edit", + ".docx": "https://cloud.opencloud.test/hosting/wopi/word/edit", }, } diff --git a/services/collaboration/pkg/helpers/registration.go b/services/collaboration/pkg/helpers/registration.go index 18574ad68a..f3f7d7b749 100644 --- a/services/collaboration/pkg/helpers/registration.go +++ b/services/collaboration/pkg/helpers/registration.go @@ -16,10 +16,10 @@ import ( "github.com/opencloud-eu/opencloud/services/collaboration/pkg/config" ) -// RegisterOcisService will register this service. +// RegisterOpenCloudService will register this service. // There are no explicit requirements for the context, and it will be passed // without changes to the underlying RegisterService method. -func RegisterOcisService(ctx context.Context, cfg *config.Config, logger log.Logger) error { +func RegisterOpenCloudService(ctx context.Context, cfg *config.Config, logger log.Logger) error { svc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name+"."+cfg.App.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString()) return registry.RegisterService(ctx, logger, svc, cfg.Debug.Addr) } diff --git a/services/collaboration/pkg/middleware/tracing.go b/services/collaboration/pkg/middleware/tracing.go index 869549458a..2fc40d186e 100644 --- a/services/collaboration/pkg/middleware/tracing.go +++ b/services/collaboration/pkg/middleware/tracing.go @@ -31,19 +31,19 @@ func CollaborationTracingMiddleware(next http.Handler) http.Handler { wopiFile := wopiContext.FileReference attrs := []attribute.KeyValue{ - attribute.String("ocis.wopi.sessionid", r.Header.Get("X-WOPI-SessionId")), - attribute.String("ocis.wopi.method", wopiMethod), - attribute.String("ocis.wopi.resource.id.storage", wopiFile.GetResourceId().GetStorageId()), - attribute.String("ocis.wopi.resource.id.opaque", wopiFile.GetResourceId().GetOpaqueId()), - attribute.String("ocis.wopi.resource.id.space", wopiFile.GetResourceId().GetSpaceId()), - attribute.String("ocis.wopi.resource.path", wopiFile.GetPath()), + attribute.String("wopi.session.id", r.Header.Get("X-WOPI-SessionId")), + attribute.String("wopi.method", wopiMethod), + attribute.String("cs3.resource.id.storage", wopiFile.GetResourceId().GetStorageId()), + attribute.String("cs3.resource.id.opaque", wopiFile.GetResourceId().GetOpaqueId()), + attribute.String("cs3.resource.id.space", wopiFile.GetResourceId().GetSpaceId()), + attribute.String("cs3.resource.path", wopiFile.GetPath()), } if wopiUser, ok := ctxpkg.ContextGetUser(r.Context()); ok { attrs = append(attrs, []attribute.KeyValue{ - attribute.String("ocis.wopi.user.idp", wopiUser.GetId().GetIdp()), - attribute.String("ocis.wopi.user.opaque", wopiUser.GetId().GetOpaqueId()), - attribute.String("ocis.wopi.user.type", wopiUser.GetId().GetType().String()), + attribute.String("cs3.user.idp", wopiUser.GetId().GetIdp()), + attribute.String("cs3.user.opaque", wopiUser.GetId().GetOpaqueId()), + attribute.String("cs3.user.type", wopiUser.GetId().GetType().String()), }...) } span.SetAttributes(attrs...) diff --git a/services/collaboration/pkg/proofkeys/handler.go b/services/collaboration/pkg/proofkeys/handler.go index 066f899fa6..5e28fba9d3 100644 --- a/services/collaboration/pkg/proofkeys/handler.go +++ b/services/collaboration/pkg/proofkeys/handler.go @@ -59,7 +59,7 @@ func NewVerifyHandler(discoveryURL string, insecure bool, cachedDur time.Duratio // All the provided parameters are strings: // * accessToken: The access token used for this request (targeting this collaboration service) // * url: The full url for this request, including scheme, host and all query parameters, -// something like "https://wopiserver.test.private/wopi/file/abcbcbd?access_token=oiuiu" or +// something like "https://wopi.opencloud.test/wopi/file/abcbcbd?access_token=oiuiu" or // "http://wopiserver:8888/wopi/file/abcdef?access_token=zzxxyy" // * timestamp: The timestamp provided by the WOPI app in the "X-WOPI-TimeStamp" header, as string // * sig64: The base64-encoded signature, which should come directly from the "X-WOPI-Proof" header diff --git a/services/collaboration/pkg/service/grpc/v0/service_test.go b/services/collaboration/pkg/service/grpc/v0/service_test.go index 61634f083b..c7514047ca 100644 --- a/services/collaboration/pkg/service/grpc/v0/service_test.go +++ b/services/collaboration/pkg/service/grpc/v0/service_test.go @@ -85,15 +85,15 @@ var _ = Describe("Discovery", func() { service.Config(cfg), service.AppURLs(map[string]map[string]string{ "view": { - ".pdf": "https://test.server.prv/hosting/wopi/word/view", - ".djvu": "https://test.server.prv/hosting/wopi/word/view", - ".docx": "https://test.server.prv/hosting/wopi/word/view", - ".xls": "https://test.server.prv/hosting/wopi/cell/view", - ".xlsb": "https://test.server.prv/hosting/wopi/cell/view", + ".pdf": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".djvu": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".docx": "https://cloud.opencloud.test/hosting/wopi/word/view", + ".xls": "https://cloud.opencloud.test/hosting/wopi/cell/view", + ".xlsb": "https://cloud.opencloud.test/hosting/wopi/cell/view", }, "edit": { - ".docx": "https://test.server.prv/hosting/wopi/word/edit", - ".invalid": "://test.server.prv/hosting/wopi/cell/edit", + ".docx": "https://cloud.opencloud.test/hosting/wopi/word/edit", + ".invalid": "://cloud.opencloud.test/hosting/wopi/cell/edit", }, }), service.GatewaySelector(gatewaySelector), @@ -108,7 +108,7 @@ var _ = Describe("Discovery", func() { It("Invalid access token", func() { ctx := context.Background() - cfg.Wopi.WopiSrc = "https://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "https://wopi.opencloud.test" req := &appproviderv1beta1.OpenInAppRequest{ ResourceInfo: &providerv1beta1.ResourceInfo{ @@ -146,7 +146,7 @@ var _ = Describe("Discovery", func() { ctx := context.Background() nowTime := time.Now() - cfg.Wopi.WopiSrc = "https://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "https://wopi.opencloud.test" cfg.Wopi.Secret = "my_supa_secret" cfg.Wopi.DisableChat = disableChat cfg.App.Name = appName @@ -189,26 +189,26 @@ var _ = Describe("Discovery", func() { Expect(resp.GetAppUrl().GetAppUrl()).To(Equal(expectedAppUrl)) Expect(resp.GetAppUrl().GetFormParameters()["access_token_ttl"]).To(Equal(strconv.FormatInt(nowTime.Add(5*time.Hour).Unix()*1000, 10))) }, - Entry("Microsoft chat no lang", "Microsoft", "", false, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), - Entry("Collabora chat no lang", "Collabora", "", false, "https://test.server.prv/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), - Entry("OnlyOffice chat no lang", "OnlyOffice", "", false, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), - Entry("Microsoft chat lang", "Microsoft", "de", false, "https://test.server.prv/hosting/wopi/word/edit?UI_LLCC=de-DE&WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), - Entry("Collabora chat lang", "Collabora", "de", false, "https://test.server.prv/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&lang=de-DE"), - Entry("OnlyOffice chat lang", "OnlyOffice", "de", false, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&ui=de-DE"), - Entry("Microsoft no chat no lang", "Microsoft", "", true, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), - Entry("Collabora no chat no lang", "Collabora", "", true, "https://test.server.prv/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), - Entry("OnlyOffice no chat no lang", "OnlyOffice", "", true, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), - Entry("Microsoft no chat lang", "Microsoft", "de", true, "https://test.server.prv/hosting/wopi/word/edit?UI_LLCC=de-DE&WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), - Entry("Collabora no chat lang", "Collabora", "de", true, "https://test.server.prv/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1&lang=de-DE"), - Entry("OnlyOffice no chat lang", "OnlyOffice", "de", true, "https://test.server.prv/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1&ui=de-DE"), + Entry("Microsoft chat no lang", "Microsoft", "", false, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), + Entry("Collabora chat no lang", "Collabora", "", false, "https://cloud.opencloud.test/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), + Entry("OnlyOffice chat no lang", "OnlyOffice", "", false, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), + Entry("Microsoft chat lang", "Microsoft", "de", false, "https://cloud.opencloud.test/hosting/wopi/word/edit?UI_LLCC=de-DE&WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e"), + Entry("Collabora chat lang", "Collabora", "de", false, "https://cloud.opencloud.test/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&lang=de-DE"), + Entry("OnlyOffice chat lang", "OnlyOffice", "de", false, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&ui=de-DE"), + Entry("Microsoft no chat no lang", "Microsoft", "", true, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), + Entry("Collabora no chat no lang", "Collabora", "", true, "https://cloud.opencloud.test/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), + Entry("OnlyOffice no chat no lang", "OnlyOffice", "", true, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), + Entry("Microsoft no chat lang", "Microsoft", "de", true, "https://cloud.opencloud.test/hosting/wopi/word/edit?UI_LLCC=de-DE&WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1"), + Entry("Collabora no chat lang", "Collabora", "de", true, "https://cloud.opencloud.test/hosting/wopi/word/view?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1&lang=de-DE"), + Entry("OnlyOffice no chat lang", "OnlyOffice", "de", true, "https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=https%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&dchat=1&ui=de-DE"), ) It("Success with Wopi Proxy", func() { ctx := context.Background() nowTime := time.Now() - cfg.Wopi.WopiSrc = "https://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "https://wopi.opencloud.test" cfg.Wopi.Secret = "my_supa_secret" - cfg.Wopi.ProxyURL = "https://office.proxy.test.prv" + cfg.Wopi.ProxyURL = "https://office.proxy.opencloud.test" cfg.Wopi.ProxySecret = "your_supa_secret" cfg.App.Name = "Microsoft" @@ -244,14 +244,14 @@ var _ = Describe("Discovery", func() { Expect(err).To(Succeed()) Expect(resp.GetStatus().GetCode()).To(Equal(rpcv1beta1.Code_CODE_OK)) Expect(resp.GetAppUrl().GetMethod()).To(Equal("POST")) - Expect(resp.GetAppUrl().GetAppUrl()).To(Equal("https://test.server.prv/hosting/wopi/word/edit?UI_LLCC=en-US&WOPISrc=https%3A%2F%2Foffice.proxy.test.prv%2Fwopi%2Ffiles%2FeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1IjoiaHR0cHM6Ly93b3Bpc2VydmVyLnRlc3QucHJ2L3dvcGkvZmlsZXMvIiwiZiI6IjJmNmVjMTg2OTZkZDEwMDgxMDY3NDliZDk0MTA2ZTVjZmFkNWMwOWUxNWRlN2I3NzA4OGQwMzg0M2U3MWI0M2UifQ.yfyLHZ18Z1MFOa6u7AP0LqfIiQ9X5AMkYauEZGhbCNs")) + Expect(resp.GetAppUrl().GetAppUrl()).To(Equal("https://cloud.opencloud.test/hosting/wopi/word/edit?UI_LLCC=en-US&WOPISrc=https%3A%2F%2Foffice.proxy.opencloud.test%2Fwopi%2Ffiles%2FeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1IjoiaHR0cHM6Ly93b3BpLm9wZW5jbG91ZC50ZXN0L3dvcGkvZmlsZXMvIiwiZiI6IjJmNmVjMTg2OTZkZDEwMDgxMDY3NDliZDk0MTA2ZTVjZmFkNWMwOWUxNWRlN2I3NzA4OGQwMzg0M2U3MWI0M2UifQ.j873xu7TkqtIokSIQXW5y7-BRRrHgIURqAx4WY_zxTA")) Expect(resp.GetAppUrl().GetFormParameters()["access_token_ttl"]).To(Equal(strconv.FormatInt(nowTime.Add(5*time.Hour).Unix()*1000, 10))) }) It("Fail with invalid app url", func() { ctx := context.Background() nowTime := time.Now() - cfg.Wopi.WopiSrc = "htttps://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "htttps://wopi.opencloud.test" cfg.Wopi.Secret = "my_supa_secret" cfg.App.Name = "Microsoft" @@ -292,7 +292,7 @@ var _ = Describe("Discovery", func() { ctx := context.Background() nowTime := time.Now() - cfg.Wopi.WopiSrc = "htttps://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "htttps://wopi.opencloud.test" cfg.Wopi.Secret = "my_supa_secret" cfg.App.Name = "Microsoft" @@ -334,7 +334,7 @@ var _ = Describe("Discovery", func() { ctx := context.Background() nowTime := time.Now() - cfg.Wopi.WopiSrc = "htttps://wopiserver.test.prv" + cfg.Wopi.WopiSrc = "htttps://wopi.opencloud.test" cfg.Wopi.Secret = "my_supa_secret" cfg.App.Name = "OnlyOffice" cfg.App.Product = "OnlyOffice" @@ -372,7 +372,7 @@ var _ = Describe("Discovery", func() { Expect(err).To(Succeed()) Expect(resp.GetStatus().GetCode()).To(Equal(rpcv1beta1.Code_CODE_OK)) Expect(resp.GetAppUrl().GetMethod()).To(Equal("POST")) - Expect(resp.GetAppUrl().GetAppUrl()).To(Equal("https://test.server.prv/hosting/wopi/word/edit?WOPISrc=htttps%3A%2F%2Fwopiserver.test.prv%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&ui=en-US")) + Expect(resp.GetAppUrl().GetAppUrl()).To(Equal("https://cloud.opencloud.test/hosting/wopi/word/edit?WOPISrc=htttps%3A%2F%2Fwopi.opencloud.test%2Fwopi%2Ffiles%2F2f6ec18696dd1008106749bd94106e5cfad5c09e15de7b77088d03843e71b43e&ui=en-US")) Expect(resp.GetAppUrl().GetFormParameters()["access_token_ttl"]).To(Equal(strconv.FormatInt(nowTime.Add(5*time.Hour).Unix()*1000, 10))) }) }) diff --git a/services/collaboration/pkg/wopisrc/wopisrc.go b/services/collaboration/pkg/wopisrc/wopisrc.go index 47a38ea6ba..8bb5676f2c 100644 --- a/services/collaboration/pkg/wopisrc/wopisrc.go +++ b/services/collaboration/pkg/wopisrc/wopisrc.go @@ -19,7 +19,7 @@ import ( // If no proxy URL and proxy secret are configured, the URL will be generated // as a direct URL that contains the file reference. // Example: -// https:/ocis.team/wopi/files/12312678470610632091729803710923 +// https:/cloud.example.test/wopi/files/12312678470610632091729803710923 func GenerateWopiSrc(fileRef string, cfg *config.Config) (*url.URL, error) { wopiSrcURL, err := url.Parse(cfg.Wopi.WopiSrc) if err != nil { diff --git a/services/collaboration/pkg/wopisrc/wopisrc_test.go b/services/collaboration/pkg/wopisrc/wopisrc_test.go index 0a893cb643..b3477a1bd1 100644 --- a/services/collaboration/pkg/wopisrc/wopisrc_test.go +++ b/services/collaboration/pkg/wopisrc/wopisrc_test.go @@ -16,7 +16,7 @@ var _ = Describe("Wopisrc Test", func() { BeforeEach(func() { c = &config.Config{ Wopi: config.Wopi{ - WopiSrc: "https://ocis.team/wopi/files", + WopiSrc: "https://cloud.example.test/wopi/files", ProxyURL: "https://cloud.proxy.com", ProxySecret: "secret", }, @@ -25,7 +25,7 @@ var _ = Describe("Wopisrc Test", func() { When("WopiSrc URL is incorrect", func() { c = &config.Config{ Wopi: config.Wopi{ - WopiSrc: "https:&//ocis.team/wopi/files", + WopiSrc: "https:&//cloud.example.test/wopi/files", }, } url, err := wopisrc.GenerateWopiSrc("123456", c) @@ -35,7 +35,7 @@ var _ = Describe("Wopisrc Test", func() { When("proxy URL is incorrect", func() { c = &config.Config{ Wopi: config.Wopi{ - WopiSrc: "https://ocis.team/wopi/files", + WopiSrc: "https://cloud.example.test/wopi/files", ProxyURL: "cloud", ProxySecret: "secret", }, @@ -48,7 +48,7 @@ var _ = Describe("Wopisrc Test", func() { It("should generate a WOPI src URL as a jwt token", func() { url, err := wopisrc.GenerateWopiSrc("123456", c) Expect(err).ToNot(HaveOccurred()) - Expect(url.String()).To(Equal("https://cloud.proxy.com/wopi/files/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1IjoiaHR0cHM6Ly9vY2lzLnRlYW0vd29waS9maWxlcy8iLCJmIjoiMTIzNDU2In0.6ol9PQXGKktKfAri8tsJ4X_a9rIeosJ7id6KTQW6Ui0")) + Expect(url.String()).To(Equal("https://cloud.proxy.com/wopi/files/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1IjoiaHR0cHM6Ly9jbG91ZC5leGFtcGxlLnRlc3Qvd29waS9maWxlcy8iLCJmIjoiMTIzNDU2In0.LzyGPanHKxjLlIPoyfGU4cAUxzy3FAmBqMIqLCSHclg")) }) }) When("proxy URL and proxy secret are not configured", func() { @@ -57,7 +57,7 @@ var _ = Describe("Wopisrc Test", func() { c.Wopi.ProxySecret = "" url, err := wopisrc.GenerateWopiSrc("123456", c) Expect(err).ToNot(HaveOccurred()) - Expect(url.String()).To(Equal("https://ocis.team/wopi/files/123456")) + Expect(url.String()).To(Equal("https://cloud.example.test/wopi/files/123456")) }) }) })