summaryrefslogtreecommitdiff
path: root/src/components/shared
diff options
context:
space:
mode:
authorCzBiX <[email protected]>2021-02-23 19:49:20 +0800
committerCzBiX <[email protected]>2021-02-23 20:23:46 +0800
commitc52a88acafca9b9fdeed574797f61dd8868c6f37 (patch)
treed6ee2d61a26917102aaf40b35210ee4efc7cd8a5 /src/components/shared
parentd56fd19c5e5ce304cb6e8e26eddffbb406b8cc59 (diff)
Refine title style
Only show backend host when there are multiple backends.
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>