From 7cb30943058d7fd2f2dc7135ff753a219a301391 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Mon, 3 May 2021 16:51:50 -0500 Subject: [PATCH] Update prettier/eslint --- .eslintrc.json | 1 + public/electron.js | 37 ++------ src/App.jsx | 69 ++++---------- .../ApplicationBusy/ApplicationBusy.js | 13 +-- .../DependencyList/DependencyList.js | 6 +- src/components/ErrorDetails/ErrorDetails.js | 3 +- src/components/InfoDetails/InfoDetails.js | 7 +- .../NewReleases/NewRelease/NewRelease.jsx | 30 ++---- src/components/NewReleases/NewReleases.jsx | 3 +- .../ReleaseVersionDisplay.js | 28 ++---- src/components/UI/Box/Box.js | 5 +- src/components/UI/DropDown/DropDown.js | 6 +- src/components/UI/Grid/Grid.js | 19 +--- src/components/UI/Loading/Loading.js | 7 +- src/components/UpgradeUI/UpgradeUI.js | 13 +-- src/components/YesNo/YesNo.js | 4 +- src/constants.js | 12 +-- src/containers/AddEditHost/AddEditHost.js | 50 ++-------- src/containers/AddMount/AddMount.js | 38 ++------ src/containers/Configuration/Configuration.js | 60 +++--------- .../ConfigurationItem/ConfigurationItem.js | 4 +- src/containers/HostList/Host/Host.js | 28 +++--- src/containers/HostList/HostList.js | 7 +- .../MountItems/MountItem/MountItem.js | 48 ++-------- src/containers/MountItems/MountItems.js | 93 +++++------------- src/containers/PinnedManager/PinnedManager.js | 26 ++--- .../SelectAppPlatform/SelectAppPlatform.js | 21 ++--- src/containers/SkynetExport/SkynetExport.js | 37 ++------ .../SkynetImport/ImportList/ImportList.js | 6 +- src/containers/SkynetImport/SkynetImport.js | 29 ++---- src/containers/UI/Password/Password.js | 26 +---- src/helpers.js | 94 ++++--------------- src/helpers.test.js | 5 +- src/index.js | 4 +- src/redux/actions/download_actions.js | 50 ++-------- src/redux/actions/host_actions.js | 14 +-- src/redux/actions/install_actions.js | 79 +++++----------- src/redux/actions/mount_actions.js | 29 ++---- src/redux/actions/release_version_actions.js | 55 +++-------- src/redux/reducers/error_reducer.js | 13 +-- src/redux/reducers/mount_reducer.js | 4 +- src/renderer/ipc/ConfigIPC.js | 21 +---- src/renderer/ipc/DependencyIPC.js | 29 +++--- src/renderer/ipc/MountsIPC.js | 34 +------ src/renderer/ipc/PinnedIPC.js | 25 +---- src/renderer/ipc/PlatformIPC.js | 33 +++---- src/renderer/ipc/ReleaseIPC.js | 8 +- src/renderer/ipc/SkynetIPC.js | 7 +- src/renderer/ipc/StateIPC.js | 8 +- src/renderer/ipc/UpgradeIPC.js | 14 +-- src/serviceWorker.js | 8 +- src/utils.jsx | 10 +- 52 files changed, 312 insertions(+), 968 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 1f9f7c0..5d26c2d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,5 @@ { + "root":true, "env": { "browser": true, "es2021": true, diff --git a/public/electron.js b/public/electron.js index 95686f0..7d4c2ec 100644 --- a/public/electron.js +++ b/public/electron.js @@ -1,12 +1,4 @@ -const { - app, - BrowserWindow, - dialog, - ipcMain, - Menu, - nativeImage, - Tray, -} = require('electron'); +const { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, Tray } = require('electron'); const AutoLaunch = require('auto-launch'); const Constants = require('../src/constants'); const fs = require('fs'); @@ -44,8 +36,8 @@ const UpgradeIPC = require('../src/renderer/ipc/UpgradeIPC'); const platform = os.platform(); const dimensions = { - height: platform === "win32" || platform === "darwin" ? 420 : 400, - width: platform === "win32" ? 468 : 628 + height: platform === 'win32' || platform === 'darwin' ? 420 : 400, + width: platform === 'win32' ? 468 : 628, }; let isShutdown = false; @@ -146,9 +138,7 @@ const createWindow = () => { platform === 'win32' ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) : platform === 'darwin' - ? path.resolve( - path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui') - ) + ? path.resolve(path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui')) : process.env.APPIMAGE; const autoLauncher = new AutoLaunch({ @@ -206,10 +196,7 @@ const createWindow = () => { ]); const image = nativeImage.createFromPath( - path.join( - __dirname, - platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png' - ) + path.join(__dirname, platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png') ); mainWindowTray = new Tray(image); @@ -232,10 +219,7 @@ const getMainWindow = () => { }; const loadUiSettings = () => { - const settingFile = path.join( - helpers.resolvePath(Constants.DATA_LOCATIONS[platform]), - 'ui.json' - ); + const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[platform]), 'ui.json'); try { if (fs.statSync(settingFile).isFile()) { const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8')); @@ -271,17 +255,12 @@ const setTrayImage = (driveInUse) => { image = nativeImage.createFromPath( path.join( __dirname, - platform === 'darwin' - ? '../build/logo_both_mac.png' - : '../build/logo_both.png' + platform === 'darwin' ? '../build/logo_both_mac.png' : '../build/logo_both.png' ) ); } else { image = nativeImage.createFromPath( - path.join( - __dirname, - platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png' - ) + path.join(__dirname, platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png') ); } mainWindowTray.setImage(image); diff --git a/src/App.jsx b/src/App.jsx index 239845e..e5b95b8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -20,18 +20,12 @@ import { setNewReleasesAvailable, } from './redux/actions/release_version_actions'; import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay'; -import { - displaySelectAppPlatform, - saveState, -} from './redux/actions/common_actions'; +import { displaySelectAppPlatform, saveState } from './redux/actions/common_actions'; import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform'; import Text from './components/UI/Text/Text'; import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon'; import UpgradeUI from './components/UpgradeUI/UpgradeUI'; -import { - loadReleases, - setDismissUIUpgrade, -} from './redux/actions/release_version_actions'; +import { loadReleases, setDismissUIUpgrade } from './redux/actions/release_version_actions'; import YesNo from './components/YesNo/YesNo'; import { createModalConditionally } from './utils.jsx'; import SkynetImport from './containers/SkynetImport/SkynetImport'; @@ -106,8 +100,7 @@ class App extends IPCContainer { !this.props.DownloadActive && selectedVersion !== 'unavailable' && selectedVersion !== this.props.InstalledVersion; - const missingDependencies = - this.props.MissingDependencies.length > 0 && this.props.AllowMount; + const missingDependencies = this.props.MissingDependencies.length > 0 && this.props.AllowMount; const allowMount = this.props.AllowMount && @@ -142,9 +135,7 @@ class App extends IPCContainer { !this.props.RebootRequired; const showPinnedManager = - !missingDependencies && - !this.props.RebootRequired && - this.props.DisplayPinnedManager; + !missingDependencies && !this.props.RebootRequired && this.props.DisplayPinnedManager; const showUpgrade = this.props.UpgradeAvailable && @@ -214,18 +205,12 @@ class App extends IPCContainer { remoteSupported={remoteSupported} /> ); - const addEditHostDisplay = createModalConditionally( - showAddEditHost, - - ); + const addEditHostDisplay = createModalConditionally(showAddEditHost, ); const pinnedManagerDisplay = createModalConditionally( showPinnedManager, ); - const confirmDisplay = createModalConditionally( - this.props.DisplayConfirmYesNo, - - ); + const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, ); const dependencyDisplay = createModalConditionally( showDependencies, , @@ -238,24 +223,10 @@ class App extends IPCContainer { false, true ); - const errorDisplay = createModalConditionally( - this.props.DisplayError, - , - true - ); - const infoDisplay = createModalConditionally( - this.props.DisplayInfo, - , - true - ); - const newReleasesDisplay = createModalConditionally( - showNewReleases, - - ); - const rebootDisplay = createModalConditionally( - this.props.RebootRequired, - - ); + const errorDisplay = createModalConditionally(this.props.DisplayError, , true); + const infoDisplay = createModalConditionally(this.props.DisplayInfo, , true); + const newReleasesDisplay = createModalConditionally(showNewReleases, ); + const rebootDisplay = createModalConditionally(this.props.RebootRequired, ); const selectAppPlatformDisplay = createModalConditionally( this.props.DisplaySelectAppPlatform, @@ -294,10 +265,7 @@ class App extends IPCContainer { rowSpan={'17'} key={'md_' + key++} dxStyle={{ padding: 'var(--default_spacing)' }}> - + ); if (allowMount) { @@ -349,8 +317,7 @@ class App extends IPCContainer { 0) + (this.props.UpgradeAvailable || this.props.NewReleasesAvailable2.length > 0) } newReleases={ !missingDependencies && @@ -428,16 +395,12 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - displaySelectAppPlatform: (display) => - dispatch(displaySelectAppPlatform(display)), + displaySelectAppPlatform: (display) => dispatch(displaySelectAppPlatform(display)), loadReleases: () => dispatch(loadReleases()), - notifyError: (msg, critical, callback) => - dispatch(notifyError(msg, critical, callback)), + notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), saveState: () => dispatch(saveState()), - setDismissNewReleasesAvailable: (dismiss) => - dispatch(setDismissNewReleasesAvailable(dismiss)), - setNewReleasesAvailable: (items) => - dispatch(setNewReleasesAvailable(items)), + setDismissNewReleasesAvailable: (dismiss) => dispatch(setDismissNewReleasesAvailable(dismiss)), + setNewReleasesAvailable: (items) => dispatch(setNewReleasesAvailable(items)), setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)), }; }; diff --git a/src/components/ApplicationBusy/ApplicationBusy.js b/src/components/ApplicationBusy/ApplicationBusy.js index 0e2b83b..67c5297 100644 --- a/src/components/ApplicationBusy/ApplicationBusy.js +++ b/src/components/ApplicationBusy/ApplicationBusy.js @@ -7,22 +7,13 @@ import PropTypes from 'prop-types'; const ApplicationBusy = ({ title }) => { return ( - +
- +
); diff --git a/src/components/DependencyList/DependencyList.js b/src/components/DependencyList/DependencyList.js index 33eb089..aaac2eb 100644 --- a/src/components/DependencyList/DependencyList.js +++ b/src/components/DependencyList/DependencyList.js @@ -18,10 +18,8 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - downloadItem: (name, type, url, isWinFSP) => - dispatch(downloadItem(name, type, url, isWinFSP)), - setDismissDependencies: (dismiss) => - dispatch(setDismissDependencies(dismiss)), + downloadItem: (name, type, url, isWinFSP) => dispatch(downloadItem(name, type, url, isWinFSP)), + setDismissDependencies: (dismiss) => dispatch(setDismissDependencies(dismiss)), }; }; diff --git a/src/components/ErrorDetails/ErrorDetails.js b/src/components/ErrorDetails/ErrorDetails.js index 3ddc04e..19e8394 100644 --- a/src/components/ErrorDetails/ErrorDetails.js +++ b/src/components/ErrorDetails/ErrorDetails.js @@ -7,8 +7,7 @@ import './ErrorDetails.css'; const mapStateToProps = (state) => { return { - ErrorMessage: - state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '', + ErrorMessage: state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '', }; }; diff --git a/src/components/InfoDetails/InfoDetails.js b/src/components/InfoDetails/InfoDetails.js index da94625..168d9e3 100644 --- a/src/components/InfoDetails/InfoDetails.js +++ b/src/components/InfoDetails/InfoDetails.js @@ -8,8 +8,7 @@ import { promptLocationAndSaveFile } from '../../utils'; const mapStateToProps = (state) => { return { - InfoMessage: - state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '', + InfoMessage: state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '', }; }; @@ -75,9 +74,7 @@ export default connect( clicked={() => { if ( promptLocationAndSaveFile( - props.InfoMessage.fileName + - '.' + - props.InfoMessage.extension, + props.InfoMessage.fileName + '.' + props.InfoMessage.extension, msg, props.notifyError ) diff --git a/src/components/NewReleases/NewRelease/NewRelease.jsx b/src/components/NewReleases/NewRelease/NewRelease.jsx index 95e7b75..6822e9a 100644 --- a/src/components/NewReleases/NewRelease/NewRelease.jsx +++ b/src/components/NewReleases/NewRelease/NewRelease.jsx @@ -2,10 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import * as Constants from '../../../constants'; import Button from '../../UI/Button/Button'; -import { - formatLinesForDisplay, - getChangesForRepertoryVersion, -} from '../../../utils.jsx'; +import { formatLinesForDisplay, getChangesForRepertoryVersion } from '../../../utils.jsx'; import { notifyError, notifyInfo } from '../../../redux/actions/error_actions'; import { setActiveRelease } from '../../../redux/actions/release_version_actions'; import { unmountAll } from '../../../redux/actions/mount_actions'; @@ -19,8 +16,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - setActiveRelease: (release, version) => - dispatch(setActiveRelease(release, version)), + setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)), notifyError: (msg) => dispatch(notifyError(msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), unmountAll: (completedCallback) => dispatch(unmountAll(completedCallback)), @@ -42,21 +38,17 @@ export default connect( setActiveRelease, unmountAll, }) => { - const title = - '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display; + const title = '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display; const displayChanges = async () => { try { - const lines = await getChangesForRepertoryVersion( - release.VersionString - ); + const lines = await getChangesForRepertoryVersion(release.VersionString); notifyInfo(title, formatLinesForDisplay(lines)); } catch (e) { notifyError(e); } }; - const isActiveRelease = - release.Release === ActiveRelease && release.Version === ActiveVersion; + const isActiveRelease = release.Release === ActiveRelease && release.Version === ActiveVersion; const setReleaseAndVersion = () => { dismiss(); unmountAll(() => { @@ -72,9 +64,7 @@ export default connect( - @@ -83,17 +73,13 @@ export default connect( {!isActiveRelease ? ( - ) : null} - {lastItem ? null : ( - - )} + {lastItem ? null : } diff --git a/src/components/NewReleases/NewReleases.jsx b/src/components/NewReleases/NewReleases.jsx index e0bf920..e11b900 100644 --- a/src/components/NewReleases/NewReleases.jsx +++ b/src/components/NewReleases/NewReleases.jsx @@ -14,8 +14,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - dismissNewReleasesAvailable: () => - dispatch(setDismissNewReleasesAvailable(true)), + dismissNewReleasesAvailable: () => dispatch(setDismissNewReleasesAvailable(true)), }; }; diff --git a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js index f8dde2b..c9c4401 100644 --- a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js +++ b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js @@ -30,10 +30,8 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - downloadItem: (name, type, urls) => - dispatch(downloadItem(name, type, urls)), - setActiveRelease: (release, version) => - dispatch(setActiveRelease(release, version)), + downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)), + setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)), }; }; @@ -44,9 +42,7 @@ export default connect( const getSelectedVersion = () => { return props.ReleaseVersion === -1 ? 'unavailable' - : props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][ - props.ReleaseVersion - ]; + : props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion]; }; const handleDownloadRelease = () => { @@ -60,15 +56,14 @@ export default connect( const handleReleaseChanged = (e) => { const release = Constants.RELEASE_TYPES.indexOf(e.target.value); - const releaseVersion = - props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1; + const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1; props.setActiveRelease(release, releaseVersion); }; const handleVersionChanged = (e) => { - const releaseVersion = props.VersionLookup[ - Constants.RELEASE_TYPES[props.Release] - ].indexOf(e.target.value); + const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[props.Release]].indexOf( + e.target.value + ); props.setActiveRelease(props.Release, releaseVersion); }; @@ -78,8 +73,7 @@ export default connect( props.InstallActive || props.MountsBusy || (!props.AllowMount && getSelectedVersion() !== 'unavailable'); - const releaseExtracting = - props.InstallType === Constants.INSTALL_TYPES.Release; + const releaseExtracting = props.InstallType === Constants.INSTALL_TYPES.Release; let optionsDisplay = []; let key = 0; @@ -185,11 +179,7 @@ export default connect( items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]} row={5} rowSpan={7} - selected={ - props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][ - props.ReleaseVersion - ] - } + selected={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion]} /> {optionsDisplay} diff --git a/src/components/UI/Box/Box.js b/src/components/UI/Box/Box.js index 9b869c5..95afff1 100644 --- a/src/components/UI/Box/Box.js +++ b/src/components/UI/Box/Box.js @@ -17,10 +17,7 @@ const Box = (props) => { } return ( -
+
{props.children}
); diff --git a/src/components/UI/DropDown/DropDown.js b/src/components/UI/DropDown/DropDown.js index 0d7ecf9..901d255 100644 --- a/src/components/UI/DropDown/DropDown.js +++ b/src/components/UI/DropDown/DropDown.js @@ -13,11 +13,7 @@ const DropDown = (props) => { return (
- this.setState({ HostNameOrIp: e.target.value.trim() }) - } + onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })} className={'ConfigurationItemInput'} style={{ width: '100%' }} type={'text'} @@ -103,9 +98,7 @@ class AddEditHost extends Component {
- this.setState({ ApiPort: parseInt(e.target.value) }) - } + onChange={(e) => this.setState({ ApiPort: parseInt(e.target.value) })} className={'ConfigurationItemInput'} style={{ width: '100%' }} type={'number'} @@ -116,9 +109,7 @@ class AddEditHost extends Component {
- this.setState({ TimeoutMs: parseInt(e.target.value) }) - } + onChange={(e) => this.setState({ TimeoutMs: parseInt(e.target.value) })} className={'ConfigurationItemInput'} style={{ width: '100%' }} type={'number'} @@ -129,17 +120,9 @@ class AddEditHost extends Component {
- +
- +
- +
- +
- +
{ const mapDispatchToProps = (dispatch) => { return { Close: () => dispatch(addEditHost(false)), - completeAddEditHost: (host_data) => - dispatch(completeAddEditHost(true, host_data)), + completeAddEditHost: (host_data) => dispatch(completeAddEditHost(true, host_data)), notifyError: (msg) => dispatch(notifyError(msg)), }; }; diff --git a/src/containers/AddMount/AddMount.js b/src/containers/AddMount/AddMount.js index 8dd3596..1f59ec3 100644 --- a/src/containers/AddMount/AddMount.js +++ b/src/containers/AddMount/AddMount.js @@ -24,8 +24,7 @@ const mapDispatchToProps = (dispatch) => { dispatch(addRemoteMount(hostNameOrIp, port, token)), addS3Mount: (name, accessKey, secretKey, region, bucketName, url) => dispatch(addS3Mount(name, accessKey, secretKey, region, bucketName, url)), - notifyError: (msg, critical, callback) => - dispatch(notifyError(msg, critical, callback)), + notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), }; }; @@ -56,8 +55,7 @@ export default connect( if (this.state.HostNameOrIp.length === 0) { this.props.notifyError('Hostname or IP cannot be empty.'); } else { - const provider = - 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port; + const provider = 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port; if (this.props.RemoteMounts.includes(provider)) { this.props.notifyError('Remote host already exists'); } else { @@ -66,11 +64,7 @@ export default connect( DisplayRemote: false, }, () => { - this.props.addRemoteMount( - this.state.HostNameOrIp, - this.state.Port, - this.state.Token - ); + this.props.addRemoteMount(this.state.HostNameOrIp, this.state.Port, this.state.Token); this.setState({ ...default_state, }); @@ -147,9 +141,7 @@ export default connect( - this.setState({ HostNameOrIp: e.target.value.trim() }) - } + onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })} className={'ConfigurationItemInput'} type={'text'} value={this.state.HostNameOrIp} @@ -174,9 +166,7 @@ export default connect( />
-
@@ -227,11 +217,7 @@ export default connect(
- +
@@ -275,9 +261,7 @@ export default connect(
-
@@ -296,9 +280,7 @@ export default connect( {displayAddS3}
{this.props.remoteSupported ? ( - ) : null} @@ -306,9 +288,7 @@ export default connect(
) : null} {this.props.s3Supported ? ( - ) : null} diff --git a/src/containers/Configuration/Configuration.js b/src/containers/Configuration/Configuration.js index 36e13e4..efc8c28 100644 --- a/src/containers/Configuration/Configuration.js +++ b/src/containers/Configuration/Configuration.js @@ -74,9 +74,7 @@ class Configuration extends IPCContainer { const changedObjectItems = []; let j = 0; for (const item of this.state.ObjectLookup[key]) { - if ( - this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item) - ) { + if (this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)) { changedObjectItems.push(item); } } @@ -101,18 +99,9 @@ class Configuration extends IPCContainer { componentDidMount() { this._isMounted = true; - this.setRequestHandler( - Constants.IPC_Get_Config_Template_Reply, - this.onGetConfigTemplateReply - ); - this.setRequestHandler( - Constants.IPC_Get_Config_Reply, - this.onGetConfigReply - ); - this.setRequestHandler( - Constants.IPC_Set_Config_Values_Reply, - this.onSetConfigValuesReply - ); + this.setRequestHandler(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply); + this.setRequestHandler(Constants.IPC_Get_Config_Reply, this.onGetConfigReply); + this.setRequestHandler(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply); this.sendRequest(Constants.IPC_Get_Config_Template, { Provider: this.props.DisplayConfiguration, Remote: this.props.DisplayRemoteConfiguration, @@ -138,8 +127,7 @@ class Configuration extends IPCContainer { type: template[key] ? template[key].type : null, value: template[key] && - (template[key].type === 'string_array' || - template[key].type === 'object') + (template[key].type === 'string_array' || template[key].type === 'object') ? config[key] : template[key] && template[key].type === 'host_list' ? config[key] @@ -198,19 +186,13 @@ class Configuration extends IPCContainer { let objectLookup = {}; for (const obj of list.ObjectList) { - const list2 = this.createItemList( - obj.value, - this.state.Template[obj.label].template - ); + const list2 = this.createItemList(obj.value, this.state.Template[obj.label].template); objectLookup[obj.label] = list2.ItemList; } const isRemoteMount = this.props.remoteSupported && - JSON.parse( - objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount') - .value - ); + JSON.parse(objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount').value); if (isRemoteMount) { for (const obj of list.ObjectList) { if (obj.hide_remote) { @@ -316,14 +298,10 @@ class Configuration extends IPCContainer { this.props.remoteSupported && item.label !== 'IsRemoteMount' ) { - const isRemoteMount = JSON.parse( - itemList.find((s) => s.label === 'IsRemoteMount').value - ); + const isRemoteMount = JSON.parse(itemList.find((s) => s.label === 'IsRemoteMount').value); const enableRemoteMount = - !isRemoteMount && - JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value); - return item.label === 'RemoteHostNameOrIp' || - item.label === 'RemoteMaxConnections' + !isRemoteMount && JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value); + return item.label === 'RemoteHostNameOrIp' || item.label === 'RemoteMaxConnections' ? isRemoteMount : item.label === 'RemoteReceiveTimeoutSeconds' || item.label === 'RemoteSendTimeoutSeconds' || @@ -343,23 +321,17 @@ class Configuration extends IPCContainer { confirmSave = ( -

- Save Changes? -

+

Save Changes?

@@ -401,8 +373,7 @@ class Configuration extends IPCContainer { label={k.label} readOnly={ this.state.IsRemoteMount && - (k.label === 'RemoteHostNameOrIp' || - k.label === 'RemotePort') + (k.label === 'RemoteHostNameOrIp' || k.label === 'RemotePort') } template={this.state.Template[key].template[k.label]} value={k.value} @@ -485,8 +456,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { displayPinnedManager: (display) => dispatch(displayPinnedManager(display)), - notifyError: (msg, critical, callback) => - dispatch(notifyError(msg, critical, callback)), + notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), hideConfiguration: () => dispatch(displayConfiguration(null, false)), }; }; diff --git a/src/containers/Configuration/ConfigurationItem/ConfigurationItem.js b/src/containers/Configuration/ConfigurationItem/ConfigurationItem.js index 56c20d5..df5c03f 100644 --- a/src/containers/Configuration/ConfigurationItem/ConfigurationItem.js +++ b/src/containers/Configuration/ConfigurationItem/ConfigurationItem.js @@ -26,9 +26,7 @@ export default connect( if (target.type === 'checkbox') { target.value = e.target.checked ? 'true' : 'false'; } else if (target.type === 'textarea') { - e.target.string_array = String(e.target.value) - .replace(/\r\n/g, '\n') - .split('\n'); + e.target.string_array = String(e.target.value).replace(/\r\n/g, '\n').split('\n'); } props.changed(target); }; diff --git a/src/containers/HostList/Host/Host.js b/src/containers/HostList/Host/Host.js index 1cd255e..08147e7 100644 --- a/src/containers/HostList/Host/Host.js +++ b/src/containers/HostList/Host/Host.js @@ -11,20 +11,21 @@ import { faTrashAlt, faEdit } from '@fortawesome/free-solid-svg-icons'; // const mapDispatchToProps = (dispatch) => { return { - addEditHost: (host_data, cb) => dispatch(addEditHost(true, host_data, cb)), + addEditHost: (host_list, host_data, cb) => + dispatch(addEditHost(true, host_list, host_data, cb)), }; }; -const Host = ({ allowDelete, addEditHost, value, onChange, onDelete }) => { +const Host = ({ allowDelete, addEditHost, host_list, host_data, onChange, onDelete }) => { const handleEditHost = () => { - addEditHost(value, (changed, host_data) => { + addEditHost(host_list, host_data, (changed, host_data) => { if (changed) { onChange(host_data); } }); }; - const premium = value.AuthURL && value.AuthUser; + const premium = host_data.AuthURL && host_data.AuthUser; return (
{

{'(premium) ' + - value.HostNameOrIp + - ((value.Protocol === 'http' && value.ApiPort === 80) || - (value.Protocol === 'https' && value.ApiPort === 443) + host_data.HostNameOrIp + + ((host_data.Protocol === 'http' && host_data.ApiPort === 80) || + (host_data.Protocol === 'https' && host_data.ApiPort === 443) ? '' - : ':' + value.ApiPort)} + : ':' + host_data.ApiPort)}

) : (

- {value.HostNameOrIp + - ((value.Protocol === 'http' && value.ApiPort === 80) || - (value.Protocol === 'https' && value.ApiPort === 443) + {host_data.HostNameOrIp + + ((host_data.Protocol === 'http' && host_data.ApiPort === 80) || + (host_data.Protocol === 'https' && host_data.ApiPort === 443) ? '' - : ':' + value.ApiPort)} + : ':' + host_data.ApiPort)}

)}
@@ -76,7 +77,8 @@ Host.propTypes = { addEditHost: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired, - value: PropTypes.object.isRequired, + host_data: PropTypes.object.isRequired, + host_list: PropTypes.array.isRequired, }; export default connect(null, mapDispatchToProps)(Host); diff --git a/src/containers/HostList/HostList.js b/src/containers/HostList/HostList.js index 85826d5..c012e93 100644 --- a/src/containers/HostList/HostList.js +++ b/src/containers/HostList/HostList.js @@ -28,7 +28,7 @@ class HostList extends Component { }; handleAddHost = () => { - this.props.addEditHost((changed, host_data) => { + this.props.addEditHost(this.state.items, (changed, host_data) => { if (changed) { const items = [...this.state.items, host_data]; this.updateItems(items); @@ -86,7 +86,8 @@ class HostList extends Component { onChange={(host_data) => this.handleChanged(host_data, index)} onDelete={() => this.handleDeleted(index)} allowDelete={this.state.items.length > 1} - value={v} + host_data={v} + host_list={this.state.items} /> ); })} @@ -107,7 +108,7 @@ class HostList extends Component { const mapDispatchToProps = (dispatch) => { return { - addEditHost: (cb) => dispatch(addEditHost(true, null, cb)), + addEditHost: (list, cb) => dispatch(addEditHost(true, list, null, cb)), ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNo(title, cb)), }; }; diff --git a/src/containers/MountItems/MountItem/MountItem.js b/src/containers/MountItems/MountItem/MountItem.js index 4bd7c0e..a92eb99 100644 --- a/src/containers/MountItems/MountItem/MountItem.js +++ b/src/containers/MountItems/MountItem/MountItem.js @@ -13,10 +13,7 @@ import { removeMount, setProviderState, } from '../../../redux/actions/mount_actions'; -import { - displaySkynetExport, - displaySkynetImport, -} from '../../../redux/actions/skynet_actions'; +import { displaySkynetExport, displaySkynetImport } from '../../../redux/actions/skynet_actions'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faTrashAlt } from '@fortawesome/free-solid-svg-icons'; import CheckBox from '../../../components/UI/CheckBox/CheckBox'; @@ -36,8 +33,7 @@ const mapDispatchToProps = (dispatch) => { displaySkynetExport: (display) => dispatch(displaySkynetExport(display)), displaySkynetImport: (display) => dispatch(displaySkynetImport(display)), removeMount: (provider) => dispatch(removeMount(provider)), - setProviderState: (provider, state) => - dispatch(setProviderState(provider, state)), + setProviderState: (provider, state) => dispatch(setProviderState(provider, state)), }; }; @@ -70,12 +66,7 @@ export default connect( height={'16px'} onClick={ props.MState.AllowMount - ? () => - props.displayConfiguration( - props.provider, - props.remote, - props.s3 - ) + ? () => props.displayConfiguration(props.provider, props.remote, props.s3) : (e) => { e.preventDefault(); } @@ -108,11 +99,7 @@ export default connect( inputControls = []; let key = 0; inputControls.push( - + - props.browseClicked(props.provider, props.PState.MountLocation) - } + clicked={() => props.browseClicked(props.provider, props.PState.MountLocation)} col={inputColumnSpan - 7} colSpan={7} disabled={props.MState.Mounted || !props.MState.AllowMount} @@ -147,12 +132,7 @@ export default connect( 'Mount' ) ) : ( - + ); const actionsDisplay = ( @@ -176,11 +156,7 @@ export default connect( ); const autoMountControl = ( - + + dimensions.columns - 6} - row={secondRow + 3}> + dimensions.columns - 6} row={secondRow + 3}> diff --git a/src/containers/MountItems/MountItems.js b/src/containers/MountItems/MountItems.js index 411ba02..aac8e95 100644 --- a/src/containers/MountItems/MountItems.js +++ b/src/containers/MountItems/MountItems.js @@ -59,18 +59,9 @@ class MountItems extends IPCContainer { }; componentDidMount() { - this.setRequestHandler( - Constants.IPC_Detect_Mount_Reply, - this.onDetectMountReply - ); - this.setRequestHandler( - Constants.IPC_Mount_Drive_Reply, - this.onMountDriveReply - ); - this.setRequestHandler( - Constants.IPC_Unmount_Drive_Reply, - this.onUnmountDriveReply - ); + this.setRequestHandler(Constants.IPC_Detect_Mount_Reply, this.onDetectMountReply); + this.setRequestHandler(Constants.IPC_Mount_Drive_Reply, this.onMountDriveReply); + this.setRequestHandler(Constants.IPC_Unmount_Drive_Reply, this.onUnmountDriveReply); this.props.resetMountsState(); this.detectMounts(); } @@ -136,13 +127,7 @@ class MountItems extends IPCContainer { const retrySeconds = retryItems[provider].RetrySeconds - 1; if (retrySeconds === 0) { this.cancelRetryMount(provider, () => { - this.handleMountUnMount( - provider, - remote, - s3, - true, - mountLocation - ); + this.handleMountUnMount(provider, remote, s3, true, mountLocation); }); } else { retryItems[provider].RetrySeconds = retrySeconds; @@ -192,12 +177,9 @@ class MountItems extends IPCContainer { if (result.Success) { if (result.Valid) { if (this.props.Platform !== 'win32') { - result = this.sendSyncRequest( - Constants.IPC_Check_Mount_Location, - { - Location: location, - } - ); + result = this.sendSyncRequest(Constants.IPC_Check_Mount_Location, { + Location: location, + }); if (!result.Success) { allowAction = false; this.props.notifyError(result.Error.toString()); @@ -225,11 +207,7 @@ class MountItems extends IPCContainer { remote, s3, location, - 'Incompatible ' + - provider + - ' daemon. Please upgrade ' + - provider + - '.' + 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.' ); } else { this.displayRetryMount( @@ -319,8 +297,7 @@ class MountItems extends IPCContainer { if (!this.state.RetryItems[provider]) { if ( arg.data.Success && - (!arg.data.Active || - (arg.data.Location && arg.data.Location.length > 0)) + (!arg.data.Active || (arg.data.Location && arg.data.Location.length > 0)) ) { const mountState = { AllowMount: true, @@ -358,11 +335,7 @@ class MountItems extends IPCContainer { arg.data.Location && this.props.ProviderState[arg.data.Provider].AutoRestart ) { - this.displayRetryMount( - arg.data.Provider, - arg.data.Remote, - arg.data.Location - ); + this.displayRetryMount(arg.data.Provider, arg.data.Remote, arg.data.Location); } else { this.detectMount(arg.data.Provider); } @@ -374,9 +347,7 @@ class MountItems extends IPCContainer { if (idx > -1) { this.activeDetections.splice(idx, 1); } - this.props.setMountsBusy( - this.activeDetections.length > 0 || this.hasActiveMount() - ); + this.props.setMountsBusy(this.activeDetections.length > 0 || this.hasActiveMount()); }; updateMountLocation = (provider, location, mounted, driveLetters) => { @@ -384,8 +355,7 @@ class MountItems extends IPCContainer { if (location.length === 0) { location = this.props.Platform === 'win32' - ? !providerState.MountLocation || - providerState.MountLocation.trim().length === 0 + ? !providerState.MountLocation || providerState.MountLocation.trim().length === 0 ? driveLetters[0] : providerState.MountLocation : providerState.MountLocation; @@ -420,19 +390,14 @@ class MountItems extends IPCContainer { if (this.state.RetryItems.hasOwnProperty(provider)) { if (this.state.RetryItems[provider].RetryMessage) { retryList.push( -

- {this.state.RetryItems[provider].RetryMessage} -

+

{this.state.RetryItems[provider].RetryMessage}

); } retryList.push( ); if (++retryCount < Object.keys(this.state.RetryItems).length) { @@ -448,9 +413,7 @@ class MountItems extends IPCContainer { retryDisplay = ( - +

); } else { - footerItems.push( -
- ); + footerItems.push(
); } let mountItems = []; @@ -495,9 +456,7 @@ class MountItems extends IPCContainer { - this.handleMountLocationChanged(provider, e.target.value) - } + changed={(e) => this.handleMountLocationChanged(provider, e.target.value)} clicked={this.handleMountUnMount} key={'it_' + mountItems.length} provider={provider} @@ -528,9 +487,7 @@ class MountItems extends IPCContainer { {retryDisplay}
{mountItems}
@@ -556,19 +513,15 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - notifyError: (msg, critical, callback) => - dispatch(notifyError(msg, critical, callback)), + notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), resetMountsState: () => dispatch(resetMountsState()), - setAllowMount: (provider, allow) => - dispatch(setAllowMount(provider, allow)), + setAllowMount: (provider, allow) => dispatch(setAllowMount(provider, allow)), setAutoMountProcessed: (provider, processed) => dispatch(setAutoMountProcessed(provider, processed)), setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)), setMountsBusy: (busy) => dispatch(setBusy(busy)), - setMountState: (provider, state) => - dispatch(setMountState(provider, state)), - setProviderState: (provider, state) => - dispatch(setProviderState(provider, state)), + setMountState: (provider, state) => dispatch(setMountState(provider, state)), + setProviderState: (provider, state) => dispatch(setProviderState(provider, state)), }; }; diff --git a/src/containers/PinnedManager/PinnedManager.js b/src/containers/PinnedManager/PinnedManager.js index 1f0dbae..319459a 100644 --- a/src/containers/PinnedManager/PinnedManager.js +++ b/src/containers/PinnedManager/PinnedManager.js @@ -24,8 +24,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { displayPinnedManager: (display) => dispatch(displayPinnedManager(display)), - notifyApplicationBusy: (busy) => - dispatch(notifyApplicationBusy(busy, true)), + notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)), notifyError: (msg, cb) => dispatch(notifyError(msg, false, cb)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), }; @@ -68,15 +67,11 @@ export default connect( if (data.Success) { const items = data.Items.filter( (i) => - i.path !== '.' && - (this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.') + i.path !== '.' && (this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.') ).map((i) => { return { ...i, - name: - i.path === '..' - ? i.path - : i.path.substr(i.path.lastIndexOf('/') + 1), + name: i.path === '..' ? i.path : i.path.substr(i.path.lastIndexOf('/') + 1), meta: { ...i.meta, pinned: i.meta.pinned === '1', @@ -143,8 +138,7 @@ export default connect( checked={pinned} changed={() => { const items = JSON.parse(JSON.stringify(this.state.items)); - const pinned = (items[item_idx].meta.pinned = !items[item_idx] - .meta.pinned); + const pinned = (items[item_idx].meta.pinned = !items[item_idx].meta.pinned); this.setState( { items, @@ -187,9 +181,7 @@ export default connect( X
-

- {'Pinned File Manager'} -

+

{'Pinned File Manager'}

 {this.state.active_directory}
@@ -198,13 +190,7 @@ export default connect(
{this.state.items.map((i, k) => { return i.directory - ? this.createDirectory( - i.name, - i.path, - idx++, - this.state.items.length, - k - ) + ? this.createDirectory(i.name, i.path, idx++, this.state.items.length, k) : this.createFile( i.name, i.path, diff --git a/src/containers/SelectAppPlatform/SelectAppPlatform.js b/src/containers/SelectAppPlatform/SelectAppPlatform.js index c2927e5..bac9e8a 100644 --- a/src/containers/SelectAppPlatform/SelectAppPlatform.js +++ b/src/containers/SelectAppPlatform/SelectAppPlatform.js @@ -5,10 +5,7 @@ import { connect } from 'react-redux'; import * as Constants from '../../constants'; import Box from '../../components/UI/Box/Box'; import Button from '../../components/UI/Button/Button'; -import { - downloadItem, - setAllowDownload, -} from '../../redux/actions/download_actions'; +import { downloadItem, setAllowDownload } from '../../redux/actions/download_actions'; import DropDown from '../../components/UI/DropDown/DropDown'; import IPCContainer from '../IPCContainer/IPCContainer'; import { notifyError } from '../../redux/actions/error_actions'; @@ -52,9 +49,7 @@ class SelectAppPlatform extends IPCContainer { handleTestClicked = () => { this.props.setInstallTestActive(true); this.props.setAllowDownload(true); - this.grabLatestRelease( - Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected] - ); + this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]); }; handleChanged = (e) => { @@ -70,8 +65,8 @@ class SelectAppPlatform extends IPCContainer {

Select Linux Platform

- Repertory was unable to detect your Linux distribution. Please - select one of the following and click Test to continue: + Repertory was unable to detect your Linux distribution. Please select one of the + following and click Test to continue:

@@ -81,9 +76,7 @@ class SelectAppPlatform extends IPCContainer { items={Constants.LINUX_SELECTABLE_PLATFORMS} selected={Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]} /> -
@@ -101,9 +94,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) => - dispatch( - downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform) - ), + dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)), notifyError: (msg) => dispatch(notifyError(msg)), setAllowDownload: (allow) => dispatch(setAllowDownload(allow)), setInstallTestActive: (active) => dispatch(setInstallTestActive(active)), diff --git a/src/containers/SkynetExport/SkynetExport.js b/src/containers/SkynetExport/SkynetExport.js index 8512b97..3655d3f 100644 --- a/src/containers/SkynetExport/SkynetExport.js +++ b/src/containers/SkynetExport/SkynetExport.js @@ -33,11 +33,9 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { displaySkynetExport: (display) => dispatch(displaySkynetExport(display)), - notifyApplicationBusy: (busy) => - dispatch(notifyApplicationBusy(busy, true)), + notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)), notifyError: (msg) => dispatch(notifyError(msg)), - notifyInfo: (title, msg) => - dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')), + notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')), }; }; @@ -55,14 +53,8 @@ export default connect( }; componentDidMount() { - this.setRequestHandler( - Constants.IPC_Grab_Skynet_Tree_Reply, - this.onGrabSkynetTreeReply - ); - this.setRequestHandler( - Constants.IPC_Export_Skylinks_Reply, - this.onExportSkylinksReply - ); + this.setRequestHandler(Constants.IPC_Grab_Skynet_Tree_Reply, this.onGrabSkynetTreeReply); + this.setRequestHandler(Constants.IPC_Export_Skylinks_Reply, this.onExportSkylinksReply); this.sendRequest(Constants.IPC_Grab_Skynet_Tree, { Version: this.props.version, }); @@ -86,12 +78,7 @@ export default connect( const treeItem = { label: item.name, path: item.path, - value: - item.name === '/' - ? 0 - : item.path - ? item.path - : JSON.stringify(item), + value: item.name === '/' ? 0 : item.path ? item.path : JSON.stringify(item), }; if (item.directory) { @@ -136,8 +123,7 @@ export default connect( () => { this.props.notifyInfo( 'Skylink Exports', - '!alternate!!copyable!' + - JSON.stringify(arg.data.Result.success, null, 2) + '!alternate!!copyable!' + JSON.stringify(arg.data.Result.success, null, 2) ); this.sendRequest(Constants.IPC_Grab_Skynet_Tree, { Version: this.props.version, @@ -200,10 +186,7 @@ export default connect(

{this.state.second_stage ? 'Verify Exports' : 'Export Files'}

-
+
{this.state.second_stage ? ( this.state.checked.map((path) => { return ( @@ -235,11 +218,7 @@ export default connect( /> ), uncheck: ( - + ), halfCheck: ( { text={'Skylink'} style={{ minWidth: '33.33%', maxWidth: '33.33%' }} /> - +

diff --git a/src/containers/SkynetImport/SkynetImport.js b/src/containers/SkynetImport/SkynetImport.js index 633501b..6dcee39 100644 --- a/src/containers/SkynetImport/SkynetImport.js +++ b/src/containers/SkynetImport/SkynetImport.js @@ -21,8 +21,7 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { displaySkynetImport: (display) => dispatch(displaySkynetImport(display)), - notifyApplicationBusy: (busy) => - dispatch(notifyApplicationBusy(busy, true)), + notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)), notifyError: (msg) => dispatch(notifyError(msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), }; @@ -40,10 +39,7 @@ export default connect( }; componentDidMount() { - this.setRequestHandler( - Constants.IPC_Import_Skylinks_Reply, - this.onImportSkylinksReply - ); + this.setRequestHandler(Constants.IPC_Import_Skylinks_Reply, this.onImportSkylinksReply); } componentWillUnmount() { @@ -119,9 +115,7 @@ export default connect( part = part.trim(); const pair = part.split('='); if (pair.length !== 2) { - throw new Error( - 'Invalid syntax for import: directory="",skylink="",token=""' - ); + throw new Error('Invalid syntax for import: directory="",skylink="",token=""'); } importItem = { ...importItem, @@ -129,9 +123,7 @@ export default connect( }; } if (!importItem.skylink) { - throw new Error( - 'Invalid syntax for import: directory="",skylink="",token=""' - ); + throw new Error('Invalid syntax for import: directory="",skylink="",token=""'); } importsArray.push(importItem); } else if (item.length > 0) { @@ -165,22 +157,15 @@ export default connect( this.setState( { import_text: - failedImportsArray.length > 0 - ? JSON.stringify(failedImportsArray, null, 2) - : '', + failedImportsArray.length > 0 ? JSON.stringify(failedImportsArray, null, 2) : '', imports_array: [], second_stage: false, }, () => { if (failedImportsArray.length > 0) { - this.props.notifyError( - `Failed to import ${failedImportsArray.length} item(s)` - ); + this.props.notifyError(`Failed to import ${failedImportsArray.length} item(s)`); } else { - this.props.notifyInfo( - 'Import Result', - `Successfully imported ${count} item(s)` - ); + this.props.notifyInfo('Import Result', `Successfully imported ${count} item(s)`); } } ); diff --git a/src/containers/UI/Password/Password.js b/src/containers/UI/Password/Password.js index 13e0e05..bef623a 100644 --- a/src/containers/UI/Password/Password.js +++ b/src/containers/UI/Password/Password.js @@ -48,10 +48,7 @@ export default class Password extends Component { this.props.changed(this.state.password); this.setState({ ...this.state, - button_text: - this.state.password && this.state.password.length > 0 - ? 'clear' - : 'set', + button_text: this.state.password && this.state.password.length > 0 ? 'clear' : 'set', password2: '', }); } else { @@ -119,10 +116,7 @@ export default class Password extends Component { return (
{this.props.readOnly ? null : ( - + {this.state.button_text} )} @@ -134,20 +128,10 @@ export default class Password extends Component { onChange={this.handlePasswordChanged} onKeyUp={this.handlePasswordKeyUp} type={this.state.show_password ? 'text' : 'password'} - value={ - this.state.button_text === 'confirm' - ? this.state.password2 - : this.state.password - } + value={this.state.button_text === 'confirm' ? this.state.password2 : this.state.password} /> - - + +
); diff --git a/src/helpers.js b/src/helpers.js index b1faffa..b5c53bf 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -40,12 +40,7 @@ const _vcRuntimeExists = () => { args2.push('REG_SZ'); _execProcessGetOutput(cmd, null, args2) .then((lines) => { - const value = lines[2] - .trim() - .substr(args2[3].length) - .trim() - .substr(6) - .trim(); + const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim(); if ( value.includes( IS_64BIT @@ -84,20 +79,14 @@ const _createTreeNodes = (fileList) => { let tree = {}; const directorySort = (a, b) => { - return !!a.directory === !!b.directory - ? a.name.localeCompare(b.name) - : a.directory - ? -1 - : 1; + return !!a.directory === !!b.directory ? a.name.localeCompare(b.name) : a.directory ? -1 : 1; }; const addNode = (obj) => { let fullPath; const idx = obj.skylink.indexOf('/'); if (idx > -1) { - fullPath = path - .join(obj.directory, obj.skylink.substr(idx + 1)) - .replace(/\\/g, '/'); + fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1)).replace(/\\/g, '/'); } else { fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/'); } @@ -403,8 +392,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => { provider, !Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('remote'), - !Constants.PROVIDER_LIST.includes(provider) && - provider.toLowerCase().startsWith('s3') + !Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3') ); args.push('-status'); @@ -420,12 +408,10 @@ module.exports.detectRepertoryMounts = (version, providerList) => { }); process.on('exit', () => { - mountState[provider] = - _tryParse(result, defaultData)[provider] || defaultData; + mountState[provider] = _tryParse(result, defaultData)[provider] || defaultData; if ( mountState[provider].Active && - (mountState[provider].Location === 'elevating' || - mountState[provider].Location === '') + (mountState[provider].Location === 'elevating' || mountState[provider].Location === '') ) { setTimeout(() => { grabStatus(index); @@ -441,12 +427,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => { }); }; -module.exports.downloadFile = ( - url, - destination, - progressCallback, - completeCallback -) => { +module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => { try { if (fs.existsSync(destination)) { fs.unlinkSync(destination); @@ -482,9 +463,7 @@ module.exports.downloadFile = ( if (downloaded === 0) { completeCallback(new Error('Received 0 bytes')); } else if (downloaded !== total) { - completeCallback( - new Error('Received incorrect number of bytes') - ); + completeCallback(new Error('Received incorrect number of bytes')); } else { completeCallback(); } @@ -536,9 +515,7 @@ module.exports.executeAsync = (command, args = []) => { const launchProcess = (count, timeout) => { let cmd = path.basename(command); const working = - cmd.length === command.length - ? null - : command.substr(0, command.length - cmd.length); + cmd.length === command.length ? null : command.substr(0, command.length - cmd.length); let processOptions = { detached: true, shell: false, @@ -626,14 +603,7 @@ module.exports.executeScript = (script) => { }); }; -module.exports.executeMount = ( - version, - provider, - remote, - s3, - location, - exitCallback -) => { +module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => { return new Promise((resolve) => { const repertoryExec = _getRepertoryExec(version); const processOptions = { @@ -876,12 +846,7 @@ module.exports.getMissingDependencies = (dependencies) => { } else { for (const dep of dependencies) { try { - if ( - !( - fs.lstatSync(dep.file).isFile() || - fs.lstatSync(dep.file).isSymbolicLink() - ) - ) { + if (!(fs.lstatSync(dep.file).isFile() || fs.lstatSync(dep.file).isSymbolicLink())) { missing.push(dep); } } catch (e) { @@ -1037,10 +1002,7 @@ module.exports.importSkylinks = (version, jsonArray) => { }; // https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync -module.exports.mkDirByPathSync = ( - targetDir, - { isRelativeToScript = false } = {} -) => { +module.exports.mkDirByPathSync = (targetDir, { isRelativeToScript = false } = {}) => { const sep = path.sep; const initDir = path.isAbsolute(targetDir) ? sep : ''; const baseDir = isRelativeToScript ? __dirname : '.'; @@ -1099,20 +1061,11 @@ module.exports.performWindowsUninstall = (names) => { args2.push('REG_SZ'); _execProcessGetOutput(cmd, null, args2) .then((lines) => { - const value = lines[2] - .trim() - .substr(args2[3].length) - .trim() - .substr(6) - .trim(); + const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim(); if (names.includes(value)) { const items = line.split('\\'); const productCode = items[items.length - 1]; - _executeProcess('msiexec.exe', null, [ - '/x', - productCode, - '/norestart', - ]) + _executeProcess('msiexec.exe', null, ['/x', productCode, '/norestart']) .then((code) => { if (code === 0 || code === 3010 || code === 1641) { resolve(true); @@ -1150,14 +1103,7 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively; module.exports.resolvePath = _resolvePath; -module.exports.setConfigValue = ( - name, - value, - provider, - remote, - s3, - version -) => { +module.exports.setConfigValue = (name, value, provider, remote, s3, version) => { return new Promise((resolve, reject) => { const repertoryExec = _getRepertoryExec(version); const processOptions = { @@ -1290,15 +1236,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => { const executeVerify = (openssl) => { execFile( openssl, - [ - 'dgst', - '-sha256', - '-verify', - publicKeyFile, - '-signature', - signatureFile, - file, - ], + ['dgst', '-sha256', '-verify', publicKeyFile, '-signature', signatureFile, file], (err, stdout) => { if (err) { reject(err); diff --git a/src/helpers.test.js b/src/helpers.test.js index 197b2b9..6b547c8 100644 --- a/src/helpers.test.js +++ b/src/helpers.test.js @@ -31,10 +31,7 @@ test('create temp signature files', () => { encoding: 'utf8', }) .replace(/(\r\n|\n|\r)/gm, ''); - const data = helpers.createSignatureFiles( - b64signature, - Constants.DEV_PUBLIC_KEY - ); + const data = helpers.createSignatureFiles(b64signature, Constants.DEV_PUBLIC_KEY); expect(data).toBeDefined(); expect(data.PublicKeyFile).toBeDefined(); expect(data.SignatureFile).toBeDefined(); diff --git a/src/index.js b/src/index.js index a8e2af1..4012d58 100644 --- a/src/index.js +++ b/src/index.js @@ -44,9 +44,7 @@ if (ipcRenderer) { } store.dispatch(setProviderState(provider, state)); } - store.dispatch( - setActiveRelease(result.data.Release, result.data.Version) - ); + store.dispatch(setActiveRelease(result.data.Release, result.data.Version)); } else { store = createAppStore(platformInfo, packageJson.version, {}); } diff --git a/src/redux/actions/download_actions.js b/src/redux/actions/download_actions.js index a5bfbdc..492d6a2 100644 --- a/src/redux/actions/download_actions.js +++ b/src/redux/actions/download_actions.js @@ -21,14 +21,7 @@ export const setDownloadBegin = (name, type, url) => { export const setDownloadEnd = createAction('download/setDownloadEnd'); export const setDownloadProgress = createAction('download/setDownloadProgress'); -export const downloadItem = ( - name, - type, - urls, - isWinFSP, - testVersion, - appPlatform -) => { +export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatform) => { return (dispatch, getState) => { if (!Array.isArray(urls)) { urls = [urls]; @@ -38,35 +31,20 @@ export const downloadItem = ( if (result.Success) { switch (type) { case Constants.INSTALL_TYPES.Dependency: - dispatch( - installDependency(result.Destination, result.URL, isWinFSP) - ); + dispatch(installDependency(result.Destination, result.URL, isWinFSP)); break; case Constants.INSTALL_TYPES.Release: dispatch(installRelease(result.Destination)); break; case Constants.INSTALL_TYPES.TestRelease: - dispatch( - installAndTestRelease( - result.Destination, - testVersion, - appPlatform - ) - ); + dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform)); break; case Constants.INSTALL_TYPES.Upgrade: // const info = // this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]]; //const sha256 = null; // info.sha256; //const signature = null; // info.sig; - dispatch( - installUpgrade( - result.Destination, - null, - null, - !!result.SkipVerification - ) - ); + dispatch(installUpgrade(result.Destination, null, null, !!result.SkipVerification)); break; default: dispatch(notifyError('Unknown download type: ' + type)); @@ -83,10 +61,7 @@ export const downloadItem = ( const downloadAtIndex = (index) => { const url = urls[index]; const state = getState(); - if ( - index > 0 || - (!state.download.DownloadActive && state.download.AllowDownload) - ) { + if (index > 0 || (!state.download.DownloadActive && state.download.AllowDownload)) { const ipcRenderer = getIPCRenderer(); if (ipcRenderer) { dispatch(setDownloadBegin(name, type, url)); @@ -96,10 +71,7 @@ export const downloadItem = ( }; const downloadFileComplete = (_, arg) => { - ipcRenderer.removeListener( - Constants.IPC_Download_File_Progress, - downloadFileProgress - ); + ipcRenderer.removeListener(Constants.IPC_Download_File_Progress, downloadFileProgress); if (!arg.data.Success && ++index < urls.length) { downloadAtIndex(index); } else { @@ -108,14 +80,8 @@ export const downloadItem = ( } }; - ipcRenderer.on( - Constants.IPC_Download_File_Progress, - downloadFileProgress - ); - ipcRenderer.once( - Constants.IPC_Download_File_Complete, - downloadFileComplete - ); + ipcRenderer.on(Constants.IPC_Download_File_Progress, downloadFileProgress); + ipcRenderer.once(Constants.IPC_Download_File_Complete, downloadFileComplete); ipcRenderer.send(Constants.IPC_Download_File, { Filename: name, diff --git a/src/redux/actions/host_actions.js b/src/redux/actions/host_actions.js index 41306ab..066f898 100644 --- a/src/redux/actions/host_actions.js +++ b/src/redux/actions/host_actions.js @@ -1,24 +1,24 @@ let addEditHostResolvers = []; -export const addEditHost = (display, host_data, cb) => { +export const addEditHost = (display, host_list, host_data, cb) => { return (dispatch) => { if (cb) { - dispatch(addEditHost(display, host_data)).then(({ changed, host_data }) => + dispatch(addEditHost(display, host_list, host_data)).then(({ changed, host_data }) => cb(changed, host_data) ); } else { return new Promise((resolve) => { - dispatch(handleDisplayAddEditHost(display, host_data, resolve)); + dispatch(handleDisplayAddEditHost(display, host_list, host_data, resolve)); }); } }; }; -const handleDisplayAddEditHost = (display, host_data, resolve) => { +const handleDisplayAddEditHost = (display, host_list, host_data, resolve) => { return (dispatch) => { if (display) { addEditHostResolvers.push(resolve); - dispatch(displayAddEditHost(display, host_data)); + dispatch(displayAddEditHost(display, host_list, host_data)); } else { dispatch(completeAddEditHost(false)); } @@ -36,6 +36,6 @@ export const completeAddEditHost = (changed, host_data) => { }; export const DISPLAY_ADD_EDIT_HOST = 'host/displayAddEditHost'; -export const displayAddEditHost = (display, host_data) => { - return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data } }; +export const displayAddEditHost = (display, host_list, host_data) => { + return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data, host_list } }; }; diff --git a/src/redux/actions/install_actions.js b/src/redux/actions/install_actions.js index 13842f4..4ce1f2b 100644 --- a/src/redux/actions/install_actions.js +++ b/src/redux/actions/install_actions.js @@ -31,8 +31,7 @@ export const checkInstalled = (dependencies, version) => { const checkInstalledComplete = (_, arg) => { const result = arg.data; const updateState = () => { - const installedVersion = - result.Success && result.Exists ? result.Version : 'none'; + const installedVersion = result.Success && result.Exists ? result.Version : 'none'; const state = getState(); const release = state.relver.Release; @@ -41,8 +40,7 @@ export const checkInstalled = (dependencies, version) => { let upgradeAvailable = false; if (installedVersion !== 'none') { const latestVersion = - state.relver.VersionLookup[Constants.RELEASE_TYPES[release]] - .length - 1; + state.relver.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1; if (version === -1) { version = latestVersion; dispatch(setActiveRelease(release, version)); @@ -63,14 +61,12 @@ export const checkInstalled = (dependencies, version) => { dispatch(showWindow()); } else if (installedVersion === 'none' && autoInstallRelease) { dispatch(setAllowMount(false)); - const versionString = getState().relver.VersionLookup[ - Constants.RELEASE_TYPES[release] - ][version]; + const versionString = getState().relver.VersionLookup[Constants.RELEASE_TYPES[release]][ + version + ]; const urls = getState().relver.LocationsLookup[versionString].urls; const fileName = versionString + '.zip'; - dispatch( - downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls) - ); + dispatch(downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls)); } }; @@ -81,10 +77,7 @@ export const checkInstalled = (dependencies, version) => { } }; - ipcRenderer.once( - Constants.IPC_Check_Installed_Reply, - checkInstalledComplete - ); + ipcRenderer.once(Constants.IPC_Check_Installed_Reply, checkInstalledComplete); ipcRenderer.send(Constants.IPC_Check_Installed, { Dependencies: dependencies, Version: version, @@ -104,8 +97,7 @@ export const checkVersionInstalled = () => { state.relver.LocationsLookup[selectedVersion] && state.relver.LocationsLookup[selectedVersion].dependencies ) { - dependencies = - state.relver.LocationsLookup[selectedVersion].dependencies; + dependencies = state.relver.LocationsLookup[selectedVersion].dependencies; } dispatch(checkInstalled(dependencies, selectedVersion)); } else { @@ -139,12 +131,9 @@ export const installDependency = (source, url, isWinFSP) => { return d.download === url; }); const i = setInterval(() => { - const ret = ipcRenderer.sendSync( - Constants.IPC_Check_Dependency_Installed + '_sync', - { - File: dep.file, - } - ); + const ret = ipcRenderer.sendSync(Constants.IPC_Check_Dependency_Installed + '_sync', { + File: dep.file, + }); if (ret.data.Exists) { clearInterval(i); @@ -158,10 +147,7 @@ export const installDependency = (source, url, isWinFSP) => { } }; - ipcRenderer.once( - Constants.IPC_Install_Dependency_Reply, - installDependencyComplete - ); + ipcRenderer.once(Constants.IPC_Install_Dependency_Reply, installDependencyComplete); ipcRenderer.send(Constants.IPC_Install_Dependency, { Source: source, URL: url, @@ -199,10 +185,7 @@ export const installAndTestRelease = (source, version, appPlatform) => { }); }; - ipcRenderer.once( - Constants.IPC_Extract_Release_Complete, - extractReleaseComplete - ); + ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete); ipcRenderer.send(Constants.IPC_Extract_Release, { Source: source, Version: version, @@ -214,10 +197,7 @@ export const installAndTestRelease = (source, version, appPlatform) => { export const installReleaseByVersion = (release, version) => { return (dispatch, getState) => { const install = () => { - if ( - getState().download.AllowDownload && - !getState().download.DownloadActive - ) { + if (getState().download.AllowDownload && !getState().download.DownloadActive) { dispatch(setAutoInstallRelease(true)); dispatch(setActiveRelease(release, version)); } else { @@ -251,10 +231,7 @@ export const installRelease = (source) => { }); if (arg.data.Success) { - localStorage.setItem( - 'previous_releases', - localStorage.getItem('releases') - ); + localStorage.setItem('previous_releases', localStorage.getItem('releases')); dispatch(setNewReleasesAvailable2([])); } @@ -262,10 +239,7 @@ export const installRelease = (source) => { dispatch(checkVersionInstalled()); }; - ipcRenderer.once( - Constants.IPC_Extract_Release_Complete, - extractReleaseComplete - ); + ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete); ipcRenderer.send(Constants.IPC_Extract_Release, { Source: source, Version: version, @@ -303,10 +277,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => { } }; - ipcRenderer.once( - Constants.IPC_Install_Upgrade_Reply, - installUpgradeComplete - ); + ipcRenderer.once(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete); ipcRenderer.send(Constants.IPC_Install_Upgrade, { Sha256: sha256, Signature: signature, @@ -317,17 +288,9 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => { }; }; -export const setAutoInstallRelease = createAction( - 'install/setAutoInstallRelease' -); -export const setDismissDependencies = createAction( - 'install/setDismissDependencies' -); +export const setAutoInstallRelease = createAction('install/setAutoInstallRelease'); +export const setDismissDependencies = createAction('install/setDismissDependencies'); export const setInstallActive = createAction('install/setInstallActive'); -export const setInstallTestActive = createAction( - 'install/setInstallTestActive' -); +export const setInstallTestActive = createAction('install/setInstallTestActive'); export const setInstallComplete = createAction('install/setInstallComplete'); -export const setMissingDependencies = createAction( - 'install/setMissingDependencies' -); +export const setMissingDependencies = createAction('install/setMissingDependencies'); diff --git a/src/redux/actions/mount_actions.js b/src/redux/actions/mount_actions.js index 6a3fb7b..7912869 100644 --- a/src/redux/actions/mount_actions.js +++ b/src/redux/actions/mount_actions.js @@ -23,9 +23,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => { Version: getState().relver.InstalledVersion, }); } else { - dispatch( - notifyError('Failed to create S3 instance: ' + arg.data.Error) - ); + dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error)); dispatch(setBusy(false)); } }); @@ -44,14 +42,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => { }; }; -export const addS3Mount = ( - name, - accessKey, - secretKey, - region, - bucketName, - url -) => { +export const addS3Mount = (name, accessKey, secretKey, region, bucketName, url) => { return (dispatch, getState) => { const ipcRenderer = getIPCRenderer(); const provider = 'S3' + name; @@ -67,9 +58,7 @@ export const addS3Mount = ( Version: getState().relver.InstalledVersion, }); } else { - dispatch( - notifyError('Failed to create S3 instance: ' + arg.data.Error) - ); + dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error)); dispatch(setBusy(false)); } }); @@ -107,13 +96,13 @@ export const displayConfiguration = (provider, remote, s3) => { export const removeMount = (provider) => { return (dispatch) => { const isRemote = provider.startsWith('Remote'); - dispatch( - confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?') - ).then((confirmed) => { - if (confirmed) { - dispatch(removeMount2(provider)); + dispatch(confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?')).then( + (confirmed) => { + if (confirmed) { + dispatch(removeMount2(provider)); + } } - }); + ); }; }; diff --git a/src/redux/actions/release_version_actions.js b/src/redux/actions/release_version_actions.js index 96e04e2..912290a 100644 --- a/src/redux/actions/release_version_actions.js +++ b/src/redux/actions/release_version_actions.js @@ -9,17 +9,9 @@ import { getSelectedVersionFromState, } from '../../utils.jsx'; -import { - saveState, - setAllowMount, - setApplicationReady, - showWindow, -} from './common_actions'; +import { saveState, setAllowMount, setApplicationReady, showWindow } from './common_actions'; import { notifyError } from './error_actions'; -import { - checkVersionInstalled, - setDismissDependencies, -} from './install_actions'; +import { checkVersionInstalled, setDismissDependencies } from './install_actions'; import { unmountAll } from './mount_actions'; export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade'; @@ -85,19 +77,12 @@ export const loadReleases = () => { release = Constants.DEFAULT_RELEASE; } - let latestVersion = - versionLookup[Constants.RELEASE_TYPES[release]].length - 1; + let latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1; let version = state.Version; - if ( - versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable' - ) { + if (versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable') { release = Constants.DEFAULT_RELEASE; - version = latestVersion = - versionLookup[Constants.RELEASE_TYPES[release]].length - 1; - } else if ( - version === -1 || - !versionLookup[Constants.RELEASE_TYPES[release]][version] - ) { + version = latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1; + } else if (version === -1 || !versionLookup[Constants.RELEASE_TYPES[release]][version]) { version = latestVersion; } @@ -109,9 +94,7 @@ export const loadReleases = () => { dispatch(detectUIUpgrade()); if (processAllowDismiss) { dispatch( - setAllowDismissDependencies( - versionLookup[Constants.RELEASE_TYPES[release]].length > 1 - ) + setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1) ); } dispatch(checkVersionInstalled()); @@ -176,9 +159,7 @@ export const loadReleases = () => { localStorage.setItem('previous_releases', storedReleases); dispatch(showWindow()); } else if ( - (newReleases = checkNewReleases( - getSelectedVersionFromState(getState()) - )).length > 0 + (newReleases = checkNewReleases(getSelectedVersionFromState(getState()))).length > 0 ) { dispatch(setNewReleasesAvailable2(newReleases)); } @@ -225,20 +206,12 @@ export const setActiveRelease = (release, version) => { }; }; -export const setAllowDismissDependencies = createAction( - 'relver/setAllowDismissDependencies' -); -export const setDismissNewReleasesAvailable = createAction( - 'relver/setDismissNewReleasesAvailable' -); +export const setAllowDismissDependencies = createAction('relver/setAllowDismissDependencies'); +export const setDismissNewReleasesAvailable = createAction('relver/setDismissNewReleasesAvailable'); export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade'); export const setInstalledVersion = createAction('relver/setInstalledVersion'); -export const setNewReleasesAvailable = createAction( - 'relver/setNewReleasesAvailable' -); -export const setNewReleasesAvailable2 = createAction( - 'relver/setNewReleasesAvailable2' -); +export const setNewReleasesAvailable = createAction('relver/setNewReleasesAvailable'); +export const setNewReleasesAvailable2 = createAction('relver/setNewReleasesAvailable2'); export const SET_RELEASE_DATA = 'relver/setReleaseData'; export const setReleaseData = (locationsLookup, versionLookup) => { @@ -251,9 +224,7 @@ export const setReleaseData = (locationsLookup, versionLookup) => { }; }; -export const setReleaseUpgradeAvailable = createAction( - 'relver/setReleaseUpgradeAvailable' -); +export const setReleaseUpgradeAvailable = createAction('relver/setReleaseUpgradeAvailable'); export const SET_UI_UPGRADE_DATA = 'relver/setUIUpgradeData'; export const setUIUpgradeData = (upgradeData, version) => { diff --git a/src/redux/reducers/error_reducer.js b/src/redux/reducers/error_reducer.js index 180ea64..15cd243 100644 --- a/src/redux/reducers/error_reducer.js +++ b/src/redux/reducers/error_reducer.js @@ -1,10 +1,5 @@ import { createReducer } from '@reduxjs/toolkit'; -import { - CLEAR_ERROR, - CLEAR_INFO, - SET_ERROR_INFO, - SET_INFO, -} from '../actions/error_actions'; +import { CLEAR_ERROR, CLEAR_INFO, SET_ERROR_INFO, SET_INFO } from '../actions/error_actions'; export const errorReducer = createReducer( { @@ -16,8 +11,7 @@ export const errorReducer = createReducer( }, { [CLEAR_ERROR]: (state) => { - const errorStack = - state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : []; + const errorStack = state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : []; return { ...state, DisplayError: errorStack.length > 0, @@ -25,8 +19,7 @@ export const errorReducer = createReducer( }; }, [CLEAR_INFO]: (state) => { - const infoStack = - state.InfoStack.length > 0 ? state.InfoStack.slice(1) : []; + const infoStack = state.InfoStack.length > 0 ? state.InfoStack.slice(1) : []; return { ...state, DisplayInfo: infoStack.length > 0, diff --git a/src/redux/reducers/mount_reducer.js b/src/redux/reducers/mount_reducer.js index 0f71cb6..e96bec2 100644 --- a/src/redux/reducers/mount_reducer.js +++ b/src/redux/reducers/mount_reducer.js @@ -140,9 +140,7 @@ export const createMountReducer = (state) => { let autoMountProcessed = { ...state.AutoMountProcessed }; delete autoMountProcessed[action.payload]; - const remoteMounts = state.RemoteMounts.filter( - (i) => i !== action.payload - ); + const remoteMounts = state.RemoteMounts.filter((i) => i !== action.payload); const s3Mounts = state.S3Mounts.filter((i) => i !== action.payload); return { ...state, diff --git a/src/renderer/ipc/ConfigIPC.js b/src/renderer/ipc/ConfigIPC.js index 5b0028e..772fdbb 100644 --- a/src/renderer/ipc/ConfigIPC.js +++ b/src/renderer/ipc/ConfigIPC.js @@ -11,12 +11,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { Config: data.Data, }); } else { - standardIPCReply( - event, - Constants.IPC_Get_Config_Reply, - {}, - data.Code - ); + standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, data.Code); } }) .catch((error) => { @@ -33,12 +28,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { }); }) .catch((error) => { - standardIPCReply( - event, - Constants.IPC_Get_Config_Template_Reply, - {}, - error - ); + standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {}, error); }); }); @@ -58,12 +48,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { setConfigValue(++i); }) .catch((error) => { - standardIPCReply( - event, - Constants.IPC_Set_Config_Values_Reply, - {}, - error - ); + standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}, error); }); } else { standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}); diff --git a/src/renderer/ipc/DependencyIPC.js b/src/renderer/ipc/DependencyIPC.js index 7580e57..5c60718 100644 --- a/src/renderer/ipc/DependencyIPC.js +++ b/src/renderer/ipc/DependencyIPC.js @@ -20,23 +20,20 @@ const addListeners = (ipcMain, { standardIPCReply }) => { } }); - ipcMain.on( - Constants.IPC_Check_Dependency_Installed + '_sync', - (event, data) => { - try { - const ls = fs.lstatSync(data.File); - event.returnValue = { - data: { - Exists: ls.isFile() || ls.isSymbolicLink(), - }, - }; - } catch (e) { - event.returnValue = { - data: { Exists: false }, - }; - } + ipcMain.on(Constants.IPC_Check_Dependency_Installed + '_sync', (event, data) => { + try { + const ls = fs.lstatSync(data.File); + event.returnValue = { + data: { + Exists: ls.isFile() || ls.isSymbolicLink(), + }, + }; + } catch (e) { + event.returnValue = { + data: { Exists: false }, + }; } - ); + }); ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => { if (data.Source.toLowerCase().endsWith('.dmg')) { diff --git a/src/renderer/ipc/MountsIPC.js b/src/renderer/ipc/MountsIPC.js index bee5487..bedd695 100644 --- a/src/renderer/ipc/MountsIPC.js +++ b/src/renderer/ipc/MountsIPC.js @@ -17,14 +17,7 @@ const clearManualMountDetection = (provider) => { } }; -const monitorMount = ( - sender, - provider, - providerList, - version, - pid, - location -) => { +const monitorMount = (sender, provider, providerList, version, pid, location) => { manualMountDetection[provider] = setInterval(() => { helpers .detectRepertoryMounts(version, providerList) @@ -62,12 +55,7 @@ const unmountAllDrives = () => { // Unmount all items for (const mountLocation of mountedLocations) { const data = mountedData[mountLocation]; - helpers.stopMountProcessSync( - data.Version, - data.Provider, - data.Remote, - data.S3 - ); + helpers.stopMountProcessSync(data.Version, data.Provider, data.Remote, data.S3); } mountedLocations = []; @@ -79,10 +67,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => { let response = { Success: true, Error: '' }; try { - if ( - fs.existsSync(data.Location) && - fs.statSync(data.Location).isDirectory() - ) { + if (fs.existsSync(data.Location) && fs.statSync(data.Location).isDirectory()) { if (fs.readdirSync(data.Location).length !== 0) { response.Success = false; response.Error = 'Directory not empty: ' + data.Location; @@ -102,11 +87,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => { const provider = data.Provider; let driveLetters = {}; - const providerList = [ - ...Constants.PROVIDER_LIST, - ...data.RemoteMounts, - ...data.S3Mounts, - ]; + const providerList = [...Constants.PROVIDER_LIST, ...data.RemoteMounts, ...data.S3Mounts]; for (const provider of providerList) { driveLetters[provider] = []; } @@ -283,12 +264,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => { data.Name = data.Name.replace(':', '_'); } const dataDirectory = path.resolve( - path.join( - helpers.getDataDirectory(), - '..', - data.Remote ? 'remote' : 's3', - data.Name - ) + path.join(helpers.getDataDirectory(), '..', data.Remote ? 'remote' : 's3', data.Name) ); try { diff --git a/src/renderer/ipc/PinnedIPC.js b/src/renderer/ipc/PinnedIPC.js index cd25c63..d3bce3b 100644 --- a/src/renderer/ipc/PinnedIPC.js +++ b/src/renderer/ipc/PinnedIPC.js @@ -4,13 +4,7 @@ const helpers = require('../../helpers'); const addListeners = (ipcMain, { standardIPCReply }) => { ipcMain.on(Constants.IPC_Get_Directory_Items, (event, data) => { helpers - .grabDirectoryItems( - data.Path, - data.Version, - data.Provider, - data.Remote, - data.S3 - ) + .grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3) .then((data) => { standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, { Items: data.items, @@ -23,13 +17,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => { helpers - .grabDirectoryItems( - data.Path, - data.Version, - data.Provider, - data.Remote, - data.S3 - ) + .grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3) .then((data) => { standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, { Items: data.items, @@ -44,14 +32,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => { helpers - .setPinned( - data.Path, - data.Pinned, - data.Version, - data.Provider, - data.Remote, - data.S3 - ) + .setPinned(data.Path, data.Pinned, data.Version, data.Provider, data.Remote, data.S3) .then((success) => { event.returnValue = success; }) diff --git a/src/renderer/ipc/PlatformIPC.js b/src/renderer/ipc/PlatformIPC.js index 570d055..9501d08 100644 --- a/src/renderer/ipc/PlatformIPC.js +++ b/src/renderer/ipc/PlatformIPC.js @@ -36,26 +36,21 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => { .then((data) => { let appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); if (appPlatform === 'unknown') { - helpers.downloadFile( - Constants.LINUX_DETECT_SCRIPT_URL, - scriptFile, - null, - (err) => { - if (err) { - sendResponse(appPlatform, platform); - } else { - helpers - .executeScript(scriptFile) - .then((data) => { - appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); - sendResponse(appPlatform, platform); - }) - .catch(() => { - sendResponse(appPlatform, platform); - }); - } + helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => { + if (err) { + sendResponse(appPlatform, platform); + } else { + helpers + .executeScript(scriptFile) + .then((data) => { + appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); + sendResponse(appPlatform, platform); + }) + .catch(() => { + sendResponse(appPlatform, platform); + }); } - ); + }); } else { sendResponse(appPlatform, platform); } diff --git a/src/renderer/ipc/ReleaseIPC.js b/src/renderer/ipc/ReleaseIPC.js index 50a75bf..017907b 100644 --- a/src/renderer/ipc/ReleaseIPC.js +++ b/src/renderer/ipc/ReleaseIPC.js @@ -13,9 +13,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => { .then((dependencies) => { let exists = false; try { - exists = - fs.existsSync(destination) && - fs.lstatSync(destination).isDirectory(); + exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory(); } catch (e) {} standardIPCReply(event, Constants.IPC_Check_Installed_Reply, { Dependencies: dependencies, @@ -70,9 +68,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => { stream.close(); if (os.platform() !== 'win32') { helpers - .executeAndWait( - 'chmod +x "' + path.join(destination, 'repertory') + '"' - ) + .executeAndWait('chmod +x "' + path.join(destination, 'repertory') + '"') .then(() => { standardIPCReply(event, Constants.IPC_Extract_Release_Complete, { Source: data.Source, diff --git a/src/renderer/ipc/SkynetIPC.js b/src/renderer/ipc/SkynetIPC.js index c1c344b..22c9794 100644 --- a/src/renderer/ipc/SkynetIPC.js +++ b/src/renderer/ipc/SkynetIPC.js @@ -24,12 +24,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => { }); }) .catch((error) => { - standardIPCReply( - event, - Constants.IPC_Grab_Skynet_Tree_Reply, - {}, - error - ); + standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error); }); }); diff --git a/src/renderer/ipc/StateIPC.js b/src/renderer/ipc/StateIPC.js index ef26170..e760cae 100644 --- a/src/renderer/ipc/StateIPC.js +++ b/src/renderer/ipc/StateIPC.js @@ -40,9 +40,7 @@ const addListeners = (ipcMain) => { data.RemoteMounts = data.RemoteMounts || []; data.S3Mounts = data.S3Mounts || []; - const remoteItems = getDirectories( - path.join(helpers.getRepertoryDirectory(), 'remote') - ); + const remoteItems = getDirectories(path.join(helpers.getRepertoryDirectory(), 'remote')); for (const dir of remoteItems) { const name = 'Remote' + dir.replace('_', ':'); if (!data.RemoteMounts || data.RemoteMounts.indexOf(name) === -1) { @@ -55,9 +53,7 @@ const addListeners = (ipcMain) => { } } - const s3Items = getDirectories( - path.join(helpers.getRepertoryDirectory(), 's3') - ); + const s3Items = getDirectories(path.join(helpers.getRepertoryDirectory(), 's3')); for (const dir of s3Items) { const name = 'S3' + dir; if (!data.S3Mounts || data.S3Mounts.indexOf(name) === -1) { diff --git a/src/renderer/ipc/UpgradeIPC.js b/src/renderer/ipc/UpgradeIPC.js index 0a4cbc4..8fdceac 100644 --- a/src/renderer/ipc/UpgradeIPC.js +++ b/src/renderer/ipc/UpgradeIPC.js @@ -3,10 +3,7 @@ const fs = require('fs'); const helpers = require('../../helpers'); const os = require('os'); -const addListeners = ( - ipcMain, - { setIsInstalling, unmountAllDrives, standardIPCReply } -) => { +const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCReply }) => { ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => { let allowSkipVerification = true; @@ -46,10 +43,7 @@ const addListeners = ( //! (data.Sha256.length > 0); if (hasSignature) { try { - const files = helpers.createSignatureFiles( - data.Signature, - Constants.DEV_PUBLIC_KEY - ); + const files = helpers.createSignatureFiles(data.Signature, Constants.DEV_PUBLIC_KEY); tempPub = files.PublicKeyFile; tempSig = files.SignatureFile; } catch (e) { @@ -99,9 +93,7 @@ const addListeners = ( executeInstall(); }) .catch(() => { - errorHandler( - Error('Failed to verify installation package signature') - ); + errorHandler(Error('Failed to verify installation package signature')); }); } else if (hasHash) { helpers diff --git a/src/serviceWorker.js b/src/serviceWorker.js index 1b6d4f8..7e472c4 100644 --- a/src/serviceWorker.js +++ b/src/serviceWorker.js @@ -15,9 +15,7 @@ const isLocalhost = Boolean( // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) ); export function register(config) { @@ -120,9 +118,7 @@ function checkValidServiceWorker(swUrl, config) { } }) .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); + console.log('No internet connection found. App is running in offline mode.'); }); } diff --git a/src/utils.jsx b/src/utils.jsx index 7564810..4811d4c 100644 --- a/src/utils.jsx +++ b/src/utils.jsx @@ -100,9 +100,7 @@ export const getChangesForRepertoryVersion = (version) => { return ( !ended && l.length > 0 && - (found - ? !(ended = l.startsWith('## ')) - : (found = l.startsWith(`## ${version}`))) + (found ? !(ended = l.startsWith('## ')) : (found = l.startsWith(`## ${version}`))) ); }); resolve(lines); @@ -120,11 +118,7 @@ export const getIPCRenderer = () => { return ipcRenderer; }; -export const getNewReleases = ( - existingLocations, - newLocations, - selectedVersion -) => { +export const getNewReleases = (existingLocations, newLocations, selectedVersion) => { const ret = []; if (existingLocations && newLocations) { Constants.RELEASE_TYPES.forEach((release) => {

- -