From c07f3c6c37637c16461e29935e4f13eeb0f02a8d Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 7 Nov 2023 08:29:15 +0100 Subject: [PATCH 1/3] feat: add configs for the Web embed mode --- changelog/unreleased/web-embed-mode-config.md | 9 +++++++++ services/web/pkg/config/options.go | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 changelog/unreleased/web-embed-mode-config.md diff --git a/changelog/unreleased/web-embed-mode-config.md b/changelog/unreleased/web-embed-mode-config.md new file mode 100644 index 00000000000..580ad220740 --- /dev/null +++ b/changelog/unreleased/web-embed-mode-config.md @@ -0,0 +1,9 @@ +Enhancement: Configs for Web embed mode + +Two new configs for the Web embed mode have been added: + +* `mode` Defines the mode in which Web will be running. +* `embedTarget` Defines how Web is being integrated when running in embed mode. + +https://github.com/owncloud/ocis/pull/7670 +https://github.com/owncloud/web/issues/9768 diff --git a/services/web/pkg/config/options.go b/services/web/pkg/config/options.go index cf0a8cd7194..ce3886334b0 100644 --- a/services/web/pkg/config/options.go +++ b/services/web/pkg/config/options.go @@ -26,7 +26,10 @@ type Options struct { AccessDeniedHelpURL string `json:"accessDeniedHelpUrl,omitempty" yaml:"accessDeniedHelpUrl" env:"WEB_OPTION_ACCESS_DENIED_HELP_URL" desc:"Specifies the target URL valid for the ocis instance for the generic logged out / access denied page."` TokenStorageLocal bool `json:"tokenStorageLocal" yaml:"tokenStorageLocal" env:"WEB_OPTION_TOKEN_STORAGE_LOCAL" desc:"Specifies whether the access token will be stored in the local storage when set to 'true' or in the session storage when set to 'false'. If stored in the local storage, login state will be persisted across multiple browser tabs, means no additional logins are required. Defaults to 'true'."` DisabledExtensions []string `json:"disabledExtensions,omitempty" yaml:"disabledExtensions" env:"WEB_OPTION_DISABLED_EXTENSIONS" desc:"Disable specific Web extensions identified by their ID. The ID can e.g. be taken from the 'index.ts' file of the web extension. Multiple ID's can be written as comma separated list like: 'com.github.owncloud.web.files.search','com.github.owncloud.web.files.print'. See the Environment Variable Types documentation for details."` + Mode string `json:"mode,omitempty" yaml:"mode" env:"WEB_OPTION_MODE" desc:"Defines the mode in which Web will be running. Currently, the only supported option is 'embed', which will enable a stripped down version of Web with reduced functionality. This can be used to integrate Web into other applications, e.g. via iFrame. When no specific mode is given, Web will run as usual with all functionality enabled. This is also the default behaviour."` + EmbedTarget string `json:"embedTarget,omitempty" yaml:"embedTarget" env:"WEB_OPTION_EMBED_TARGET" desc:"Defines how Web is being integrated when running in embed mode. Currently, the only supported option is 'location', which will run embedded Web as location picker. Resource selection will be disabled and the selected resources array always includes the current folder as the only item. When no specific target is given, Web will run regular as defined via the 'mode' config. This is also the default behaviour.'"` } + // AccountEditLink are the AccountEditLink options type AccountEditLink struct { Href string `json:"href,omitempty" yaml:"href" env:"WEB_OPTION_ACCOUNT_EDIT_LINK_HREF" desc:"Set a different target URL for the edit link. Make sure to prepend it with 'http(s)://'."` From 21653d9d1a14c0b5eb1c019f0b91af11f152fbb5 Mon Sep 17 00:00:00 2001 From: Jannik Stehle <50302941+JammingBen@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:09:21 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Martin --- services/web/pkg/config/options.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/pkg/config/options.go b/services/web/pkg/config/options.go index ce3886334b0..1450d6655f5 100644 --- a/services/web/pkg/config/options.go +++ b/services/web/pkg/config/options.go @@ -26,8 +26,8 @@ type Options struct { AccessDeniedHelpURL string `json:"accessDeniedHelpUrl,omitempty" yaml:"accessDeniedHelpUrl" env:"WEB_OPTION_ACCESS_DENIED_HELP_URL" desc:"Specifies the target URL valid for the ocis instance for the generic logged out / access denied page."` TokenStorageLocal bool `json:"tokenStorageLocal" yaml:"tokenStorageLocal" env:"WEB_OPTION_TOKEN_STORAGE_LOCAL" desc:"Specifies whether the access token will be stored in the local storage when set to 'true' or in the session storage when set to 'false'. If stored in the local storage, login state will be persisted across multiple browser tabs, means no additional logins are required. Defaults to 'true'."` DisabledExtensions []string `json:"disabledExtensions,omitempty" yaml:"disabledExtensions" env:"WEB_OPTION_DISABLED_EXTENSIONS" desc:"Disable specific Web extensions identified by their ID. The ID can e.g. be taken from the 'index.ts' file of the web extension. Multiple ID's can be written as comma separated list like: 'com.github.owncloud.web.files.search','com.github.owncloud.web.files.print'. See the Environment Variable Types documentation for details."` - Mode string `json:"mode,omitempty" yaml:"mode" env:"WEB_OPTION_MODE" desc:"Defines the mode in which Web will be running. Currently, the only supported option is 'embed', which will enable a stripped down version of Web with reduced functionality. This can be used to integrate Web into other applications, e.g. via iFrame. When no specific mode is given, Web will run as usual with all functionality enabled. This is also the default behaviour."` - EmbedTarget string `json:"embedTarget,omitempty" yaml:"embedTarget" env:"WEB_OPTION_EMBED_TARGET" desc:"Defines how Web is being integrated when running in embed mode. Currently, the only supported option is 'location', which will run embedded Web as location picker. Resource selection will be disabled and the selected resources array always includes the current folder as the only item. When no specific target is given, Web will run regular as defined via the 'mode' config. This is also the default behaviour.'"` + Mode string `json:"mode,omitempty" yaml:"mode" env:"WEB_OPTION_MODE" desc:"Defines the mode in which Web will be running. Currently, the only supported options are '' (empty) and 'embed'. With '' which is the default, Web will run as usual with all functionality enabled. 'embed' will enable a stripped down version of Web with reduced functionality used to integrate Web into other applications like via iFrame."` + EmbedTarget string `json:"embedTarget,omitempty" yaml:"embedTarget" env:"WEB_OPTION_EMBED_TARGET" desc:"Defines how Web is being integrated when running in 'embed' mode. Currently, the only supported options are '' (empty) and 'location'. With '' which is the default, Web will run regular as defined via the 'mode' config option. With 'location', Web will run embedded as location picker. Resource selection will be disabled and the selected resources array always includes the current folder as the only item."` } // AccountEditLink are the AccountEditLink options From 14ad4faa61d307578927b28ce03e39d762dc7cc3 Mon Sep 17 00:00:00 2001 From: mmattel Date: Tue, 7 Nov 2023 11:19:19 +0100 Subject: [PATCH 3/3] add a section in readme --- services/web/README.md | 4 ++++ services/web/pkg/config/options.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/web/README.md b/services/web/README.md index ae2067dd921..ad459c31c0a 100644 --- a/services/web/README.md +++ b/services/web/README.md @@ -20,3 +20,7 @@ Beside theming, the behavior of the web UI can be configured via options. See th ### Web UI Config File When defined via the `WEB_UI_CONFIG_FILE` environment variable, the configuration of the web UI can be made with a [json based](https://github.com/owncloud/web/tree/master/config) file. + +### Embedding Web + +Web can be consumed by another application in a stripped down version called “Embed mode”. This mode is supposed to be used in the context of selecting or sharing resources. For more details see the developer documentation [ownCloud Web / Embed Mode](https://owncloud.dev/clients/web/embed-mode/). See the environment variables: `WEB_OPTION_MODE` and `WEB_OPTION_EMBED_TARGET` to configure the embedded mode. diff --git a/services/web/pkg/config/options.go b/services/web/pkg/config/options.go index 1450d6655f5..09706f43943 100644 --- a/services/web/pkg/config/options.go +++ b/services/web/pkg/config/options.go @@ -26,8 +26,8 @@ type Options struct { AccessDeniedHelpURL string `json:"accessDeniedHelpUrl,omitempty" yaml:"accessDeniedHelpUrl" env:"WEB_OPTION_ACCESS_DENIED_HELP_URL" desc:"Specifies the target URL valid for the ocis instance for the generic logged out / access denied page."` TokenStorageLocal bool `json:"tokenStorageLocal" yaml:"tokenStorageLocal" env:"WEB_OPTION_TOKEN_STORAGE_LOCAL" desc:"Specifies whether the access token will be stored in the local storage when set to 'true' or in the session storage when set to 'false'. If stored in the local storage, login state will be persisted across multiple browser tabs, means no additional logins are required. Defaults to 'true'."` DisabledExtensions []string `json:"disabledExtensions,omitempty" yaml:"disabledExtensions" env:"WEB_OPTION_DISABLED_EXTENSIONS" desc:"Disable specific Web extensions identified by their ID. The ID can e.g. be taken from the 'index.ts' file of the web extension. Multiple ID's can be written as comma separated list like: 'com.github.owncloud.web.files.search','com.github.owncloud.web.files.print'. See the Environment Variable Types documentation for details."` - Mode string `json:"mode,omitempty" yaml:"mode" env:"WEB_OPTION_MODE" desc:"Defines the mode in which Web will be running. Currently, the only supported options are '' (empty) and 'embed'. With '' which is the default, Web will run as usual with all functionality enabled. 'embed' will enable a stripped down version of Web with reduced functionality used to integrate Web into other applications like via iFrame."` - EmbedTarget string `json:"embedTarget,omitempty" yaml:"embedTarget" env:"WEB_OPTION_EMBED_TARGET" desc:"Defines how Web is being integrated when running in 'embed' mode. Currently, the only supported options are '' (empty) and 'location'. With '' which is the default, Web will run regular as defined via the 'mode' config option. With 'location', Web will run embedded as location picker. Resource selection will be disabled and the selected resources array always includes the current folder as the only item."` + Mode string `json:"mode,omitempty" yaml:"mode" env:"WEB_OPTION_MODE" desc:"Defines the mode in which Web will be running. Currently, the only supported options are '' (empty) and 'embed'. With '' which is the default, Web will run as usual with all functionality enabled. 'embed' will enable a stripped down version of Web with reduced functionality used to integrate Web into other applications like via iFrame. See the documnetation for more details."` + EmbedTarget string `json:"embedTarget,omitempty" yaml:"embedTarget" env:"WEB_OPTION_EMBED_TARGET" desc:"Defines how Web is being integrated when running in 'embed' mode. Currently, the only supported options are '' (empty) and 'location'. With '' which is the default, Web will run regular as defined via the 'mode' config option. With 'location', Web will run embedded as location picker. Resource selection will be disabled and the selected resources array always includes the current folder as the only item. See the documnetation for more details."` } // AccountEditLink are the AccountEditLink options