From c9aa48ea25e4b0972accaf47d73b074827c253dd Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 4 Jan 2022 21:56:33 +0100 Subject: [PATCH] Fix (per-domain) favicon url --- client/src/layout/masthead.js | 12 +++++++++--- doc/source/admin/galaxy_options.rst | 2 +- lib/galaxy/config/sample/galaxy.yml.sample | 2 +- lib/galaxy/webapps/galaxy/config_schema.yml | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/src/layout/masthead.js b/client/src/layout/masthead.js index 247c805963c..d4142325fae 100644 --- a/client/src/layout/masthead.js +++ b/client/src/layout/masthead.js @@ -2,6 +2,7 @@ import $ from "jquery"; import Scratchbook from "layout/scratchbook"; import QuotaMeter from "mvc/user/user-quotameter"; import { getGalaxyInstance } from "app"; +import { getAppRoot } from "onload/loadConfig"; import Masthead from "../components/Masthead/Masthead"; import { mountVueComponent } from "../utils/mountVueComponent"; @@ -42,16 +43,21 @@ export class MastheadState { } } +function staticUrlToPrefixed(appRoot, url) { + return url?.startsWith("/static/") ? `${appRoot}${url}` : url; +} + export function mountMasthead(el, options, mastheadState) { + const appRoot = getAppRoot(); return mountVueComponent(Masthead)( { el: el, mastheadState: mastheadState, displayGalaxyBrand: options.display_galaxy_brand, brand: options.brand, - brandLink: options.logo_url, - brandImage: options.logo_src, - brandImageSecondary: options.logo_src_secondary, + brandLink: staticUrlToPrefixed(appRoot, options.logo_url), + brandImage: staticUrlToPrefixed(appRoot, options.logo_src), + brandImageSecondary: staticUrlToPrefixed(appRoot, options.logo_src_secondary), menuOptions: options, }, el diff --git a/doc/source/admin/galaxy_options.rst b/doc/source/admin/galaxy_options.rst index de6cfdb0961..4852c9e9456 100644 --- a/doc/source/admin/galaxy_options.rst +++ b/doc/source/admin/galaxy_options.rst @@ -1957,7 +1957,7 @@ :Description: The brand image source. -:Default: ``static/favicon.png`` +:Default: ``/static/favicon.png`` :Type: str diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index bad8e33a111..71f5500e749 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -1024,7 +1024,7 @@ galaxy: #logo_url: / # The brand image source. - #logo_src: static/favicon.png + #logo_src: /static/favicon.png # The custom brand image source. #logo_src_secondary: null diff --git a/lib/galaxy/webapps/galaxy/config_schema.yml b/lib/galaxy/webapps/galaxy/config_schema.yml index 3ae5458e5f0..6af6babf1e5 100644 --- a/lib/galaxy/webapps/galaxy/config_schema.yml +++ b/lib/galaxy/webapps/galaxy/config_schema.yml @@ -1417,7 +1417,7 @@ mapping: logo_src: type: str - default: static/favicon.png + default: /static/favicon.png required: false per_host: true desc: |