From 280542989b9cbb4309a5843146a8ec131ac8e2be Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 10 Sep 2020 09:10:38 +0200 Subject: [PATCH 1/4] Fix the default external app urls They were hardcoded to localhost:9200 instead of using the server url config. --- pkg/service/v0/service.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index 3ddf5589e8..c6535f6217 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -72,11 +72,11 @@ func (p Phoenix) getPayload() (payload []byte, err error) { p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{ { ID: "accounts", - Path: "https://localhost:9200/accounts.js", + Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "accounts.js"), }, { ID: "settings", - Path: "https://localhost:9200/settings.js", + Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "settings.js"), }, } } @@ -109,6 +109,18 @@ func (p Phoenix) getPayload() (payload []byte, err error) { return } +func singleJoiningSlash(a, b string) string { + aslash := strings.HasSuffix(a, "/") + bslash := strings.HasPrefix(b, "/") + switch { + case aslash && bslash: + return a + b[1:] + case !aslash && !bslash: + return a + "/" + b + } + return a + b +} + // Config implements the Service interface. func (p Phoenix) Config(w http.ResponseWriter, r *http.Request) { From 1c8dc0741f61916d064789b378ffcc6b4e3b34a4 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 10 Sep 2020 09:15:55 +0200 Subject: [PATCH 2/4] Add changelog --- changelog/unreleased/fix-external-app-urls | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/unreleased/fix-external-app-urls diff --git a/changelog/unreleased/fix-external-app-urls b/changelog/unreleased/fix-external-app-urls new file mode 100644 index 0000000000..139090f293 --- /dev/null +++ b/changelog/unreleased/fix-external-app-urls @@ -0,0 +1,6 @@ +Bugfix: Fix external app URLs + +The URLs for the default set of external apps was hardcoded to localhost:9200. We fixed that by using the server url from the already existing config variable. + +https://github.com/owncloud/product/issues/218 +https://github.com/owncloud/ocis-phoenix/pull/83 From c4771b0910db2e24b0d98b0783416330813f3573 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 10 Sep 2020 10:27:47 +0200 Subject: [PATCH 3/4] Change external app config to just use the paths of the js bundles --- pkg/service/v0/service.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index c6535f6217..6ff9853a6a 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -72,11 +72,11 @@ func (p Phoenix) getPayload() (payload []byte, err error) { p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{ { ID: "accounts", - Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "accounts.js"), + Path: "/accounts.js", }, { ID: "settings", - Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "settings.js"), + Path: "/settings.js", }, } } @@ -109,18 +109,6 @@ func (p Phoenix) getPayload() (payload []byte, err error) { return } -func singleJoiningSlash(a, b string) string { - aslash := strings.HasSuffix(a, "/") - bslash := strings.HasPrefix(b, "/") - switch { - case aslash && bslash: - return a + b[1:] - case !aslash && !bslash: - return a + "/" + b - } - return a + b -} - // Config implements the Service interface. func (p Phoenix) Config(w http.ResponseWriter, r *http.Request) { From 97d701ad8f70f6f9af5c69e0e3d1ce6556a742f9 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 10 Sep 2020 10:50:27 +0200 Subject: [PATCH 4/4] Fix changelog --- changelog/unreleased/fix-external-app-urls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/unreleased/fix-external-app-urls b/changelog/unreleased/fix-external-app-urls index 139090f293..4d5fbef320 100644 --- a/changelog/unreleased/fix-external-app-urls +++ b/changelog/unreleased/fix-external-app-urls @@ -1,6 +1,6 @@ Bugfix: Fix external app URLs -The URLs for the default set of external apps was hardcoded to localhost:9200. We fixed that by using the server url from the already existing config variable. +The URLs for the default set of external apps was hardcoded to localhost:9200. We fixed that by using relative paths instead. https://github.com/owncloud/product/issues/218 https://github.com/owncloud/ocis-phoenix/pull/83