diff --git a/src/components/shared/Head.tsx b/src/components/shared/Head.tsx index 5997a3a..3f2e966 100644 --- a/src/components/shared/Head.tsx +++ b/src/components/shared/Head.tsx @@ -1,18 +1,22 @@ import * as React from 'react'; import { Helmet } from 'react-helmet'; import { connect } from 'src/components/StateProvider'; -import { getClashAPIConfig } from 'src/store/app'; +import { getClashAPIConfig, getClashAPIConfigs } from 'src/store/app'; const mapState = (s) => ({ apiConfig: getClashAPIConfig(s), + apiConfigs: getClashAPIConfigs(s), }); -function HeadImpl({ apiConfig }: { apiConfig: { baseURL: string } }) { +function HeadImpl({ apiConfig, apiConfigs }: { apiConfig: { baseURL: string }, apiConfigs: any[] }) { let title = 'yacd'; - try { - title = new URL(apiConfig.baseURL).host; - } catch (e) { - // ignore + if (apiConfigs.length > 1) { + try { + const host = new URL(apiConfig.baseURL).host; + title = `${host} - yacd`; + } catch (e) { + // ignore + } } return (