mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 22:11:56 +08:00
Chore: read API info from jsBridge
This commit is contained in:
parent
dd3ce22bfd
commit
9b0bf2727c
@ -82,24 +82,24 @@ class Settings extends React.Component<I18nProps, {}> {
|
|||||||
await rootStores.store.fetchAndParseConfig()
|
await rootStores.store.fetchAndParseConfig()
|
||||||
const startAtLogin = await jsBridge.getStartAtLogin()
|
const startAtLogin = await jsBridge.getStartAtLogin()
|
||||||
const setAsSystemProxy = await jsBridge.isSystemProxySet()
|
const setAsSystemProxy = await jsBridge.isSystemProxySet()
|
||||||
|
const apiInfo = await jsBridge.getAPIInfo()
|
||||||
this.setState({
|
this.setState({
|
||||||
startAtLogin,
|
startAtLogin,
|
||||||
setAsSystemProxy,
|
setAsSystemProxy,
|
||||||
isClashX: true
|
isClashX: true,
|
||||||
|
externalControllerHost: apiInfo.host,
|
||||||
|
externalControllerPort: apiInfo.port,
|
||||||
|
externalControllerSecret: apiInfo.secret
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await rootStores.store.fetchData()
|
await rootStores.store.fetchData()
|
||||||
|
|
||||||
const config = rootStores.store.config.general
|
|
||||||
const general = rootStores.store.data.general
|
const general = rootStores.store.data.general
|
||||||
this.setState({
|
this.setState({
|
||||||
allowConnectFromLan: general.allowLan,
|
allowConnectFromLan: general.allowLan,
|
||||||
proxyMode: general.mode,
|
proxyMode: general.mode,
|
||||||
socks5ProxyPort: general.socksPort,
|
socks5ProxyPort: general.socksPort,
|
||||||
httpProxyPort: general.port,
|
httpProxyPort: general.port
|
||||||
externalControllerHost: config.externalControllerAddr,
|
|
||||||
externalControllerPort: config.externalControllerPort,
|
|
||||||
externalControllerSecret: config.secret
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,10 @@ export class JsBridge {
|
|||||||
return this.callHandler<string>('getPasteboard')
|
return this.callHandler<string>('getPasteboard')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getAPIInfo () {
|
||||||
|
return this.callHandler<{ host: string, port: string, secret: string }>('apiInfo')
|
||||||
|
}
|
||||||
|
|
||||||
public setPasteboard (data: string) {
|
public setPasteboard (data: string) {
|
||||||
return this.callHandler('setPasteboard', data)
|
return this.callHandler('setPasteboard', data)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user