mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-04 09:25:16 +01:00
make metadata optional
This commit is contained in:
@@ -23,7 +23,8 @@
|
|||||||
"grasscutter_with_game": "Automatically launch Grasscutter with game",
|
"grasscutter_with_game": "Automatically launch Grasscutter with game",
|
||||||
"language": "Select Language",
|
"language": "Select Language",
|
||||||
"background": "Set Custom Background (link or image file)",
|
"background": "Set Custom Background (link or image file)",
|
||||||
"theme": "Set Theme"
|
"theme": "Set Theme",
|
||||||
|
"patch_metadata": "Automatically Patch Metadata"
|
||||||
},
|
},
|
||||||
"downloads": {
|
"downloads": {
|
||||||
"grasscutter_stable_data": "Download Grasscutter Stable Data",
|
"grasscutter_stable_data": "Download Grasscutter Stable Data",
|
||||||
|
|||||||
@@ -100,11 +100,13 @@ export default class ServerLaunchSection extends React.Component<{}, IState> {
|
|||||||
|
|
||||||
// Connect to proxy
|
// Connect to proxy
|
||||||
if (config.toggle_grasscutter) {
|
if (config.toggle_grasscutter) {
|
||||||
const patched = await patchGame()
|
if (config.patch_metadata) {
|
||||||
|
const patched = await patchGame()
|
||||||
|
|
||||||
if (!patched) {
|
if (!patched) {
|
||||||
alert('Could not patch game!')
|
alert('Could not patch game!')
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const game_exe = await getGameExecutable()
|
const game_exe = await getGameExecutable()
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ interface IState {
|
|||||||
themes: string[]
|
themes: string[]
|
||||||
theme: string
|
theme: string
|
||||||
encryption: boolean
|
encryption: boolean
|
||||||
|
patch_metadata: boolean
|
||||||
swag: boolean
|
swag: boolean
|
||||||
|
|
||||||
// Swag stuff
|
// Swag stuff
|
||||||
@@ -52,6 +53,7 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
themes: ['default'],
|
themes: ['default'],
|
||||||
theme: '',
|
theme: '',
|
||||||
encryption: false,
|
encryption: false,
|
||||||
|
patch_metadata: false,
|
||||||
swag: false,
|
swag: false,
|
||||||
|
|
||||||
// Swag stuff
|
// Swag stuff
|
||||||
@@ -66,6 +68,7 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
this.setCustomBackground = this.setCustomBackground.bind(this)
|
this.setCustomBackground = this.setCustomBackground.bind(this)
|
||||||
this.toggleEncryption = this.toggleEncryption.bind(this)
|
this.toggleEncryption = this.toggleEncryption.bind(this)
|
||||||
this.restoreMetadata = this.restoreMetadata.bind(this)
|
this.restoreMetadata = this.restoreMetadata.bind(this)
|
||||||
|
this.toggleMetadata = this.toggleMetadata.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
@@ -88,6 +91,7 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
themes: (await getThemeList()).map((t) => t.name),
|
themes: (await getThemeList()).map((t) => t.name),
|
||||||
theme: config.theme || 'default',
|
theme: config.theme || 'default',
|
||||||
encryption: await translate(encEnabled ? 'options.enabled' : 'options.disabled'),
|
encryption: await translate(encEnabled ? 'options.enabled' : 'options.disabled'),
|
||||||
|
patch_metadata: config.patch_metadata || false,
|
||||||
swag: config.swag_mode || false,
|
swag: config.swag_mode || false,
|
||||||
|
|
||||||
// Swag stuff
|
// Swag stuff
|
||||||
@@ -205,6 +209,16 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async toggleMetadata() {
|
||||||
|
const changedVal = !(await getConfigOption('patch_metadata'))
|
||||||
|
|
||||||
|
await setConfigOption('patch_metadata', changedVal)
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
patch_metadata: changedVal,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Menu closeFn={this.props.closeFn} className="Options" heading="Options">
|
<Menu closeFn={this.props.closeFn} className="Options" heading="Options">
|
||||||
@@ -226,6 +240,21 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
</BigButton>
|
</BigButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="OptionSection" id="menuOptionsContainerPatchMeta">
|
||||||
|
<div className="OptionLabel" id="menuOptionsLabelPatchMeta">
|
||||||
|
<Tr text="options.patch_metadata" />
|
||||||
|
</div>
|
||||||
|
<div className="OptionValue" id="menuOptionsCheckboxPatchMeta">
|
||||||
|
<Checkbox
|
||||||
|
onChange={this.toggleMetadata}
|
||||||
|
checked={this.state?.patch_metadata}
|
||||||
|
id="patchMeta"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Divider />
|
||||||
|
|
||||||
<div className='OptionSection' id="menuOptionsContainerGCJar">
|
<div className='OptionSection' id="menuOptionsContainerGCJar">
|
||||||
<div className='OptionLabel' id="menuOptionsLabelGCJar">
|
<div className='OptionLabel' id="menuOptionsLabelGCJar">
|
||||||
<Tr text="options.grasscutter_jar" />
|
<Tr text="options.grasscutter_jar" />
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ let defaultConfig: Configuration
|
|||||||
cert_generated: false,
|
cert_generated: false,
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
https_enabled: false,
|
https_enabled: false,
|
||||||
debug_enabled: false
|
debug_enabled: false,
|
||||||
|
patch_metadata: true,
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ export interface Configuration {
|
|||||||
theme: string
|
theme: string
|
||||||
https_enabled: boolean
|
https_enabled: boolean
|
||||||
debug_enabled: boolean
|
debug_enabled: boolean
|
||||||
|
patch_metadata: boolean
|
||||||
swag_mode?: boolean
|
swag_mode?: boolean
|
||||||
|
|
||||||
// Swag stuff
|
// Swag stuff
|
||||||
@@ -60,7 +62,7 @@ export async function getConfigOption<K extends keyof Configuration>(key: K): Pr
|
|||||||
const config = await getConfig()
|
const config = await getConfig()
|
||||||
const defaults = defaultConfig
|
const defaults = defaultConfig
|
||||||
|
|
||||||
return config[key] || defaults[key]
|
return config[key] === null || config[key] === undefined ? defaults[key] : config[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getConfig() {
|
export async function getConfig() {
|
||||||
|
|||||||
Reference in New Issue
Block a user