import lbry from '../lbry.js'; import React from 'react'; import {FormField} from '../component/form.js'; import Link from '../component/link'; const fs = require('fs'); const {ipcRenderer} = require('electron'); const DeveloperPage = React.createClass({ getInitialState: function() { return { showDeveloperMenu: lbry.getClientSetting('showDeveloperMenu'), useCustomLighthouseServers: lbry.getClientSetting('useCustomLighthouseServers'), customLighthouseServers: lbry.getClientSetting('customLighthouseServers').join('\n'), upgradePath: '', }; }, handleShowDeveloperMenuChange: function(event) { lbry.setClientSetting('showDeveloperMenu', event.target.checked); lbry.showMenuIfNeeded(); this.setState({ showDeveloperMenu: event.target.checked, }); }, handleUseCustomLighthouseServersChange: function(event) { lbry.setClientSetting('useCustomLighthouseServers', event.target.checked); this.setState({ useCustomLighthouseServers: event.target.checked, }); }, handleUpgradeFileChange: function(event) { this.setState({ upgradePath: event.target.files[0].path, }); }, handleForceUpgradeClick: function() { let upgradeSent = false; if (!this.state.upgradePath) { alert('Please select a file to upgrade from'); } else { try { const stats = fs.lstatSync(this.state.upgradePath); if (stats.isFile()) { console.log('Starting upgrade using ' + this.state.upgradePath); ipcRenderer.send('upgrade', this.state.upgradePath); upgradeSent = true; } } catch (e) {} if (!upgradeSent) { alert('Failed to start upgrade. Is "' + this.state.upgradePath + '" a valid path to the upgrade?'); } } }, render: function() { return (

Developer Settings

{this.state.useCustomLighthouseServers ?
: null}
 
); } }); export default DeveloperPage;