2016-12-29 10:23:28 +01:00
|
|
|
import lbry from '../lbry.js';
|
|
|
|
import React from 'react';
|
|
|
|
import FormField from '../component/form.js';
|
|
|
|
|
|
|
|
const DeveloperPage = React.createClass({
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2017-03-09 00:14:43 +01:00
|
|
|
showDeveloperMenu: lbry.getClientSetting('showDeveloperMenu'),
|
2016-12-29 10:23:28 +01:00
|
|
|
useCustomLighthouseServers: lbry.getClientSetting('useCustomLighthouseServers'),
|
|
|
|
customLighthouseServers: lbry.getClientSetting('customLighthouseServers').join('\n'),
|
|
|
|
};
|
|
|
|
},
|
2017-03-08 09:56:34 +01:00
|
|
|
handleShowDeveloperMenuChange: function(event) {
|
2017-03-09 00:14:43 +01:00
|
|
|
lbry.setClientSetting('showDeveloperMenu', event.target.checked);
|
2017-03-08 09:56:34 +01:00
|
|
|
lbry.showMenuIfNeeded();
|
2016-12-29 10:23:28 +01:00
|
|
|
this.setState({
|
2017-03-08 09:56:34 +01:00
|
|
|
showDeveloperMenu: event.target.checked,
|
2016-12-29 10:23:28 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
handleUseCustomLighthouseServersChange: function(event) {
|
|
|
|
lbry.setClientSetting('useCustomLighthouseServers', event.target.checked);
|
|
|
|
this.setState({
|
|
|
|
useCustomLighthouseServers: event.target.checked,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<main>
|
|
|
|
<section className="card">
|
|
|
|
<h3>Developer Settings</h3>
|
|
|
|
<div className="form-row">
|
2017-03-08 09:56:34 +01:00
|
|
|
<label><FormField type="checkbox" onChange={this.handleShowDeveloperMenuChange} checked={this.state.showDeveloperMenu} /> Show developer menu</label>
|
2016-12-29 10:23:28 +01:00
|
|
|
</div>
|
|
|
|
<div className="form-row">
|
|
|
|
<label><FormField type="checkbox" onChange={this.handleUseCustomLighthouseServersChange} checked={this.state.useCustomLighthouseServers} /> Use custom search servers</label>
|
|
|
|
</div>
|
|
|
|
{this.state.useCustomLighthouseServers
|
|
|
|
? <div className="form-row">
|
|
|
|
<label>
|
|
|
|
Custom search servers (one per line)
|
|
|
|
<div><FormField type="textarea" className="developer-page__custom-lighthouse-servers" value={this.state.customLighthouseServers} onChange={this.handleCustomLighthouseServersChange} checked={this.state.debugMode} /></div>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
: null}
|
|
|
|
</section>
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default DeveloperPage;
|