summaryrefslogtreecommitdiff
path: root/src/components/shared
diff options
context:
space:
mode:
authorHaishan <[email protected]>2021-02-23 21:43:07 +0800
committerGitHub <[email protected]>2021-02-23 21:43:07 +0800
commit3e50b5ba5b0c3eb2ba9b5684ecde7365fd2b5454 (patch)
treed6ee2d61a26917102aaf40b35210ee4efc7cd8a5 /src/components/shared
parentd56fd19c5e5ce304cb6e8e26eddffbb406b8cc59 (diff)
parentc52a88acafca9b9fdeed574797f61dd8868c6f37 (diff)
Merge pull request #567 from CzBiX/patch-1
Refine title style
Diffstat (limited to 'src/components/shared')
-rw-r--r--src/components/shared/Head.tsx16
1 files changed, 10 insertions, 6 deletions
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 (
<Helmet>