blob: 16224731dc1203d6b8b9a17adb37f23f61c5719d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import * as React from 'react';
import { connect } from 'src/components/StateProvider';
import { getClashAPIConfig, getClashAPIConfigs } from 'src/store/app';
const mapState = (s) => ({
apiConfig: getClashAPIConfig(s),
apiConfigs: getClashAPIConfigs(s),
});
function HeadImpl({
apiConfig,
apiConfigs,
}: {
apiConfig: { baseURL: string };
apiConfigs: any[];
}) {
React.useEffect(() => {
let title = 'yacd';
if (apiConfigs.length > 1) {
try {
const host = new URL(apiConfig.baseURL).host;
title = `${host} - yacd`;
} catch (e) {
// ignore
}
}
document.title = title;
});
return <></>;
}
export const Head = connect(mapState)(HeadImpl);
|