diff --git a/changelog/unreleased/enhancement-enable-insert-remote-file.md b/changelog/unreleased/enhancement-enable-insert-remote-file.md new file mode 100644 index 00000000000..19f6618d2a9 --- /dev/null +++ b/changelog/unreleased/enhancement-enable-insert-remote-file.md @@ -0,0 +1,7 @@ +Enhancement: Enable EnableInsertRemoteFile and EnableInsertRemoteImage WOPI flags + +Enable the EnableInsertRemoteFile and EnableInsertRemoteImage flags in the Collabora CheckFileInfo response. This activates the multimedia insertion and document comparison menus in Collabora Online via the UI_InsertFile and UI_InsertGraphic postMessages. + +Requires Collabora Online >= 24.04.10 for multimedia insertion, >= 25.04.9.1 for document comparison. Also requires a companion frontend change in owncloud/web to handle the postMessages. + +https://github.com/owncloud/ocis/pull/12192 diff --git a/services/collaboration/pkg/connector/fileconnector.go b/services/collaboration/pkg/connector/fileconnector.go index a9915588abd..50eb452645a 100644 --- a/services/collaboration/pkg/connector/fileconnector.go +++ b/services/collaboration/pkg/connector/fileconnector.go @@ -1291,6 +1291,8 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse, fileinfo.KeyFileVersionURL: createVersionsUrl(privateLinkURL), fileinfo.KeyEnableOwnerTermination: true, // only for collabora + fileinfo.KeyEnableInsertRemoteImage: true, + fileinfo.KeyEnableInsertRemoteFile: true, fileinfo.KeySupportsExtendedLockLength: true, fileinfo.KeySupportsGetLock: true, fileinfo.KeySupportsLocks: true, diff --git a/services/collaboration/pkg/connector/fileconnector_test.go b/services/collaboration/pkg/connector/fileconnector_test.go index ca49d5f9514..ba79f75eeba 100644 --- a/services/collaboration/pkg/connector/fileconnector_test.go +++ b/services/collaboration/pkg/connector/fileconnector_test.go @@ -1833,6 +1833,8 @@ var _ = Describe("FileConnector", func() { UserID: "guest-zzz000", UserFriendlyName: "guest zzz000", EnableOwnerTermination: true, + EnableInsertRemoteImage: true, + EnableInsertRemoteFile: true, SupportsLocks: true, SupportsRename: true, UserCanRename: false, @@ -1930,6 +1932,7 @@ var _ = Describe("FileConnector", func() { BreadcrumbFolderURL: "https://ocis.example.prv/s/ABC123", // Match share token format DisablePrint: true, UserCanNotWriteRelative: false, + EnableInsertRemoteImage: true, SupportsLocks: true, SupportsUpdate: true, SupportsRename: true, @@ -2016,6 +2019,8 @@ var _ = Describe("FileConnector", func() { UserID: hex.EncodeToString([]byte("aabbcc@example.com")), UserFriendlyName: "Pet Shaft", EnableOwnerTermination: true, + EnableInsertRemoteImage: true, + EnableInsertRemoteFile: true, WatermarkText: "", SupportsLocks: true, SupportsRename: true, @@ -2088,6 +2093,8 @@ var _ = Describe("FileConnector", func() { UserID: hex.EncodeToString([]byte("aabbcc@example.com")), UserFriendlyName: "Pet Shaft", EnableOwnerTermination: true, + EnableInsertRemoteImage: true, + EnableInsertRemoteFile: true, WatermarkText: "Pet Shaft shaft@example.com", SupportsLocks: true, SupportsRename: true, @@ -2154,6 +2161,7 @@ var _ = Describe("FileConnector", func() { BreadcrumbFolderName: "/path/to", BreadcrumbFolderURL: "https://ocis.example.prv/f/storageid$spaceid%21parentopaqueid", UserCanNotWriteRelative: false, + EnableInsertRemoteImage: true, SupportsLocks: true, SupportsUpdate: true, SupportsRename: true, diff --git a/services/collaboration/pkg/connector/fileinfo/collabora.go b/services/collaboration/pkg/connector/fileinfo/collabora.go index 82b1573616e..e6022c002de 100644 --- a/services/collaboration/pkg/connector/fileinfo/collabora.go +++ b/services/collaboration/pkg/connector/fileinfo/collabora.go @@ -36,6 +36,8 @@ type Collabora struct { // If set to true, this will enable the insertion of images chosen from the WOPI storage. A UI_InsertGraphic postMessage will be send to the WOPI host to request the UI to select the file. EnableInsertRemoteImage bool `json:"EnableInsertRemoteImage,omitempty"` + // If set to true, this will enable the insertion of remote files chosen from the WOPI storage. A UI_InsertFile postMessage will be sent to the WOPI host to request the UI to select the file. This enables multimedia insertion and document comparison features. + EnableInsertRemoteFile bool `json:"EnableInsertRemoteFile,omitempty"` // If set to true, this will disable the insertion of image chosen from the local device. If EnableInsertRemoteImage is not set to true, then inserting images files is not possible. DisableInsertLocalImage bool `json:"DisableInsertLocalImage,omitempty"` // If set to true, hides the print option from the file menu bar in the UI. @@ -107,6 +109,8 @@ func (cinfo *Collabora) SetProperties(props map[string]interface{}) { case KeyEnableInsertRemoteImage: cinfo.EnableInsertRemoteImage = value.(bool) + case KeyEnableInsertRemoteFile: + cinfo.EnableInsertRemoteFile = value.(bool) case KeyDisableInsertLocalImage: cinfo.DisableInsertLocalImage = value.(bool) case KeyHidePrintOption: diff --git a/services/collaboration/pkg/connector/fileinfo/fileinfo.go b/services/collaboration/pkg/connector/fileinfo/fileinfo.go index 72f8ae74d87..fc6fd9ef1c2 100644 --- a/services/collaboration/pkg/connector/fileinfo/fileinfo.go +++ b/services/collaboration/pkg/connector/fileinfo/fileinfo.go @@ -102,6 +102,7 @@ const ( KeyTemplateSource = "TemplateSource" KeyEnableInsertRemoteImage = "EnableInsertRemoteImage" + KeyEnableInsertRemoteFile = "EnableInsertRemoteFile" KeyDisableInsertLocalImage = "DisableInsertLocalImage" KeyHidePrintOption = "HidePrintOption" KeyHideSaveOption = "HideSaveOption"