emergency metadata recovery

This commit is contained in:
SpikeHD
2022-07-15 19:35:57 -07:00
parent a1b0fec871
commit bd54a78e4b
7 changed files with 88 additions and 2 deletions

View File

@@ -206,6 +206,7 @@ class App extends React.Component<IProps, IState> {
// Options menu
this.state.optionsOpen ? (
<Options
downloadManager={downloadHandler}
closeFn={() => this.setState({ optionsOpen: !this.state.optionsOpen })}
/>
) : null

View File

@@ -12,9 +12,12 @@ import * as server from '../../../utils/server'
import './Options.css'
import BigButton from '../common/BigButton'
import DownloadHandler from '../../../utils/download'
import * as meta from '../../../utils/metadata'
interface IProps {
closeFn: () => void;
downloadManager: DownloadHandler;
}
interface IState {
@@ -62,6 +65,7 @@ export default class Options extends React.Component<IProps, IState> {
this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this)
this.setCustomBackground = this.setCustomBackground.bind(this)
this.toggleEncryption = this.toggleEncryption.bind(this)
this.restoreMetadata = this.restoreMetadata.bind(this)
}
async componentDidMount() {
@@ -190,6 +194,11 @@ export default class Options extends React.Component<IProps, IState> {
})
}
async restoreMetadata() {
console.log(this.props)
await meta.restoreMetadata(this.props.downloadManager)
}
render() {
return (
<Menu closeFn={this.props.closeFn} className="Options" heading="Options">
@@ -201,6 +210,16 @@ export default class Options extends React.Component<IProps, IState> {
<DirInput onChange={this.setGameExecutable} value={this.state?.game_install_path} extensions={['exe']} />
</div>
</div>
<div className="OptionSection" id="menuOptionsContainermetaDownload">
<div className="OptionLabel" id="menuOptionsLabelmetaDownload">
<Tr text="options.recover_metadata" />
</div>
<div className="OptionValue" id="menuOptionsButtonmetaDownload">
<BigButton onClick={this.restoreMetadata} id="metaDownload">
<Tr text='components.download' />
</BigButton>
</div>
</div>
{
this.state.swag && (
<div className='OptionSection' id="menuOptionsContainerAkebi">