diff --git a/README.md b/README.md index 395cad2856..1f03a206bc 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ instantiated once for the [GSA application](./src/web/app.js#L53) | [timeout](#timeout) | Integer | [300000; // 5 minutes](./src/gmp/gmpsettings.js#L28) | x | - | | [vendorVersion](#vendorversion) | String | undefined | - | x | | [vendorLabel](#vendorlabel) | String | undefined | - | x | - +| [title](#title) | String | Greenbone Security Assistant | x | x | #### vendorVersion Allows to adjust the shown product version string at the Login and About pages. @@ -259,6 +259,10 @@ Allows to adjust the product info image at the Login page. It must be a relative path e.g. `foo.png`. The path will be mapped to `$INSTALL_PREFIX/share/gvm/gsad/web/img/` on production (with [gsad]) and `gsa/public/img` for the [development server](#developing). +#### title + +Allows to adjust the HTML title, i.e. the text shown in browser tabs which have GSA open. + #### guestUsername and guestPassword Both settings allow to login with a single click. This user has to be set up diff --git a/index.html b/index.html index 9dac9d0087..98e1488de0 100644 --- a/index.html +++ b/index.html @@ -15,17 +15,17 @@ window.addEventListener('DOMContentLoaded', () => { try { const vendorLabel = config.vendorLabel; + const title = config.title - const match = vendorLabel.match(/gsm-(\w+)_label\.svg/); + const match = vendorLabel?.match(/gsm-(\w+)_label\.svg/); if (match) { let labelPart = match[1]; if (isNaN(labelPart)) { labelPart = labelPart.toUpperCase(); } - const pageTitle = `Greenbone - ${labelPart}`; - document.title = pageTitle; + document.title = `${title} - ${labelPart}`; } else { - document.title = 'Greenbone Security Assistant'; + document.title = title; } } catch (error) {} }); diff --git a/src/gmp/gmpsettings.js b/src/gmp/gmpsettings.js index cd293ac43e..f0e426c977 100644 --- a/src/gmp/gmpsettings.js +++ b/src/gmp/gmpsettings.js @@ -13,6 +13,7 @@ export const DEFAULT_PROTOCOLDOC_URL = `https://docs.greenbone.net/API/GMP/gmp-2 export const DEFAULT_REPORT_RESULTS_THRESHOLD = 25000; export const DEFAULT_LOG_LEVEL = 'warn'; export const DEFAULT_TIMEOUT = 300000; // 5 minutes +export const DEFAULT_TITLE = 'Greenbone Security Assistant' const set = (storage, name, value) => { if (isDefined(value)) { @@ -62,6 +63,7 @@ class GmpSettings { timeout = DEFAULT_TIMEOUT, vendorVersion, vendorLabel, + title = DEFAULT_TITLE } = options; let { apiProtocol = protocol, @@ -105,6 +107,7 @@ class GmpSettings { this.reloadIntervalInactive = reloadIntervalInactive; this.reportResultsThreshold = reportResultsThreshold; this.timeout = timeout; + this.title = title setAndFreeze(this, 'apiProtocol', apiProtocol); setAndFreeze(this, 'apiServer', apiServer);