diff --git a/src/containers/Settings/index.tsx b/src/containers/Settings/index.tsx index 3d3ff78..ce719a1 100644 --- a/src/containers/Settings/index.tsx +++ b/src/containers/Settings/index.tsx @@ -7,7 +7,7 @@ import { Header, Card, Switch, ButtonSelect, type ButtonSelectOptions, Input, Se import { type Lang } from '@i18n' import { useObject } from '@lib/hook' import { jsBridge } from '@lib/jsBridge' -import { useI18n, useClashXData, useGeneral, useVersion, useClient, identityAtom, hostSelectIdxStorageAtom, hostsStorageAtom } from '@stores' +import { useI18n, useClashXData, useGeneral, useVersion, useClient, identityAtom, hostSelectIdxStorageAtom, hostsStorageAtom, useAPIInfo } from '@stores' import './style.scss' const languageOptions: ButtonSelectOptions[] = [{ label: '中文', value: 'zh_CN' }, { label: 'English', value: 'en_US' }] @@ -19,6 +19,7 @@ export default function Settings () { const setIdentity = useSetAtom(identityAtom) const [hostSelectIdx, setHostSelectIdx] = useAtom(hostSelectIdxStorageAtom) const hostsStorage = useAtomValue(hostsStorageAtom) + const apiInfo = useAPIInfo() const { translation, setLang, lang } = useI18n() const { t } = translation('Settings') const client = useClient() @@ -73,6 +74,11 @@ export default function Settings () { await fetchGeneral() } + const { + hostname: externalControllerHost, + port: externalControllerPort, + } = apiInfo + const { allowLan, mode } = general const startAtLogin = clashXData?.startAtLogin ?? false @@ -95,6 +101,24 @@ export default function Settings () { (h, idx) => ({ value: idx, label: {h.hostname} }), ) + const controllers = isClashX + ? {`${externalControllerHost}:${externalControllerPort}`} + : ( + <> + setHostSelectIdx(idx)} - /> - !isClashX && setIdentity(false)}> - 编辑 - + { controllers }