mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
Proxy debugging
This commit is contained in:
@@ -5,9 +5,18 @@ import TopBar from './components/TopBar'
|
||||
|
||||
import {invoke} from '@tauri-apps/api/tauri'
|
||||
import {dataDir} from '@tauri-apps/api/path'
|
||||
import TextInput from './components/common/TextInput'
|
||||
|
||||
let proxyAddress = ''
|
||||
|
||||
async function setProxyAddress(address: string) {
|
||||
proxyAddress = address
|
||||
await invoke('set_proxy_addr', { addr: address })
|
||||
}
|
||||
|
||||
async function startProxy() {
|
||||
await invoke('connect', { port: 2222, certificatePath: await dataDir() + '\\cultivation\\ca' })
|
||||
await invoke('open_in_browser', { url: 'https://hoyoverse.com' })
|
||||
}
|
||||
|
||||
async function stopProxy() {
|
||||
@@ -18,10 +27,11 @@ async function generateCertificates() {
|
||||
await invoke('generate_ca_files', { path: await dataDir() + '\\cultivation' })
|
||||
}
|
||||
|
||||
async function generateCertInfo() {
|
||||
async function generateInfo() {
|
||||
console.log({
|
||||
certificatePath: await dataDir() + '\\cultivation\\ca',
|
||||
isAdmin: await invoke('is_elevated')
|
||||
isAdmin: await invoke('is_elevated'),
|
||||
connectingTo: proxyAddress
|
||||
})
|
||||
alert('check your dev console and send that in #cultivation')
|
||||
}
|
||||
@@ -35,10 +45,11 @@ class Debug extends React.Component<any, any>{
|
||||
return (
|
||||
<div className="App">
|
||||
<TopBar optFunc={none} downFunc={none} gameFunc={none} />
|
||||
<TextInput readOnly={false} initalValue={'change to set proxy address'} onChange={setProxyAddress} />
|
||||
<button onClick={startProxy}>start proxy</button>
|
||||
<button onClick={stopProxy}>stop proxy</button>
|
||||
<button onClick={generateCertificates}>generate certificates</button>
|
||||
<button onClick={generateCertInfo}>generate certificate info</button>
|
||||
<button onClick={generateInfo}>dump info</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user