mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
make proxy optional
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
"language": "Select Language",
|
||||
"background": "Set Custom Background (link or image file)",
|
||||
"theme": "Set Theme",
|
||||
"patch_metadata": "Automatically Patch Metadata"
|
||||
"patch_metadata": "Automatically Patch Metadata",
|
||||
"use_proxy": "Use Internal Proxy"
|
||||
},
|
||||
"downloads": {
|
||||
"grasscutter_stable_data": "Download Grasscutter Stable Data",
|
||||
|
||||
@@ -121,8 +121,10 @@ export default class ServerLaunchSection extends React.Component<{}, IState> {
|
||||
process: proc_name || game_exe
|
||||
})
|
||||
|
||||
// Connect to proxy
|
||||
await invoke('connect', { port: 8365, certificatePath: await dataDir() + '\\cultivation\\ca' })
|
||||
if (config.use_internal_proxy) {
|
||||
// Connect to proxy
|
||||
await invoke('connect', { port: 8365, certificatePath: await dataDir() + '\\cultivation\\ca' })
|
||||
}
|
||||
|
||||
// Open server as well if the options are set
|
||||
if (config.grasscutter_with_game) {
|
||||
|
||||
@@ -32,6 +32,7 @@ interface IState {
|
||||
theme: string
|
||||
encryption: boolean
|
||||
patch_metadata: boolean
|
||||
use_internal_proxy: boolean
|
||||
swag: boolean
|
||||
|
||||
// Swag stuff
|
||||
@@ -54,6 +55,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
theme: '',
|
||||
encryption: false,
|
||||
patch_metadata: false,
|
||||
use_internal_proxy: false,
|
||||
swag: false,
|
||||
|
||||
// Swag stuff
|
||||
@@ -69,6 +71,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
this.toggleEncryption = this.toggleEncryption.bind(this)
|
||||
this.restoreMetadata = this.restoreMetadata.bind(this)
|
||||
this.toggleMetadata = this.toggleMetadata.bind(this)
|
||||
this.toggleProxy = this.toggleProxy.bind(this)
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@@ -92,6 +95,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
theme: config.theme || 'default',
|
||||
encryption: await translate(encEnabled ? 'options.enabled' : 'options.disabled'),
|
||||
patch_metadata: config.patch_metadata || false,
|
||||
use_internal_proxy: config.use_internal_proxy || false,
|
||||
swag: config.swag_mode || false,
|
||||
|
||||
// Swag stuff
|
||||
@@ -219,6 +223,16 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
})
|
||||
}
|
||||
|
||||
async toggleProxy() {
|
||||
const changedVal = !(await getConfigOption('use_internal_proxy'))
|
||||
|
||||
await setConfigOption('use_internal_proxy', changedVal)
|
||||
|
||||
this.setState({
|
||||
use_internal_proxy: changedVal,
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Menu closeFn={this.props.closeFn} className="Options" heading="Options">
|
||||
@@ -252,6 +266,18 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="OptionSection" id="menuOptionsContainerUseProxy">
|
||||
<div className="OptionLabel" id="menuOptionsLabelUseProxy">
|
||||
<Tr text="options.use_proxy" />
|
||||
</div>
|
||||
<div className="OptionValue" id="menuOptionsCheckboxUseProxy">
|
||||
<Checkbox
|
||||
onChange={this.toggleProxy}
|
||||
checked={this.state?.use_internal_proxy}
|
||||
id="useProxy"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ let defaultConfig: Configuration
|
||||
https_enabled: false,
|
||||
debug_enabled: false,
|
||||
patch_metadata: true,
|
||||
use_internal_proxy: true,
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -45,6 +46,7 @@ export interface Configuration {
|
||||
https_enabled: boolean
|
||||
debug_enabled: boolean
|
||||
patch_metadata: boolean
|
||||
use_internal_proxy: boolean
|
||||
swag_mode?: boolean
|
||||
|
||||
// Swag stuff
|
||||
|
||||
Reference in New Issue
Block a user