diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index fa75548f..76ea0f76 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -1282,11 +1282,7 @@ export class WindowHandler { ...userConfig, ...filteredConfig, }; - const host = parse( - this.url - ? this.url - : (userConfig as IConfig).url || (globalConfig as IConfig).url, - ); + const host = parse(this.startUrl); const aboutInfo = { userConfig, globalConfig, diff --git a/src/renderer/components/about-app.tsx b/src/renderer/components/about-app.tsx index 71802f17..7b0c1c17 100644 --- a/src/renderer/components/about-app.tsx +++ b/src/renderer/components/about-app.tsx @@ -1,6 +1,7 @@ import classNames from 'classnames'; import { ipcRenderer } from 'electron'; import * as React from 'react'; +import { parse } from 'url'; import { productName } from '../../../package.json'; import { IConfig } from '../../app/config-handler'; import { apiCmds, apiName } from '../../common/api-interface'; @@ -11,8 +12,8 @@ import * as SymphonyLogo from '../../renderer/assets/new-symphony-logo.svg'; const HOSTNAME_REGEX = /^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; interface IState { - userConfig: object; - globalConfig: object; + userConfig: IConfig; + globalConfig: IConfig; cloudConfig: object; finalConfig: IConfig; appName: string; @@ -69,8 +70,8 @@ export default class AboutApp extends React.Component<{}, IState> { super(props); this.closeButtonRef = React.createRef(); this.state = { - userConfig: {}, - globalConfig: {}, + userConfig: {} as IConfig, + globalConfig: {} as IConfig, cloudConfig: {}, finalConfig: {} as IConfig, appName: 'Symphony', @@ -144,15 +145,13 @@ export default class AboutApp extends React.Component<{}, IState> { value: `${formattedSfeVersion} ${client}`, }, ]; - const finalConfig = this.state.finalConfig?.url - ?.replace(/https:\/\//g, '') - ?.split('/')[0]; - const updatedHostname = this.state.updatedHostname - ?.replace(/https:\/\//g, '') - ?.split('/')[0]; - const isHostNamechanged = - finalConfig && updatedHostname && finalConfig !== updatedHostname; - const closeButtonText = isHostNamechanged + const userConfigHostName = parse( + this.state.userConfig?.url || this.state.globalConfig?.url || '', + ).hostname; + const isHostNameChanged = + this.previousUrl !== this.state.updatedHostname && + userConfigHostName !== this.state.updatedHostname; + const closeButtonText = isHostNameChanged ? i18n.t('Save and Restart', ABOUT_SYMPHONY_NAMESPACE)() : i18n.t('Close', ABOUT_SYMPHONY_NAMESPACE)(); const cancelText = i18n.t('Cancel', ABOUT_SYMPHONY_NAMESPACE)(); @@ -199,7 +198,7 @@ export default class AboutApp extends React.Component<{}, IState> { {this.state.isPodEditing && (