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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from owncloud:master #475

Merged
merged 4 commits into from
Oct 12, 2021
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"server": "https://ocis.owncloud.test",
"theme": "owncloud",
"theme": "https://ocis.owncloud.test/themes/owncloud/theme.json",
"version": "0.1.0",
"openIdConnect": {
"metadata_url": "https://ocis.owncloud.test/.well-known/openid-configuration",
Expand Down
2 changes: 1 addition & 1 deletion tests/config/drone/ocis-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"server": "https://ocis-server:9200",
"theme": "owncloud",
"theme": "https://ocis-server:9200/themes/owncloud/theme.json",
"version": "0.1.0",
"openIdConnect": {
"metadata_url": "https://ocis-server:9200/.well-known/openid-configuration",
Expand Down
2 changes: 2 additions & 0 deletions web/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type Asset struct {
// WebConfig defines the available web configuration for a dynamically rendered config.json.
type WebConfig struct {
Server string `json:"server,omitempty"`
ThemeServer string `json:"omit"` // only used to build Theme
ThemePath string `json:"omit"` // only used to build Theme
Theme string `json:"theme,omitempty"`
Version string `json:"version,omitempty"` // TODO what is version used for?
OpenIDConnect OIDC `json:"openIdConnect,omitempty"`
Expand Down
17 changes: 12 additions & 5 deletions web/pkg/flagset/flagset.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,23 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "web-config-server",
Value: flags.OverrideDefaultString(cfg.Web.Config.Server, "https://localhost:9200"),
Usage: "Server URL",
Usage: "Configuration server URL",
EnvVars: []string{"WEB_UI_CONFIG_SERVER", "OCIS_URL"}, // WEB_UI_CONFIG_SERVER takes precedence over OCIS_URL
Destination: &cfg.Web.Config.Server,
},
&cli.StringFlag{
Name: "web-theme-server",
Value: flags.OverrideDefaultString(cfg.Web.Config.ThemeServer, "https://localhost:9200"),
Usage: "Theme server URL",
EnvVars: []string{"WEB_UI_THEME_SERVER", "OCIS_URL"}, // WEB_UI_THEME_SERVER takes precedence over OCIS_URL
Destination: &cfg.Web.Config.ThemeServer,
},
&cli.StringFlag{
Name: "web-config-theme",
Value: flags.OverrideDefaultString(cfg.Web.Config.Theme, "owncloud"),
Usage: "Theme",
EnvVars: []string{"WEB_UI_CONFIG_THEME"},
Destination: &cfg.Web.Config.Theme,
Value: flags.OverrideDefaultString(cfg.Web.Config.ThemePath, "/themes/owncloud/theme.json"),
Usage: "Theme path on the theme server",
EnvVars: []string{"WEB_UI_THEME_PATH"},
Destination: &cfg.Web.Config.ThemePath,
},
&cli.StringFlag{
Name: "web-config-version",
Expand Down
8 changes: 8 additions & 0 deletions web/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"time"
Expand Down Expand Up @@ -69,6 +70,13 @@ func (p Web) getPayload() (payload []byte, err error) {
p.config.Web.Config.Options["hideSearchBar"] = true
}

// build theme url
if themeServer, err := url.Parse(p.config.Web.Config.ThemeServer); err == nil {
p.config.Web.Config.Theme = themeServer.String() + p.config.Web.Config.ThemePath
} else {
p.config.Web.Config.Theme = p.config.Web.Config.ThemePath
}

if p.config.Web.Config.ExternalApps == nil {
p.config.Web.Config.ExternalApps = []config.ExternalApp{
{
Expand Down