This commit is contained in:
2021-08-05 13:41:51 -05:00
parent e23c0086c2
commit 33f9ffb393
76 changed files with 1390 additions and 1388 deletions

View File

@@ -1 +1,7 @@
.vimrc
set autoread
set path+=.,public/**,src/**,test/**
if has('win32') || has('win64')
let &makeprg="create_dist.cmd"
else
let &makeprg="./create_dist.sh"
endif

7
.vimrc
View File

@@ -1,7 +0,0 @@
set autoread
set path+=.,public/**,src/**,test/**
if has('win32') || has('win64')
let &makeprg="create_dist.cmd"
else
let &makeprg="./create_dist.sh"
endif

View File

@@ -3,7 +3,7 @@ import './App.css';
import AddEditHost from './containers/AddEditHost/AddEditHost';
import Box from './components/UI/Box/Box';
import Configuration from './containers/Configuration/Configuration';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import DependencyList from './components/DependencyList/DependencyList';
import DownloadProgress from './components/DownloadProgress/DownloadProgress';
import ErrorDetails from './components/ErrorDetails/ErrorDetails';
@@ -13,20 +13,20 @@ import IPCContainer from './containers/IPCContainer/IPCContainer';
import Loading from './components/UI/Loading/Loading';
import MountItems from './containers/MountItems/MountItems';
import NewReleases from './components/NewReleases/NewReleases.jsx';
import {notifyError} from './redux/actions/error_actions';
import { notifyError } from './redux/actions/error_actions';
import Reboot from './components/Reboot/Reboot';
import {
setDismissNewReleasesAvailable,
setNewReleasesAvailable,
} from './redux/actions/release_version_actions';
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
import {saveState} from './redux/actions/common_actions';
import { saveState } from './redux/actions/common_actions';
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 { createModalConditionally } from './utils.jsx';
import SkynetImport from './containers/SkynetImport/SkynetImport';
import ApplicationBusy from './components/ApplicationBusy/ApplicationBusy';
import SkynetExport from './containers/SkynetExport/SkynetExport';
@@ -73,7 +73,7 @@ class App extends IPCContainer {
return this.props.ReleaseVersion === -1
? 'unavailable'
: this.props.VersionLookup[Constants.RELEASE_TYPES[this.props.Release]][
this.props.ReleaseVersion
this.props.ReleaseVersion
];
};
@@ -196,40 +196,40 @@ class App extends IPCContainer {
remoteSupported={remoteSupported}
/>
);
const addEditHostDisplay = createModalConditionally(showAddEditHost, <AddEditHost/>);
const addEditHostDisplay = createModalConditionally(showAddEditHost, <AddEditHost />);
const pinnedManagerDisplay = createModalConditionally(
showPinnedManager,
<PinnedManager version={selectedVersion}/>
<PinnedManager version={selectedVersion} />
);
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo />);
const dependencyDisplay = createModalConditionally(
showDependencies,
<DependencyList/>,
<DependencyList />,
false,
this.props.InstallActive
);
const downloadDisplay = createModalConditionally(
this.props.DownloadActive,
<DownloadProgress/>,
<DownloadProgress />,
false,
true
);
const errorDisplay = createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true);
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails/>, true);
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases/>);
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot/>);
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI/>);
const errorDisplay = createModalConditionally(this.props.DisplayError, <ErrorDetails />, true);
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true);
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />);
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI />);
const importDisplay = createModalConditionally(
showSkynetImport,
<SkynetImport version={selectedVersion}/>
<SkynetImport version={selectedVersion} />
);
const exportDisplay = createModalConditionally(
showSkynetExport,
<SkynetExport version={selectedVersion}/>
<SkynetExport version={selectedVersion} />
);
const appBusyDisplay = createModalConditionally(
this.props.AppBusy,
<ApplicationBusy/>,
<ApplicationBusy />,
false,
true,
this.props.AppBusyTransparent
@@ -239,7 +239,7 @@ class App extends IPCContainer {
if (!this.props.AppReady) {
mainContent = (
<Box col={0} colSpan={'remain'} row={10} rowSpan={'remain'}>
<Loading/>
<Loading />
</Box>
);
} else {
@@ -251,8 +251,8 @@ class App extends IPCContainer {
row={10}
rowSpan={17}
key={'md_' + key++}
dxStyle={{padding: 'var(--default_spacing)'}}>
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled} version={selectedVersion}/>
dxStyle={{ padding: 'var(--default_spacing)' }}>
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled} version={selectedVersion} />
</Box>
);
if (allowMount) {
@@ -261,7 +261,7 @@ class App extends IPCContainer {
row={29}
rowSpan={'remain'}
colSpan={'remain'}
dxStyle={{padding: 'var(--default_spacing)'}}
dxStyle={{ padding: 'var(--default_spacing)' }}
key={'md_' + key++}>
<MountItems
s3Supported={s3Supported}
@@ -279,9 +279,9 @@ class App extends IPCContainer {
colSpan={'remain'}
row={29}
rowSpan={'remain'}
dxStyle={{padding: 'var(--default_spacing)'}}
dxStyle={{ padding: 'var(--default_spacing)' }}
key={'md_' + key++}>
<Loading/>
<Loading />
</Box>
);
}

View File

@@ -4,16 +4,16 @@ import Loader from 'react-loader-spinner';
import Text from '../UI/Text/Text';
import PropTypes from 'prop-types';
const ApplicationBusy = ({title}) => {
const ApplicationBusy = ({ title }) => {
return (
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
<Text text={title || 'Please Wait...'} textAlign={'center'} type={'Heading1'}/>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<Text text={title || 'Please Wait...'} textAlign={'center'} type={'Heading1'} />
<div
style={{
paddingLeft: 'calc(50% - 16px)',
paddingTop: 'var(--default_spacing)',
}}>
<Loader color={'var(--heading_text_color)'} height={32} width={32} type="TailSpin"/>
<Loader color={'var(--heading_text_color)'} height={32} width={32} type="TailSpin" />
</div>
</Box>
);

View File

@@ -2,33 +2,33 @@ import React from 'react';
import './Dependency.css';
import * as Constants from '../../../constants';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
const Dependency = (props) => {
return (
<div className={'Dependency'}>
<table width="100%">
<tbody>
<tr>
<td width="35%">
<h3>{props.name}</h3>
</td>
<td>
{props.AllowDownload ? (
<a
href={'#'}
className={'DependencyLink'}
onClick={() => {
props.onDownload();
return false;
}}>
<u>Install</u>
</a>
) : (
'Installing...'
)}
</td>
</tr>
<tr>
<td width="35%">
<h3>{props.name}</h3>
</td>
<td>
{props.AllowDownload ? (
<a
href={'#'}
className={'DependencyLink'}
onClick={() => {
props.onDownload();
return false;
}}>
<u>Install</u>
</a>
) : (
'Installing...'
)}
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -4,11 +4,11 @@ import * as Constants from '../../constants';
import Box from '../UI/Box/Box';
import Dependency from './Dependency/Dependency';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {createDismissDisplay} from '../../utils.jsx';
import {downloadItem} from '../../redux/actions/download_actions';
import {extractFileNameFromURL} from '../../utils.jsx';
import {setDismissDependencies} from '../../redux/actions/install_actions';
import { connect } from 'react-redux';
import { createDismissDisplay } from '../../utils.jsx';
import { downloadItem } from '../../redux/actions/download_actions';
import { extractFileNameFromURL } from '../../utils.jsx';
import { setDismissDependencies } from '../../redux/actions/install_actions';
const DependencyList = (props) => {
const items = props.MissingDependencies.map((k, i) => {
@@ -29,7 +29,7 @@ const DependencyList = (props) => {
});
return (
<Box dxStyle={{width: '300px', height: 'auto', padding: '5px'}}>
<Box dxStyle={{ width: '300px', height: 'auto', padding: '5px' }}>
{createDismissDisplay(
() => props.setDismissDependencies(true),
!props.AllowDismissDependencies

View File

@@ -2,21 +2,21 @@ import Box from '../UI/Box/Box';
import './DownloadProgress.css';
import PropTypes from 'prop-types';
import React from 'react';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
const DownloadProgress = (props) => {
const width = props.Platform === 'linux' ? '480px' : '380px';
return (
<Box dxStyle={{width: width, height: 'auto', padding: '5px'}}>
<div style={{width: '100%', height: 'auto'}}>
<h1 style={{width: '100%', textAlign: 'center'}}>
<Box dxStyle={{ width: width, height: 'auto', padding: '5px' }}>
<div style={{ width: '100%', height: 'auto' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>
{'Downloading ' + props.DownloadName}
</h1>
</div>
<progress
max={100.0}
id={'download_progress'}
style={{width: '100%'}}
style={{ width: '100%' }}
value={props.DownloadProgress}
/>
</Box>

View File

@@ -3,12 +3,12 @@ import './ErrorDetails.css';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {dismissError} from '../../redux/actions/error_actions';
import { connect } from 'react-redux';
import { dismissError } from '../../redux/actions/error_actions';
const ErrorDetails = (props) => {
return (
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<h1 className={'ErrorDetailsHeading'}>Application Error</h1>
<div className={'ErrorDetailsContent'}>
<p>{props.ErrorMessage}</p>

View File

@@ -3,9 +3,9 @@ import './InfoDetails.css';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {dismissInfo, notifyError} from '../../redux/actions/error_actions';
import {promptLocationAndSaveFile} from '../../utils';
import { connect } from 'react-redux';
import { dismissInfo, notifyError } from '../../redux/actions/error_actions';
import { promptLocationAndSaveFile } from '../../utils';
const InfoDetails = (props) => {
let msg = props.InfoMessage.message;
@@ -36,28 +36,27 @@ const InfoDetails = (props) => {
};
return (
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<h1 className={'InfoDetailsHeading'}>{props.InfoMessage.title}</h1>
<div className={classes.join(' ')}>
{copyable ? (
<textarea
autoFocus
rows={9}
onChange={() => {
}}
onChange={() => {}}
value={msg}
className={'SkynetImportTextArea'}
onClick={(e) => scrollToTop(e.target)}
/>
) : (
<p style={{textAlign: 'left'}}>{msg}</p>
<p style={{ textAlign: 'left' }}>{msg}</p>
)}
</div>
{props.InfoMessage.saveToFile ? (
<div className={'InfoButtonOwner'}>
<Button clicked={props.dismissInfo}>Dismiss</Button>
<Button
buttonStyles={{marginLeft: 'var(--default_spacing)'}}
buttonStyles={{ marginLeft: 'var(--default_spacing)' }}
clicked={() => {
if (
promptLocationAndSaveFile(

View File

@@ -2,23 +2,23 @@ import React from 'react';
import * as Constants from '../../../constants';
import Button from '../../UI/Button/Button';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
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';
import { connect } from 'react-redux';
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';
const NewRelease = ({
ActiveRelease,
ActiveVersion,
dismiss,
release,
lastItem,
notifyError,
notifyInfo,
setActiveRelease,
unmountAll,
}) => {
ActiveRelease,
ActiveVersion,
dismiss,
release,
lastItem,
notifyError,
notifyInfo,
setActiveRelease,
unmountAll,
}) => {
const title = '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
const displayChanges = async () => {
try {
@@ -42,25 +42,25 @@ const NewRelease = ({
<h2>{title}</h2>
<table cellSpacing={0} cellPadding={0} width="97%">
<tbody>
<tr style={{height: '4px'}}/>
<tr>
<td width="50%">
<Button buttonStyles={{width: '100%'}} clicked={displayChanges}>
Changes
</Button>
</td>
<td>
<div style={{width: 'var(--default_spacing)'}}/>
</td>
<td width="50%">
{!isActiveRelease ? (
<Button buttonStyles={{width: '100%'}} clicked={setReleaseAndVersion}>
Activate
<tr style={{ height: '4px' }} />
<tr>
<td width="50%">
<Button buttonStyles={{ width: '100%' }} clicked={displayChanges}>
Changes
</Button>
) : null}
</td>
</tr>
{lastItem ? null : <tr style={{height: 'var(--default_spacing)'}}/>}
</td>
<td>
<div style={{ width: 'var(--default_spacing)' }} />
</td>
<td width="50%">
{!isActiveRelease ? (
<Button buttonStyles={{ width: '100%' }} clicked={setReleaseAndVersion}>
Activate
</Button>
) : null}
</td>
</tr>
{lastItem ? null : <tr style={{ height: 'var(--default_spacing)' }} />}
</tbody>
</table>
</div>

View File

@@ -4,8 +4,8 @@ import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import NewRelease from './NewRelease/NewRelease.jsx';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {setDismissNewReleasesAvailable} from '../../redux/actions/release_version_actions';
import { connect } from 'react-redux';
import { setDismissNewReleasesAvailable } from '../../redux/actions/release_version_actions';
const NewReleases = (props) => {
const newReleases = props.NewReleasesAvailable.map((i, idx) => {
@@ -20,7 +20,7 @@ const NewReleases = (props) => {
});
return (
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<h1 className={'NewReleasesHeading'}>New Repertory Versions Available</h1>
<div className={'NewReleasesContent'}>{newReleases}</div>
<Button clicked={props.dismissNewReleasesAvailable}>Dismiss</Button>

View File

@@ -3,12 +3,12 @@ import './Reboot.css';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {rebootSystem} from '../../redux/actions/common_actions';
import { connect } from 'react-redux';
import { rebootSystem } from '../../redux/actions/common_actions';
const Reboot = (props) => {
return (
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<h1 className={'RebootHeading'}>Reboot System</h1>
<div className={'RebootContent'}>
<p>Repertory requires a system reboot to continue.</p>

View File

@@ -7,9 +7,9 @@ import Grid from '../UI/Grid/Grid';
import PropTypes from 'prop-types';
import Text from '../UI/Text/Text';
import UpgradeIcon from '../UpgradeIcon/UpgradeIcon';
import {connect} from 'react-redux';
import {downloadItem} from '../../redux/actions/download_actions';
import {setActiveRelease} from '../../redux/actions/release_version_actions';
import { connect } from 'react-redux';
import { downloadItem } from '../../redux/actions/download_actions';
import { setActiveRelease } from '../../redux/actions/release_version_actions';
const ReleaseVersionDisplay = (props) => {
const getSelectedVersion = () => {

View File

@@ -18,7 +18,7 @@ const Box = (props) => {
}
return (
<div onClick={props.clicked} className={styleList.join(' ')} style={{...props.dxStyle}}>
<div onClick={props.clicked} className={styleList.join(' ')} style={{ ...props.dxStyle }}>
{props.children}
</div>
);

View File

@@ -14,7 +14,7 @@ const CheckBox = (props) => {
onChange={props.changed}
type="checkbox"
/>
<span className="CheckBoxCheckMark"/>
<span className="CheckBoxCheckMark" />
</label>
</div>
);

View File

@@ -1,4 +1,4 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import './Grid.css';
import GridComponent from './GridComponent/GridComponent';
import PropTypes from 'prop-types';

View File

@@ -6,7 +6,7 @@ const Loading = () => {
return (
<div className={'Loading'}>
<div className={'LoadingContent'}>
<Loader color={'var(--heading_text_color)'} height={28} width={28} type="ThreeDots"/>
<Loader color={'var(--heading_text_color)'} height={28} width={28} type="ThreeDots" />
</div>
</div>
);

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
const RootElem = (props) => {
return (
<div style={{margin: 0, padding: 0}} {...props}>
<div style={{ margin: 0, padding: 0 }} {...props}>
{props.children}
</div>
);

View File

@@ -9,7 +9,7 @@ const Text = (props) => {
styleList.push('Text' + props.type);
}
let style = {...props.style};
let style = { ...props.style };
if (props.textAlign) {
style['textAlign'] = props.textAlign.toLowerCase();
}

View File

@@ -2,8 +2,8 @@ import './UpgradeIcon.css';
import PropTypes from 'prop-types';
import React from 'react';
import ReactTooltip from 'react-tooltip';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faExclamationTriangle} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
const UpgradeIcon = (props) => {
const styles = ['UpgradeIcon'];
@@ -22,7 +22,7 @@ const UpgradeIcon = (props) => {
<div className={'UpgradeIconOwner'}>
<p data-tip="" data-for={placement}>
<a href={'#'} className={styles.join(' ')} onClick={props.clicked}>
<FontAwesomeIcon icon={faExclamationTriangle}/>
<FontAwesomeIcon icon={faExclamationTriangle} />
</a>
</p>
<ReactTooltip id={placement} place={placement}>

View File

@@ -1,12 +1,12 @@
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import './UpgradeUI.css';
import * as Constants from '../../constants';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import PropTypes from 'prop-types';
import React from 'react';
import {downloadItem} from '../../redux/actions/download_actions';
import {setDismissUIUpgrade} from '../../redux/actions/release_version_actions';
import { downloadItem } from '../../redux/actions/download_actions';
import { setDismissUIUpgrade } from '../../redux/actions/release_version_actions';
const UpgradeUI = (props) => {
const handleDownload = () => {
@@ -14,32 +14,32 @@ const UpgradeUI = (props) => {
props.Platform === 'win32'
? 'upgrade.exe'
: props.Platform === 'darwin'
? 'upgrade.dmg'
: 'repertory-ui_' + props.UpgradeVersion + '_linux_x86_64.AppImage';
? 'upgrade.dmg'
: 'repertory-ui_' + props.UpgradeVersion + '_linux_x86_64.AppImage';
props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, props.UpgradeData.urls);
};
return (
<Box dxStyle={{width: '180px', height: 'auto', padding: '5px'}}>
<div style={{width: '100%', height: 'auto'}}>
<h1 style={{width: '100%', textAlign: 'center'}}>UI Upgrade Available</h1>
<Box dxStyle={{ width: '180px', height: 'auto', padding: '5px' }}>
<div style={{ width: '100%', height: 'auto' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>UI Upgrade Available</h1>
</div>
<table cellSpacing={5} width="100%">
<tbody>
<tr>
<td width="50%">
<Button buttonStyles={{width: '100%'}} clicked={handleDownload}>
Install
</Button>
</td>
<td width="50%">
<Button
buttonStyles={{width: '100%'}}
clicked={() => props.setDismissUIUpgrade(true)}>
Cancel
</Button>
</td>
</tr>
<tr>
<td width="50%">
<Button buttonStyles={{ width: '100%' }} clicked={handleDownload}>
Install
</Button>
</td>
<td width="50%">
<Button
buttonStyles={{ width: '100%' }}
clicked={() => props.setDismissUIUpgrade(true)}>
Cancel
</Button>
</td>
</tr>
</tbody>
</table>
</Box>

View File

@@ -3,8 +3,8 @@ import './YesNo.css';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import PropTypes from 'prop-types';
import {confirmYesNoAction} from '../../redux/actions/common_actions';
import {connect} from 'react-redux';
import { confirmYesNoAction } from '../../redux/actions/common_actions';
import { connect } from 'react-redux';
const YesNo = (props) => {
return (
@@ -14,23 +14,23 @@ const YesNo = (props) => {
height: 'auto',
padding: 'var(--default_spacing)',
}}>
<div style={{width: '100%', height: 'auto'}}>
<h1 style={{width: '100%', textAlign: 'center'}}>{props.Title}</h1>
<div style={{ width: '100%', height: 'auto' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>{props.Title}</h1>
</div>
<table cellSpacing={5} width="100%">
<tbody>
<tr>
<td width="50%">
<Button buttonStyles={{width: '100%'}} clicked={() => props.confirm(true)}>
Yes
</Button>
</td>
<td width="50%">
<Button buttonStyles={{width: '100%'}} clicked={() => props.confirm(false)}>
No
</Button>
</td>
</tr>
<tr>
<td width="50%">
<Button buttonStyles={{ width: '100%' }} clicked={() => props.confirm(true)}>
Yes
</Button>
</td>
<td width="50%">
<Button buttonStyles={{ width: '100%' }} clicked={() => props.confirm(false)}>
No
</Button>
</td>
</tr>
</tbody>
</table>
</Box>

View File

@@ -1,4 +1,4 @@
Object.defineProperty(exports, '__esModule', {value: true});
Object.defineProperty(exports, '__esModule', { value: true });
exports.DEV_PUBLIC_KEY =
'-----BEGIN PUBLIC KEY-----\n' +
'MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEKfZmq5mMAtD4kSt2Gc/5J\n' +

View File

@@ -5,11 +5,11 @@ import DropDown from '../../components/UI/DropDown/DropDown';
import IPCContainer from '../IPCContainer/IPCContainer';
import PropTypes from 'prop-types';
import Text from '../../components/UI/Text/Text';
import {addEditHostAction} from '../../redux/actions/host_actions';
import {connect} from 'react-redux';
import {createDismissDisplay} from '../../utils.jsx';
import {notifyApplicationBusy} from '../../redux/actions/common_actions';
import {notifyError, notifyInfo} from '../../redux/actions/error_actions';
import { addEditHostAction } from '../../redux/actions/host_actions';
import { connect } from 'react-redux';
import { createDismissDisplay } from '../../utils.jsx';
import { notifyApplicationBusy } from '../../redux/actions/common_actions';
import { notifyError, notifyInfo } from '../../redux/actions/error_actions';
const Constants = require('../../constants');
@@ -31,7 +31,7 @@ class AddEditHost extends IPCContainer {
this.setRequestHandler(Constants.IPC_Skynet_Test_Logon_Reply, this.onSkynetTestLogonReply);
if (this.props.HostData) {
this.setState({...this.state, ...this.props.HostData});
this.setState({ ...this.state, ...this.props.HostData });
}
}
@@ -98,7 +98,7 @@ class AddEditHost extends IPCContainer {
const allowTestLogon = this.state.AuthURL && this.state.AuthUser;
return (
<Box dxDark dxStyle={{width: '430px', height: 'auto', padding: '5px'}}>
<Box dxDark dxStyle={{ width: '430px', height: 'auto', padding: '5px' }}>
{createDismissDisplay(this.props.Close)}
<div
style={{
@@ -115,86 +115,86 @@ class AddEditHost extends IPCContainer {
}}>
Portal Settings
</h1>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Host / IP'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Host / IP'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({HostNameOrIp: e.target.value.trim()})}
onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'text'}
value={this.state.HostNameOrIp}
/>
</div>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Protocol'} textAlign={'left'} type={'Heading2'}/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<Text text={'Port'} textAlign={'left'} type={'Heading2'}/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<Text text={'Timeout (ms)'} textAlign={'left'} type={'Heading2'}/>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Protocol'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Port'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Timeout (ms)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<DropDown
changed={(e) => this.setState({Protocol: e.target.value})}
changed={(e) => this.setState({ Protocol: e.target.value })}
items={['https', 'http']}
selected={this.state.Protocol}
/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{ width: 'var(--default_spacing)' }} />
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) => this.setState({ApiPort: parseInt(e.target.value)})}
onChange={(e) => this.setState({ ApiPort: parseInt(e.target.value) })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'number'}
min={1}
max={65535}
value={this.state.ApiPort}
/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{ width: 'var(--default_spacing)' }} />
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) => this.setState({TimeoutMs: parseInt(e.target.value)})}
onChange={(e) => this.setState({ TimeoutMs: parseInt(e.target.value) })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'number'}
min={1000}
step={1000}
value={this.state.TimeoutMs}
/>
</div>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Agent String (optional)'} textAlign={'left'} type={'Heading2'}/>
<div style={{width: 'var(--default_spacing)'}}/>
<Text text={'API Key (optional)'} textAlign={'left'} type={'Heading2'}/>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Agent String (optional)'} textAlign={'left'} type={'Heading2'} />
<div style={{ width: 'var(--default_spacing)' }} />
<Text text={'API Key (optional)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({AgentString: e.target.value})}
onChange={(e) => this.setState({ AgentString: e.target.value })}
className={'ConfigurationItemInput'}
style={{flex: '1'}}
style={{ flex: '1' }}
type={'text'}
value={this.state.AgentString}
/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) => this.setState({ApiPassword: e.target.value})}
onChange={(e) => this.setState({ ApiPassword: e.target.value })}
className={'ConfigurationItemInput'}
style={{flex: '1'}}
style={{ flex: '1' }}
type={'text'}
value={this.state.ApiPassword}
/>
</div>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text
noOwner
text={'Authentication URL (premium)'}
textAlign={'left'}
type={'Heading2'}
style={{marginRight: 'auto'}}
style={{ marginRight: 'auto' }}
/>
{allowTestLogon ? (
<a
@@ -207,51 +207,51 @@ class AddEditHost extends IPCContainer {
</a>
) : null}
</div>
<div style={{display: 'flex', flexDirection: 'column'}}>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<input
onChange={(e) => this.setState({AuthURL: e.target.value})}
onChange={(e) => this.setState({ AuthURL: e.target.value })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.AuthURL}
/>
</div>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'User Name (premium)'} textAlign={'left'} type={'Heading2'}/>
<div style={{width: 'var(--default_spacing)'}}/>
<Text text={'Password (premium)'} textAlign={'left'} type={'Heading2'}/>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'User Name (premium)'} textAlign={'left'} type={'Heading2'} />
<div style={{ width: 'var(--default_spacing)' }} />
<Text text={'Password (premium)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({AuthUser: e.target.value})}
onChange={(e) => this.setState({ AuthUser: e.target.value })}
className={'ConfigurationItemInput'}
style={{flex: '1'}}
style={{ flex: '1' }}
type={'text'}
value={this.state.AuthUser}
/>
<div style={{width: 'var(--default_spacing)'}}/>
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) => this.setState({AuthPassword: e.target.value})}
onChange={(e) => this.setState({ AuthPassword: e.target.value })}
className={'ConfigurationItemInput'}
style={{flex: '1'}}
style={{ flex: '1' }}
type={'text'}
value={this.state.AuthPassword}
/>
</div>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{ height: 'var(--default_spacing)' }} />
<p>
<b>
{'Portal URL: ' +
this.state.Protocol +
'://' +
this.state.HostNameOrIp +
((this.state.Protocol === 'http' && this.state.ApiPort != 80) ||
(this.state.Protocol === 'https' && this.state.ApiPort != 443)
? ':' + this.state.ApiPort.toString()
: '')}
this.state.Protocol +
'://' +
this.state.HostNameOrIp +
((this.state.Protocol === 'http' && this.state.ApiPort != 80) ||
(this.state.Protocol === 'https' && this.state.ApiPort != 443)
? ':' + this.state.ApiPort.toString()
: '')}
</b>
</p>
<div style={{height: 'var(--default_spacing)'}}/>
<div style={{ height: 'var(--default_spacing)' }} />
</div>
<Button clicked={this.handleSave}>Save</Button>
</Box>
@@ -270,7 +270,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
Close: () => dispatch(addEditHostAction.complete(false)),
completeAddEditHost: (host_data) => dispatch(addEditHostAction.complete(true, {host_data})),
completeAddEditHost: (host_data) => dispatch(addEditHostAction.complete(true, { host_data })),
notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (msg) => dispatch(notifyInfo(msg)),

View File

@@ -1,14 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
import {Component} from 'react';
import { Component } from 'react';
import './AddMount.css';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import Button from '../../components/UI/Button/Button';
import Box from '../../components/UI/Box/Box';
import Text from '../../components/UI/Text/Text';
import {notifyError} from '../../redux/actions/error_actions';
import {addRemoteMount, addS3Mount} from '../../redux/actions/mount_actions';
import {createModalConditionally} from '../../utils.jsx';
import { notifyError } from '../../redux/actions/error_actions';
import { addRemoteMount, addS3Mount } from '../../redux/actions/mount_actions';
import { createModalConditionally } from '../../utils.jsx';
import DropDown from '../../components/UI/DropDown/DropDown';
import * as Constants from '../../constants';
@@ -129,40 +129,40 @@ class AddMount extends Component {
}}>
Add Remote Mount
</h1>
<Text text={'Hostname or IP'} textAlign={'left'} type={'Heading2'}/>
<Text text={'Hostname or IP'} textAlign={'left'} type={'Heading2'} />
<input
onChange={(e) => this.setState({HostNameOrIp: e.target.value.trim()})}
onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.HostNameOrIp}
/>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<Text text={'Port'} textAlign={'left'} type={'Heading2'}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
<Text text={'Port'} textAlign={'left'} type={'Heading2'} />
<input
max={65535}
min={1025}
onChange={(e) => this.setState({Port: e.target.value})}
onChange={(e) => this.setState({ Port: e.target.value })}
className={'ConfigurationItemInput'}
type={'number'}
value={this.state.Port}
/>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<Text text={'Remote Token'} textAlign={'left'} type={'Heading2'}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
<Text text={'Remote Token'} textAlign={'left'} type={'Heading2'} />
<input
onChange={(e) => this.setState({Token: e.target.value})}
onChange={(e) => this.setState({ Token: e.target.value })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.Token}
/>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Button buttonStyles={{width: '100%'}} clicked={() => this.addRemoteMount()}>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Button buttonStyles={{ width: '100%' }} clicked={() => this.addRemoteMount()}>
OK
</Button>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Button
buttonStyles={{width: '100%'}}
clicked={() => this.setState({DisplayRemote: false})}>
buttonStyles={{ width: '100%' }}
clicked={() => this.setState({ DisplayRemote: false })}>
Cancel
</Button>
</div>
@@ -185,20 +185,20 @@ class AddMount extends Component {
}}>
Add S3 Mount
</h1>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Name'} textAlign={'left'} type={'Heading2'}/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<Text text={'Provider'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Name'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Provider'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({Name: e.target.value.trim()})}
onChange={(e) => this.setState({ Name: e.target.value.trim() })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'text'}
value={this.state.Name}
/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<DropDown
changed={(e) =>
this.setState({
@@ -206,45 +206,45 @@ class AddMount extends Component {
Region:
Constants.S3_REGION_PROVIDER_REGION[
Constants.S3_PROVIDER_LIST.indexOf(e.target.value)
][0],
][0],
})
}
items={Constants.S3_PROVIDER_LIST}
selected={this.state.Provider}
/>
</div>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
{this.state.Provider === Constants.S3_CUSTOM_PROVIDER ? (
<div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Custom URL'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Custom URL'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({CustomURL: e.target.value})}
onChange={(e) => this.setState({ CustomURL: e.target.value })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'text'}
value={this.state.CustomURL}
/>
</div>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
</div>
) : null}
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Bucket Name (optional)'} textAlign={'left'} type={'Heading2'}/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<Text text={'Region'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Bucket Name (optional)'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Region'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({BucketName: e.target.value})}
onChange={(e) => this.setState({ BucketName: e.target.value })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'text'}
value={this.state.BucketName}
/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<DropDown
changed={(e) =>
this.setState({
@@ -254,61 +254,61 @@ class AddMount extends Component {
items={
Constants.S3_REGION_PROVIDER_REGION[
Constants.S3_PROVIDER_LIST.indexOf(this.state.Provider)
]
]
}
selected={this.state.Region}
/>
</div>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
{this.state.Region === Constants.S3_CUSTOM_REGION ? (
<div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{paddingLeft: 'var(--default_spacing)', width: '100%'}}/>
<Text text={'Custom Region'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ paddingLeft: 'var(--default_spacing)', width: '100%' }} />
<Text text={'Custom Region'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{paddingLeft: 'var(--default_spacing)', width: '100%'}}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ paddingLeft: 'var(--default_spacing)', width: '100%' }} />
<input
onChange={(e) => this.setState({CustomRegion: e.target.value})}
onChange={(e) => this.setState({ CustomRegion: e.target.value })}
className={'ConfigurationItemInput'}
style={{width: '100%'}}
style={{ width: '100%' }}
type={'text'}
value={this.state.CustomRegion}
/>
</div>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
</div>
) : null}
<div style={{display: 'flex', flexDirection: 'row'}}>
<Text text={'Access Key'} textAlign={'left'} type={'Heading2'}/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<Text text={'Secret Key'} textAlign={'left'} type={'Heading2'}/>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text text={'Access Key'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Secret Key'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) => this.setState({AccessKey: e.target.value})}
onChange={(e) => this.setState({ AccessKey: e.target.value })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.AccessKey}
/>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<input
onChange={(e) => this.setState({SecretKey: e.target.value})}
onChange={(e) => this.setState({ SecretKey: e.target.value })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.SecretKey}
/>
</div>
<div style={{paddingTop: 'calc(var(--default_spacing) * 2)'}}/>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{width: '200%'}}/>
<Button buttonStyles={{width: '100%'}} clicked={() => this.addS3Mount()}>
<div style={{ paddingTop: 'calc(var(--default_spacing) * 2)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ width: '200%' }} />
<Button buttonStyles={{ width: '100%' }} clicked={() => this.addS3Mount()}>
OK
</Button>
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Button
buttonStyles={{width: '100%'}}
clicked={() => this.setState({DisplayS3: false})}>
buttonStyles={{ width: '100%' }}
clicked={() => this.setState({ DisplayS3: false })}>
Cancel
</Button>
</div>
@@ -326,7 +326,7 @@ class AddMount extends Component {
</Button>
) : null}
{this.props.remoteSupported && this.props.s3Supported ? (
<div style={{paddingRight: 'var(--default_spacing)'}}/>
<div style={{ paddingRight: 'var(--default_spacing)' }} />
) : null}
{this.props.s3Supported ? (
<Button className={'AddMountButton'} clicked={this.handleAddS3Mount}>

View File

@@ -6,11 +6,11 @@ import ConfigurationItem from './ConfigurationItem/ConfigurationItem';
import IPCContainer from '../IPCContainer/IPCContainer';
import Modal from '../../components/UI/Modal/Modal';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {createDismissDisplay} from '../../utils.jsx';
import {displayConfiguration} from '../../redux/actions/mount_actions';
import {displayPinnedManager} from '../../redux/actions/pinned_manager_actions';
import {notifyError} from '../../redux/actions/error_actions';
import { connect } from 'react-redux';
import { createDismissDisplay } from '../../utils.jsx';
import { displayConfiguration } from '../../redux/actions/mount_actions';
import { displayPinnedManager } from '../../redux/actions/pinned_manager_actions';
import { notifyError } from '../../redux/actions/error_actions';
const Constants = require('../../constants');
@@ -113,30 +113,30 @@ class Configuration extends IPCContainer {
createItemList = (config, template) => {
const objectList = [];
const itemList = Object.keys(config)
.map((key) => {
return {
advanced: template[key] ? template[key].advanced : false,
hide_remote: template[key] ? template[key].hide_remote : false,
label: key,
remote: template[key] ? template[key].remote : false,
type: template[key] ? template[key].type : null,
value:
template[key] &&
(template[key].type === 'string_array' || template[key].type === 'object')
? config[key]
: template[key] && template[key].type === 'host_list'
.map((key) => {
return {
advanced: template[key] ? template[key].advanced : false,
hide_remote: template[key] ? template[key].hide_remote : false,
label: key,
remote: template[key] ? template[key].remote : false,
type: template[key] ? template[key].type : null,
value:
template[key] &&
(template[key].type === 'string_array' || template[key].type === 'object')
? config[key]
: template[key] && template[key].type === 'host_list'
? config[key]
: config[key].toString(),
};
})
.filter((i) => {
let ret = template[i.label];
if (ret && template[i.label].type === 'object') {
objectList.push(i);
ret = false;
}
return ret;
});
};
})
.filter((i) => {
let ret = template[i.label];
if (ret && template[i.label].type === 'object') {
objectList.push(i);
ret = false;
}
return ret;
});
return {
ObjectList: objectList,
ItemList: itemList,
@@ -149,8 +149,8 @@ class Configuration extends IPCContainer {
target.type === 'textarea'
? target.string_array
: target.type === 'host_list'
? target.value
: target.value.toString();
? target.value
: target.value.toString();
this.setState({
ItemList: itemList,
});
@@ -166,8 +166,8 @@ class Configuration extends IPCContainer {
target.type === 'textarea'
? target.string_array
: target.type === 'host_list'
? target.value
: target.value.toString();
? target.value
: target.value.toString();
objectLookup[name] = itemList;
this.setState({
ObjectLookup: objectLookup,
@@ -205,8 +205,7 @@ class Configuration extends IPCContainer {
OriginalItemList: itemListCopy,
OriginalObjectLookup: objectLookupCopy,
},
() => {
}
() => {}
);
} else {
this.props.notifyError(arg.data.Error);
@@ -254,8 +253,8 @@ class Configuration extends IPCContainer {
item.type === 'string_array'
? item.value.join(';')
: item.type === 'host_list'
? JSON.stringify(item.value)
: item.value,
? JSON.stringify(item.value)
: item.value,
};
});
@@ -269,8 +268,8 @@ class Configuration extends IPCContainer {
item.type === 'string_array'
? item.value.join(';')
: item.type === 'host_list'
? JSON.stringify(item.value)
: item.value,
? JSON.stringify(item.value)
: item.value,
};
})
);
@@ -301,13 +300,13 @@ class Configuration extends IPCContainer {
return item.label === 'RemoteHostNameOrIp' || item.label === 'RemoteMaxConnections'
? isRemoteMount
: item.label === 'RemoteReceiveTimeoutSeconds' ||
item.label === 'RemoteSendTimeoutSeconds' ||
item.label === 'RemotePort' ||
item.label === 'RemoteToken'
? isRemoteMount || enableRemoteMount
: item.label === 'EnableRemoteMount'
? !isRemoteMount
: enableRemoteMount;
item.label === 'RemoteSendTimeoutSeconds' ||
item.label === 'RemotePort' ||
item.label === 'RemoteToken'
? isRemoteMount || enableRemoteMount
: item.label === 'EnableRemoteMount'
? !isRemoteMount
: enableRemoteMount;
}
return false;
};
@@ -317,22 +316,22 @@ class Configuration extends IPCContainer {
if (this.state.ChangedItems.length > 0 || this.state.ChangedObjectLookup) {
confirmSave = (
<Modal>
<Box dxStyle={{width: '40vw', padding: 'var(--default_spacing)'}}>
<h1 style={{width: '100%', textAlign: 'center'}}>Save Changes?</h1>
<Box dxStyle={{ width: '40vw', padding: 'var(--default_spacing)' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>Save Changes?</h1>
<table width="100%">
<tbody>
<tr>
<td align="center" width="50%">
<Button clicked={this.saveAndClose} disabled={this.state.Saving}>
Yes
</Button>
</td>
<td align="center" width="50%">
<Button clicked={this.props.hideConfiguration} disabled={this.state.Saving}>
No
</Button>
</td>
</tr>
<tr>
<td align="center" width="50%">
<Button clicked={this.saveAndClose} disabled={this.state.Saving}>
Yes
</Button>
</td>
<td align="center" width="50%">
<Button clicked={this.props.hideConfiguration} disabled={this.state.Saving}>
No
</Button>
</td>
</tr>
</tbody>
</table>
</Box>
@@ -354,30 +353,30 @@ class Configuration extends IPCContainer {
<h2>{key}</h2>
<div>
{this.state.ObjectLookup[key]
.map((k, i) => {
const shouldFocus = getAutoFocus();
setAutoFocus(false);
return !k.advanced ||
(this.state.ShowAdvanced && k.advanced && !k.remote) ||
this.showRemoteConfigItem(k, this.state.ObjectLookup[key]) ? (
<ConfigurationItem
advanced={k.advanced}
autoFocus={shouldFocus}
changed={(e) => this.handleObjectItemChanged(e, key, i)}
grouping={key}
items={this.state.Template[key].template[k.label].items}
key={i}
label={k.label}
readOnly={
this.state.IsRemoteMount &&
(k.label === 'RemoteHostNameOrIp' || k.label === 'RemotePort')
}
template={this.state.Template[key].template[k.label]}
value={k.value}
/>
) : null;
})
.filter((i) => i !== null)}
.map((k, i) => {
const shouldFocus = getAutoFocus();
setAutoFocus(false);
return !k.advanced ||
(this.state.ShowAdvanced && k.advanced && !k.remote) ||
this.showRemoteConfigItem(k, this.state.ObjectLookup[key]) ? (
<ConfigurationItem
advanced={k.advanced}
autoFocus={shouldFocus}
changed={(e) => this.handleObjectItemChanged(e, key, i)}
grouping={key}
items={this.state.Template[key].template[k.label].items}
key={i}
label={k.label}
readOnly={
this.state.IsRemoteMount &&
(k.label === 'RemoteHostNameOrIp' || k.label === 'RemotePort')
}
template={this.state.Template[key].template[k.label]}
value={k.value}
/>
) : null;
})
.filter((i) => i !== null)}
</div>
</div>
);
@@ -387,7 +386,7 @@ class Configuration extends IPCContainer {
const shouldFocus = autoFocus;
autoFocus = false;
return (!this.state.IsRemoteMount || !k.hide_remote) &&
(!k.advanced || (this.state.ShowAdvanced && k.advanced)) ? (
(!k.advanced || (this.state.ShowAdvanced && k.advanced)) ? (
<ConfigurationItem
advanced={k.advanced}
autoFocus={shouldFocus}
@@ -405,16 +404,16 @@ class Configuration extends IPCContainer {
return (
<div className={'Configuration'}>
{confirmSave}
<Box dxDark dxStyle={{padding: '5px'}}>
<Box dxDark dxStyle={{ padding: '5px' }}>
{createDismissDisplay(this.checkSaveRequired)}
<h1 style={{width: '100%', textAlign: 'center'}}>
<h1 style={{ width: '100%', textAlign: 'center' }}>
{(this.props.DisplayRemoteConfiguration
? this.props.DisplayConfiguration.substr(6)
: this.props.DisplayS3Configuration
? this.props.DisplayConfiguration.substr(2)
: this.props.DisplayConfiguration) + ' Configuration '}
? this.props.DisplayConfiguration.substr(2)
: this.props.DisplayConfiguration) + ' Configuration '}
</h1>
<div style={{overflowY: 'auto', height: '90%'}}>
<div style={{ overflowY: 'auto', height: '90%' }}>
{this.props.MState.Mounted && configurationItems.length > 0 ? (
<Button
buttonStyles={{
@@ -430,7 +429,7 @@ class Configuration extends IPCContainer {
&nbsp;Pinned File Manager...&nbsp;
</Button>
) : null}
<div style={{marginBottom: '4px'}}/>
<div style={{ marginBottom: '4px' }} />
{objectItems}
{configurationItems.length > 0 ? <h2>Settings</h2> : null}
{configurationItems}

View File

@@ -6,10 +6,10 @@ import HostList from '../../HostList/HostList';
import Password from '../../../containers/UI/Password/Password';
import PropTypes from 'prop-types';
import settings from '../../../assets/settings';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {connect} from 'react-redux';
import {faInfoCircle} from '@fortawesome/free-solid-svg-icons';
import {notifyError, notifyInfo} from '../../../redux/actions/error_actions';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { notifyError, notifyInfo } from '../../../redux/actions/error_actions';
const ConfigurationItem = (props) => {
const handleChanged = (e) => {
@@ -37,7 +37,7 @@ const ConfigurationItem = (props) => {
displayInfo();
return false;
}}>
<FontAwesomeIcon icon={faInfoCircle}/>
<FontAwesomeIcon icon={faInfoCircle} />
</a>
);
}
@@ -236,18 +236,18 @@ const ConfigurationItem = (props) => {
<div className={'ConfigurationItem'}>
<table cellPadding="2" width="100%">
<tbody>
<tr>
{infoDisplay ? (
<td width="100%" valign={'top'}>
{infoDisplay} {props.label}
</td>
) : (
<td width="100%" valign={'top'}>
{props.label}
</td>
)}
<td>{data}</td>
</tr>
<tr>
{infoDisplay ? (
<td width="100%" valign={'top'}>
{infoDisplay} {props.label}
</td>
) : (
<td width="100%" valign={'top'}>
{props.label}
</td>
)}
<td>{data}</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -1,20 +1,20 @@
import React from 'react';
import PropTypes from 'prop-types';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {addEditHostAction} from '../../../redux/actions/host_actions';
import {connect} from 'react-redux';
import {faTrashAlt, faEdit} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { addEditHostAction } from '../../../redux/actions/host_actions';
import { connect } from 'react-redux';
import { faTrashAlt, faEdit } from '@fortawesome/free-solid-svg-icons';
const mapDispatchToProps = (dispatch) => {
return {
editHost: (host_list, host_data, cb) =>
dispatch(addEditHostAction.display(true, cb, {host_list, host_data})),
dispatch(addEditHostAction.display(true, cb, { host_list, host_data })),
};
};
const Host = ({allowDelete, editHost, host_list, host_data, onChange, onDelete}) => {
const Host = ({ allowDelete, editHost, host_list, host_data, onChange, onDelete }) => {
const handleEditHost = () => {
editHost(host_list, host_data, (changed, {host_data}) => {
editHost(host_list, host_data, (changed, { host_data }) => {
if (changed) {
onChange(host_data);
}
@@ -33,14 +33,14 @@ const Host = ({allowDelete, editHost, host_list, host_data, onChange, onDelete})
const premium = host_data.AuthURL && host_data.AuthUser;
return (
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div
style={{
flex: 0,
paddingRight: 'calc(var(--default_spacing) * 1.25)',
}}>
<a href={'#'} onClick={handleEditHost}>
<FontAwesomeIcon icon={faEdit}/>
<FontAwesomeIcon icon={faEdit} />
</a>
</div>
{allowDelete ? (
@@ -50,7 +50,7 @@ const Host = ({allowDelete, editHost, host_list, host_data, onChange, onDelete})
paddingRight: 'calc(var(--default_spacing) * 1.25)',
}}>
<a href={'#'} onClick={onDelete}>
<FontAwesomeIcon icon={faTrashAlt}/>
<FontAwesomeIcon icon={faTrashAlt} />
</a>
</div>
) : null}

View File

@@ -2,12 +2,12 @@ import React from 'react';
import './HostList.css';
import Host from './Host/Host';
import PropTypes from 'prop-types';
import {Component} from 'react';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {confirmYesNoAction} from '../../redux/actions/common_actions';
import {connect} from 'react-redux';
import {addEditHostAction} from '../../redux/actions/host_actions';
import {faPlusCircle} from '@fortawesome/free-solid-svg-icons';
import { Component } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { confirmYesNoAction } from '../../redux/actions/common_actions';
import { connect } from 'react-redux';
import { addEditHostAction } from '../../redux/actions/host_actions';
import { faPlusCircle } from '@fortawesome/free-solid-svg-icons';
class HostList extends Component {
state = {
@@ -18,14 +18,13 @@ class HostList extends Component {
// type={props.template.subtype}
componentDidMount() {
this.setState({items: this.props.value});
this.setState({ items: this.props.value });
}
componentWillUnmount() {
}
componentWillUnmount() {}
handleAddHost = () => {
this.props.AddHost(this.state.items, (changed, {host_data}) => {
this.props.AddHost(this.state.items, (changed, { host_data }) => {
if (changed) {
const items = [...this.state.items, host_data];
this.updateItems(items);
@@ -66,7 +65,7 @@ class HostList extends Component {
render() {
let idx = 0;
return (
<div style={{display: 'flex', flexDirection: 'column'}}>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div
style={{
maxHeight: '80px',
@@ -95,7 +94,7 @@ class HostList extends Component {
style={{
marginTop: 'var(--default_spacing)',
}}>
<FontAwesomeIcon icon={faPlusCircle}/>
<FontAwesomeIcon icon={faPlusCircle} />
<b>{' Add Portal '}</b>
</a>
</div>
@@ -105,8 +104,8 @@ class HostList extends Component {
const mapDispatchToProps = (dispatch) => {
return {
AddHost: (host_list, cb) => dispatch(addEditHostAction.display(true, cb, {host_list})),
ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNoAction.display(true, cb, {title})),
AddHost: (host_list, cb) => dispatch(addEditHostAction.display(true, cb, { host_list })),
ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNoAction.display(true, cb, { title })),
};
};

View File

@@ -1,5 +1,5 @@
import {Component} from 'react';
import {getIPCRenderer} from '../../utils.jsx';
import { Component } from 'react';
import { getIPCRenderer } from '../../utils.jsx';
const ipcRenderer = getIPCRenderer();

View File

@@ -9,15 +9,15 @@ import PropTypes from 'prop-types';
import RootElem from '../../../components/UI/RootElem/RootElem';
import Text from '../../../components/UI/Text/Text';
import configureImage from '../../../assets/images/configure.png';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {connect} from 'react-redux';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import {
displayConfiguration,
removeMount,
setProviderState,
} from '../../../redux/actions/mount_actions';
import {displaySkynetExport, displaySkynetImport} from '../../../redux/actions/skynet_actions';
import {faTrashAlt} from '@fortawesome/free-solid-svg-icons';
import { displaySkynetExport, displaySkynetImport } from '../../../redux/actions/skynet_actions';
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
const MountItem = (props) => {
const handleAutoMountChanged = (e) => {
@@ -37,7 +37,7 @@ const MountItem = (props) => {
};
let secondRow = 6;
const pointer = {cursor: props.MState.AllowMount ? 'pointer' : 'no-drop'};
const pointer = { cursor: props.MState.AllowMount ? 'pointer' : 'no-drop' };
const configButton = (
<RootElem colSpan={4} rowSpan={6}>
<img
@@ -47,11 +47,11 @@ const MountItem = (props) => {
props.MState.AllowMount
? () => props.displayConfiguration(props.provider, props.remote, props.s3)
: (e) => {
e.preventDefault();
}
e.preventDefault();
}
}
src={configureImage}
style={{padding: 0, border: 0, margin: 0, ...pointer}}
style={{ padding: 0, border: 0, margin: 0, ...pointer }}
width={'16px'}
/>
</RootElem>
@@ -111,7 +111,7 @@ const MountItem = (props) => {
'Mount'
)
) : (
<Loader color={'var(--heading_text_color)'} height={19} type="Circles" width={19}/>
<Loader color={'var(--heading_text_color)'} height={19} type="Circles" width={19} />
);
const actionsDisplay = (
@@ -168,7 +168,7 @@ const MountItem = (props) => {
removeControl = (
<RootElem col={(dimensions) => dimensions.columns - 6} row={secondRow + 3}>
<a href={'#'} onClick={handleRemoveMount} style={removeStyle}>
<FontAwesomeIcon icon={faTrashAlt}/>
<FontAwesomeIcon icon={faTrashAlt} />
</a>
</RootElem>
);
@@ -187,10 +187,10 @@ const MountItem = (props) => {
props.remote
? props.provider.substr(6)
: props.s3
? props.provider.substr(2)
: isSkynet
? props.provider + ' [EXPERIMENTAL]'
: props.provider
? props.provider.substr(2)
: isSkynet
? props.provider + ' [EXPERIMENTAL]'
: props.provider
}
textAlign={'Left'}
type={'Heading2'}
@@ -203,11 +203,11 @@ const MountItem = (props) => {
props.MState.AllowMount
? () => props.displaySkynetExport(true)
: (e) => {
e.preventDefault();
}
e.preventDefault();
}
}
rowSpan={5}
style={{...pointer, fontWeight: 'normal'}}>
style={{ ...pointer, fontWeight: 'normal' }}>
<u>Export</u>
</a>
) : null}
@@ -219,11 +219,11 @@ const MountItem = (props) => {
props.MState.AllowMount
? () => props.displaySkynetImport(true)
: (e) => {
e.preventDefault();
}
e.preventDefault();
}
}
rowSpan={5}
style={{...pointer, fontWeight: 'normal'}}>
style={{ ...pointer, fontWeight: 'normal' }}>
<u>Import</u>
</a>
) : null}

View File

@@ -6,8 +6,8 @@ import Button from '../../components/UI/Button/Button';
import IPCContainer from '../IPCContainer/IPCContainer';
import Modal from '../../components/UI/Modal/Modal';
import MountItem from './MountItem/MountItem';
import {connect} from 'react-redux';
import {notifyError} from '../../redux/actions/error_actions';
import { connect } from 'react-redux';
import { notifyError } from '../../redux/actions/error_actions';
import {
resetMountsState,
setAllowMount,
@@ -164,13 +164,13 @@ class MountItems extends IPCContainer {
if (mount) {
let result =
remote || s3 || provider === 'Skynet'
? {Valid: true, Success: true}
? { Valid: true, Success: true }
: this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, {
Provider: provider,
Remote: remote,
S3: s3,
Version: this.props.InstalledVersion,
}).data;
Provider: provider,
Remote: remote,
S3: s3,
Version: this.props.InstalledVersion,
}).data;
const displayRetry = (msg) => {
this.displayRetryMount(provider, remote, s3, location, msg);
};
@@ -367,14 +367,14 @@ class MountItems extends IPCContainer {
);
if (++retryCount < Object.keys(this.state.RetryItems).length) {
retryList.push(
<div style={{paddingTop: 'var(--default_spacing)'}} key={'rl_' + retryList.length}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} key={'rl_' + retryList.length} />
);
}
});
retryDisplay = (
<Modal>
<Box dxDark dxStyle={{padding: 'var(--default_spacing)', minWidth: '70vw'}}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)', minWidth: '70vw' }}>
<h1
style={{
textAlign: 'center',
@@ -399,7 +399,7 @@ class MountItems extends IPCContainer {
/>
);
} else {
footerItems.push(<div key={'hi_' + footerItems.length} style={{height: '27px'}}/>);
footerItems.push(<div key={'hi_' + footerItems.length} style={{ height: '27px' }} />);
}
const mountItems = [];
@@ -408,7 +408,7 @@ class MountItems extends IPCContainer {
mountItems.push(
<div
key={'it_' + mountItems.length}
style={{paddingTop: 'calc(var(--default_spacing) * 2.5)'}}
style={{ paddingTop: 'calc(var(--default_spacing) * 2.5)' }}
/>
);
}
@@ -438,7 +438,7 @@ class MountItems extends IPCContainer {
}
return (
<div style={{margin: 0, padding: 0}}>
<div style={{ margin: 0, padding: 0 }}>
{retryDisplay}
<div
className={
@@ -446,7 +446,7 @@ class MountItems extends IPCContainer {
}>
{mountItems}
</div>
<div style={{paddingTop: 'var(--default_spacing)'}}/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
{footerItems}
</div>
);

View File

@@ -4,12 +4,12 @@ import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import CheckBox from '../../components/UI/CheckBox/CheckBox';
import IPCContainer from '../IPCContainer/IPCContainer';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {connect} from 'react-redux';
import {displayPinnedManager} from '../../redux/actions/pinned_manager_actions';
import {faFolder} from '@fortawesome/free-solid-svg-icons';
import {notifyApplicationBusy} from '../../redux/actions/common_actions';
import {notifyError, notifyInfo} from '../../redux/actions/error_actions';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import { displayPinnedManager } from '../../redux/actions/pinned_manager_actions';
import { faFolder } from '@fortawesome/free-solid-svg-icons';
import { notifyApplicationBusy } from '../../redux/actions/common_actions';
import { notifyError, notifyInfo } from '../../redux/actions/error_actions';
const Constants = require('../../constants');
@@ -39,7 +39,7 @@ class PinnedManager extends IPCContainer {
});
};
onGetDirectoryItemsReply = (_, {data}) => {
onGetDirectoryItemsReply = (_, { data }) => {
if (data.Success) {
const items = data.Items.filter(
(i) =>
@@ -70,9 +70,9 @@ class PinnedManager extends IPCContainer {
style.marginBottom = '4px';
}
return (
<div key={'dir_' + idx} style={{...style}}>
<div key={'dir_' + idx} style={{ ...style }}>
<Button
buttonStyles={{textAlign: 'left'}}
buttonStyles={{ textAlign: 'left' }}
clicked={() => {
const previous = [...this.state.previous];
if (path === '..') {
@@ -95,7 +95,7 @@ class PinnedManager extends IPCContainer {
icon={faFolder}
fixedWidth
color={'var(--heading_text_color)'}
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
&nbsp;{name}
</Button>
@@ -104,12 +104,12 @@ class PinnedManager extends IPCContainer {
};
createFile = (name, path, pinned, idx, total, item_idx) => {
const style = {textAlign: 'left'};
const style = { textAlign: 'left' };
if (item_idx + 1 !== total) {
style.marginBottom = '2px';
}
return (
<div key={'file_' + idx} style={{...style}}>
<div key={'file_' + idx} style={{ ...style }}>
<CheckBox
checked={pinned}
changed={() => {
@@ -153,11 +153,11 @@ class PinnedManager extends IPCContainer {
<a
href={'#'}
onClick={() => this.props.displayPinnedManager(false)}
style={{cursor: 'pointer', flex: '0'}}>
style={{ cursor: 'pointer', flex: '0' }}>
X
</a>
</div>
<h1 style={{width: '100%', textAlign: 'center'}}>{'Pinned File Manager'}</h1>
<h1 style={{ width: '100%', textAlign: 'center' }}>{'Pinned File Manager'}</h1>
<div className={'PinnedManagerActiveDirectory'}>
<b>&nbsp;{this.state.active_directory}</b>
</div>
@@ -168,13 +168,13 @@ class PinnedManager extends IPCContainer {
return i.directory
? this.createDirectory(i.name, i.path, idx++, this.state.items.length, k)
: this.createFile(
i.name,
i.path,
i.meta.pinned,
idx++,
this.state.items.length,
k
);
i.name,
i.path,
i.meta.pinned,
idx++,
this.state.items.length,
k
);
})}
</div>
</div>

View File

@@ -1,13 +1,13 @@
import React from 'react';
import './SkynetExport.css';
import CheckboxTree from 'react-checkbox-tree';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import IPCContainer from '../IPCContainer/IPCContainer';
import {notifyApplicationBusy} from '../../redux/actions/common_actions';
import {notifyError, notifyInfo} from '../../redux/actions/error_actions';
import { notifyApplicationBusy } from '../../redux/actions/common_actions';
import { notifyError, notifyInfo } from '../../redux/actions/error_actions';
import Box from '../../components/UI/Box/Box';
import {displaySkynetExport} from '../../redux/actions/skynet_actions';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import { displaySkynetExport } from '../../redux/actions/skynet_actions';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faCheckSquare,
faChevronDown,
@@ -158,7 +158,7 @@ export default connect(
render() {
return this.props.AppBusy ? (
<div/>
<div />
) : (
<Box
dxDark
@@ -179,7 +179,7 @@ export default connect(
<a
href={'#'}
onClick={() => this.props.displaySkynetExport(false)}
style={{cursor: 'pointer'}}>
style={{ cursor: 'pointer' }}>
X
</a>
</div>
@@ -214,45 +214,45 @@ export default connect(
<FontAwesomeIcon
icon={faCheckSquare}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
uncheck: (
<FontAwesomeIcon icon={faSquare} fixedWidth style={{padding: 0, margin: 0}}/>
<FontAwesomeIcon icon={faSquare} fixedWidth style={{ padding: 0, margin: 0 }} />
),
halfCheck: (
<FontAwesomeIcon
icon={faHSquare}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
expandClose: (
<FontAwesomeIcon
icon={faChevronRight}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
expandOpen: (
<FontAwesomeIcon
icon={faChevronDown}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
expandAll: (
<FontAwesomeIcon
icon={faPlusSquare}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
collapseAll: (
<FontAwesomeIcon
icon={faMinusSquare}
fixedWidth
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
parentClose: (
@@ -260,7 +260,7 @@ export default connect(
icon={faFolder}
fixedWidth
color={'var(--heading_text_color)'}
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
parentOpen: (
@@ -268,7 +268,7 @@ export default connect(
icon={faFolderOpen}
fixedWidth
color={'var(--heading_text_color)'}
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
leaf: (
@@ -276,18 +276,18 @@ export default connect(
icon={faFile}
fixedWidth
color={'var(--text_color)'}
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
/>
),
}}
nodes={this.state.nodes}
onClick={(clicked) => this.setState({clicked})}
onCheck={(checked) => this.setState({checked})}
onExpand={(expanded) => this.setState({expanded})}
onClick={(clicked) => this.setState({ clicked })}
onCheck={(checked) => this.setState({ checked })}
onExpand={(expanded) => this.setState({ expanded })}
/>
)}
</div>
<div style={{display: 'flex', justifyContent: 'flex-end'}}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{this.state.second_stage ? (
<Button
buttonStyles={{

View File

@@ -2,7 +2,7 @@ import React from 'react';
import './Import.css';
import PropTypes from 'prop-types';
const Import = ({data}) => {
const Import = ({ data }) => {
return (
<div className={'ImportOwner'}>
<input
@@ -18,7 +18,7 @@ const Import = ({data}) => {
<input
readOnly
className={'ConfigurationItemInput'}
style={{maxWidth: 'calc(33.33% - calc(var(--default_spacing) / 2))'}}
style={{ maxWidth: 'calc(33.33% - calc(var(--default_spacing) / 2))' }}
type={'text'}
value={data.skylink}
/>

View File

@@ -4,7 +4,7 @@ import Import from './Import/Import';
import PropTypes from 'prop-types';
import Text from '../../../components/UI/Text/Text';
const ImportList = ({imports_array}) => {
const ImportList = ({ imports_array }) => {
let key = 0;
return (
<div>
@@ -12,21 +12,21 @@ const ImportList = ({imports_array}) => {
<Text
type={'Heading1'}
text={'Directory'}
style={{minWidth: '33.33%', maxWidth: '33.33%'}}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/>
<Text
type={'Heading1'}
text={'Skylink'}
style={{minWidth: '33.33%', maxWidth: '33.33%'}}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/>
<Text type={'Heading1'} text={'Token'} style={{minWidth: '33.33%', maxWidth: '33.33%'}}/>
<Text type={'Heading1'} text={'Token'} style={{ minWidth: '33.33%', maxWidth: '33.33%' }} />
</div>
<hr/>
<hr />
<div className={'ImportListOwner'}>
{imports_array.map((data) => {
return (
<div key={'import_' + key++}>
<Import data={data}/>
<Import data={data} />
</div>
);
})}

View File

@@ -1,14 +1,14 @@
import React from 'react';
import {connect} from 'react-redux';
import { connect } from 'react-redux';
import './SkynetImport.css';
import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import {displaySkynetImport} from '../../redux/actions/skynet_actions';
import { displaySkynetImport } from '../../redux/actions/skynet_actions';
import ImportList from './ImportList/ImportList';
import IPCContainer from '../IPCContainer/IPCContainer';
import {notifyApplicationBusy} from '../../redux/actions/common_actions';
import {notifyError, notifyInfo} from '../../redux/actions/error_actions';
import {promptLocationAndReadFile} from '../../utils';
import { notifyApplicationBusy } from '../../redux/actions/common_actions';
import { notifyError, notifyInfo } from '../../redux/actions/error_actions';
import { promptLocationAndReadFile } from '../../utils';
const Constants = require('../../constants');
@@ -79,7 +79,7 @@ export default connect(
handleLoadFile = () => {
const data = promptLocationAndReadFile(this.props.notifyError);
if (data) {
this.setState({import_text: data});
this.setState({ import_text: data });
}
};
@@ -176,7 +176,7 @@ export default connect(
render() {
return this.props.AppBusy ? (
<div/>
<div />
) : (
<Box
dxDark
@@ -197,7 +197,7 @@ export default connect(
<a
href={'#'}
onClick={() => this.props.displaySkynetImport(false)}
style={{cursor: 'pointer'}}>
style={{ cursor: 'pointer' }}>
X
</a>
</div>
@@ -205,7 +205,7 @@ export default connect(
{this.state.second_stage ? 'Verify Imports' : 'Import List'}
</h1>
{this.state.second_stage ? (
<ImportList imports_array={this.state.imports_array}/>
<ImportList imports_array={this.state.imports_array} />
) : (
<textarea
autoFocus={true}

View File

@@ -1,8 +1,8 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import './Password.css';
import PropTypes from 'prop-types';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faEye, faEyeSlash} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
class Password extends Component {
state = {
@@ -115,7 +115,7 @@ class Password extends Component {
render() {
return (
<div className={'PasswordOwner'} style={{...this.props.style}}>
<div className={'PasswordOwner'} style={{ ...this.props.style }}>
{this.props.readOnly ? null : (
<a href={'#'} className={'PasswordLink'} onClick={this.handleActionClick}>
<u>{this.state.button_text}</u>
@@ -132,7 +132,7 @@ class Password extends Component {
value={this.state.button_text === 'confirm' ? this.state.password2 : this.state.password}
/>
<a href={'#'} className={'PasswordShowHide'} onClick={this.handleShowHideClick}>
<FontAwesomeIcon icon={this.state.show_password ? faEye : faEyeSlash} fixedWidth/>
<FontAwesomeIcon icon={this.state.show_password ? faEye : faEyeSlash} fixedWidth />
</a>
</div>
);

View File

@@ -27,48 +27,48 @@ const _vcRuntimeExists = () => {
: 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
];
_execProcessGetOutput(cmd, null, args)
.then((lines) => {
const parseLine = (index) => {
if (index < lines.length) {
const line = lines[index];
if (line.startsWith('HKEY_LOCAL_MACHINE\\')) {
let args2 = JSON.parse(JSON.stringify(args));
args2[1] = 'HKLM\\' + line.substr(19);
args2.push('/v');
args2.push('DisplayName');
args2.push('/t');
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (
value.includes(
IS_64BIT
? 'Microsoft Visual C++ 2015-2019 Redistributable (x64)'
: 'Microsoft Visual C++ 2015-2019 Redistributable (x32)',
)
) {
vcRuntimeExists = true;
resolve(true);
} else {
parseLine(++index);
}
})
.catch(() => {
.then((lines) => {
const parseLine = (index) => {
if (index < lines.length) {
const line = lines[index];
if (line.startsWith('HKEY_LOCAL_MACHINE\\')) {
let args2 = JSON.parse(JSON.stringify(args));
args2[1] = 'HKLM\\' + line.substr(19);
args2.push('/v');
args2.push('DisplayName');
args2.push('/t');
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (
value.includes(
IS_64BIT
? 'Microsoft Visual C++ 2015-2019 Redistributable (x64)'
: 'Microsoft Visual C++ 2015-2019 Redistributable (x32)'
)
) {
vcRuntimeExists = true;
resolve(true);
} else {
parseLine(++index);
}
})
.catch(() => {
parseLine(++index);
});
} else {
parseLine(++index);
});
}
} else {
parseLine(++index);
resolve(false);
}
} else {
resolve(false);
}
};
parseLine(0);
})
.catch((err) => {
reject(err);
});
};
parseLine(0);
})
.catch((err) => {
reject(err);
});
}
}
});
@@ -317,13 +317,13 @@ module.exports.cleanupOldReleases = (versionList) => {
if (versionList && versionList.length > 0) {
const dataDir = _getDataDirectory();
const directoryList = fs
.readdirSync(dataDir, {withFileTypes: true})
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent);
.readdirSync(dataDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent);
const removeList = directoryList
.filter((dirent) => !versionList.includes(dirent.name))
.map((dirent) => dirent.name);
.filter((dirent) => !versionList.includes(dirent.name))
.map((dirent) => dirent.name);
for (const dir of removeList) {
try {
@@ -391,8 +391,8 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
const args = _getDefaultRepertoryArgs(
provider,
!Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('remote'),
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3'),
provider.toLowerCase().startsWith('remote'),
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3')
);
args.push('-status');
@@ -438,51 +438,51 @@ module.exports.downloadFile = (url, destination, progressCallback, completeCallb
}
axios
.get(url, {
responseType: 'stream',
})
.then((response) => {
try {
const total = parseInt(response.headers['content-length'], 10);
if (total === 0) {
completeCallback(new Error('No data available for download'));
} else {
const stream = fs.createWriteStream(destination);
.get(url, {
responseType: 'stream',
})
.then((response) => {
try {
const total = parseInt(response.headers['content-length'], 10);
if (total === 0) {
completeCallback(new Error('No data available for download'));
} else {
const stream = fs.createWriteStream(destination);
let downloaded = 0;
response.data.on('data', (chunk) => {
stream.write(Buffer.from(chunk));
downloaded += chunk.length;
if (progressCallback) {
progressCallback(((downloaded / total) * 100.0).toFixed(2));
}
});
response.data.on('end', () => {
stream.end(() => {
if (downloaded === 0) {
completeCallback(new Error('Received 0 bytes'));
} else if (downloaded !== total) {
completeCallback(new Error('Received incorrect number of bytes'));
} else {
completeCallback();
let downloaded = 0;
response.data.on('data', (chunk) => {
stream.write(Buffer.from(chunk));
downloaded += chunk.length;
if (progressCallback) {
progressCallback(((downloaded / total) * 100.0).toFixed(2));
}
});
});
response.data.on('error', (error) => {
stream.end(() => {
completeCallback(error);
response.data.on('end', () => {
stream.end(() => {
if (downloaded === 0) {
completeCallback(new Error('Received 0 bytes'));
} else if (downloaded !== total) {
completeCallback(new Error('Received incorrect number of bytes'));
} else {
completeCallback();
}
});
});
});
response.data.on('error', (error) => {
stream.end(() => {
completeCallback(error);
});
});
}
} catch (error) {
completeCallback(error);
}
} catch (error) {
})
.catch((error) => {
completeCallback(error);
}
})
.catch((error) => {
completeCallback(error);
});
});
};
module.exports.executeAndWait = (command, ignoreResult) => {
@@ -539,9 +539,9 @@ module.exports.executeAsync = (command, args = []) => {
() =>
launchProcess(
count,
setTimeout(() => resolve(), 3000),
setTimeout(() => resolve(), 3000)
),
1000,
1000
);
}
});
@@ -556,9 +556,9 @@ module.exports.executeAsync = (command, args = []) => {
() =>
launchProcess(
count,
setTimeout(() => resolve(), 3000),
setTimeout(() => resolve(), 3000)
),
1000,
1000
);
}
}
@@ -569,7 +569,7 @@ module.exports.executeAsync = (command, args = []) => {
launchProcess(
0,
setTimeout(() => resolve(), 3000),
setTimeout(() => resolve(), 3000)
);
});
};
@@ -785,16 +785,16 @@ module.exports.getMissingDependencies = (dependencies) => {
if (index >= dep.registry.length) {
if (dep.display === 'VC Runtime 2015-2019') {
_vcRuntimeExists()
.then((exists) => {
if (!exists) {
.then((exists) => {
if (!exists) {
missing.push(dep);
}
resolveIfComplete();
})
.catch(() => {
missing.push(dep);
}
resolveIfComplete();
})
.catch(() => {
missing.push(dep);
resolveIfComplete();
});
resolveIfComplete();
});
} else {
missing.push(dep);
resolveIfComplete();
@@ -823,7 +823,7 @@ module.exports.getMissingDependencies = (dependencies) => {
}
const key = dep.registry[index].substr(hiveName.length);
const regKey = new Registry({hive: hive, key: key});
const regKey = new Registry({ hive: hive, key: key });
regKey.valueExists('DisplayName', (err, exists) => {
if (err || !exists) {
regKey.valueExists('ProductName', (err, exists) => {
@@ -861,18 +861,18 @@ module.exports.getMissingDependencies = (dependencies) => {
module.exports.grabSkynetFileTree = (version) => {
return new Promise((resolve, reject) => {
_exportAllSkylinks(version)
.then((results) => {
resolve([
{
name: '/',
directory: true,
children: _createTreeNodes(results.success),
},
]);
})
.catch((e) => {
reject(e);
});
.then((results) => {
resolve([
{
name: '/',
directory: true,
children: _createTreeNodes(results.success),
},
]);
})
.catch((e) => {
reject(e);
});
});
};
@@ -1002,7 +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 : '.';
@@ -1048,53 +1048,53 @@ module.exports.performWindowsUninstall = (names) => {
: 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
];
_execProcessGetOutput(cmd, null, args)
.then((lines) => {
const parseLine = (index) => {
if (index < lines.length) {
const line = lines[index];
if (line.startsWith('HKEY_LOCAL_MACHINE\\')) {
let args2 = JSON.parse(JSON.stringify(args));
args2[1] = 'HKLM\\' + line.substr(19);
args2.push('/v');
args2.push('DisplayName');
args2.push('/t');
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
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'])
.then((code) => {
if (code === 0 || code === 3010 || code === 1641) {
resolve(true);
.then((lines) => {
const parseLine = (index) => {
if (index < lines.length) {
const line = lines[index];
if (line.startsWith('HKEY_LOCAL_MACHINE\\')) {
let args2 = JSON.parse(JSON.stringify(args));
args2[1] = 'HKLM\\' + line.substr(19);
args2.push('/v');
args2.push('DisplayName');
args2.push('/t');
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
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'])
.then((code) => {
if (code === 0 || code === 3010 || code === 1641) {
resolve(true);
} else {
reject('[' + value + '] uninstall failed: ' + code);
}
})
.catch((err) => {
reject(err);
});
} else {
reject('[' + value + '] uninstall failed: ' + code);
parseLine(++index);
}
})
.catch((err) => {
reject(err);
.catch(() => {
parseLine(++index);
});
} else {
parseLine(++index);
}
})
.catch(() => {
} else {
parseLine(++index);
});
}
} else {
parseLine(++index);
resolve(false);
}
} else {
resolve(false);
}
};
parseLine(0);
})
.catch((err) => {
reject(err);
});
};
parseLine(0);
})
.catch((err) => {
reject(err);
});
}
});
};
@@ -1136,7 +1136,14 @@ module.exports.setConfigValue = (name, value, provider, remote, s3, version) =>
});
};
module.exports.testSkynetLogon = (version, authURL, authUser, authPassword, agentString, apiKey) => {
module.exports.testSkynetLogon = (
version,
authURL,
authUser,
authPassword,
agentString,
apiKey
) => {
return new Promise((resolve, reject) => {
const repertoryExec = _getRepertoryExec(version);
const processOptions = {
@@ -1218,16 +1225,16 @@ module.exports.testRepertoryBinary = (version) => {
return new Promise((resolve, reject) => {
const repertoryExec = _getRepertoryExec(version);
_executeProcess(repertoryExec.cmd, repertoryExec.working, ['-dc'])
.then((code) => {
if (code === 0) {
resolve();
} else {
reject(new Error('Invalid exit code: ' + code));
}
})
.catch((error) => {
reject(error);
});
.then((code) => {
if (code === 0) {
resolve();
} else {
reject(new Error('Invalid exit code: ' + code));
}
})
.catch((error) => {
reject(error);
});
});
};
@@ -1274,7 +1281,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
} else {
resolve(stdout);
}
},
}
);
};
@@ -1298,7 +1305,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
}
});
} else {
reject(new Error('Failed to locate \'openssl.exe\''));
reject(new Error("Failed to locate 'openssl.exe'"));
}
});
} else if (os.platform() === 'linux') {

View File

@@ -5,14 +5,14 @@ const Constants = require('./constants');
test('verify signature success', () => {
return helpers
.verifySignature(
path.resolve('test/test_verify_signature.dat'),
path.resolve('test/test_verify_signature.dat.sig'),
path.resolve('blockstorage_dev_public.pem')
)
.then((stdout) => {
expect(stdout).toBeDefined();
});
.verifySignature(
path.resolve('test/test_verify_signature.dat'),
path.resolve('test/test_verify_signature.dat.sig'),
path.resolve('blockstorage_dev_public.pem')
)
.then((stdout) => {
expect(stdout).toBeDefined();
});
});
test('verify signature fail', () => {
@@ -27,10 +27,10 @@ test('verify signature fail', () => {
test('create temp signature files', () => {
const b64signature = fs
.readFileSync(path.resolve('test/test_create_signature.sig.b64'), {
encoding: 'utf8',
})
.replace(/(\r\n|\n|\r)/gm, '');
.readFileSync(path.resolve('test/test_create_signature.sig.b64'), {
encoding: 'utf8',
})
.replace(/(\r\n|\n|\r)/gm, '');
const data = helpers.createSignatureFiles(b64signature, Constants.DEV_PUBLIC_KEY);
expect(data).toBeDefined();
expect(data.PublicKeyFile).toBeDefined();
@@ -40,12 +40,12 @@ test('create temp signature files', () => {
expect(fs.statSync(data.PublicKeyFile).isFile()).toBe(true);
const b64signature2 = fs
.readFileSync(data.SignatureFile)
.toString('base64')
.replace(/(\r\n|\n|\r)/gm, '');
.readFileSync(data.SignatureFile)
.toString('base64')
.replace(/(\r\n|\n|\r)/gm, '');
expect(b64signature2).toEqual(b64signature);
expect(fs.readFileSync(data.PublicKeyFile, {encoding: 'utf8'})).toEqual(
expect(fs.readFileSync(data.PublicKeyFile, { encoding: 'utf8' })).toEqual(
Constants.DEV_PUBLIC_KEY
);
fs.unlinkSync(data.PublicKeyFile);

View File

@@ -3,16 +3,16 @@ import 'react-checkbox-tree/lib/react-checkbox-tree.css';
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import { Provider } from 'react-redux';
import packageJson from '../package.json';
import App from './App.jsx';
import {setProviderState} from './redux/actions/mount_actions';
import {setActiveRelease} from './redux/actions/release_version_actions';
import { setProviderState } from './redux/actions/mount_actions';
import { setActiveRelease } from './redux/actions/release_version_actions';
import createAppStore from './redux/store/createAppStore';
import * as serviceWorker from './serviceWorker';
import {getIPCRenderer} from './utils.jsx';
import { getIPCRenderer } from './utils.jsx';
const Constants = require('./constants');
@@ -51,7 +51,7 @@ if (ipcRenderer) {
ReactDOM.render(
<Provider store={store}>
<App/>
<App />
</Provider>,
document.getElementById('root')
);

View File

@@ -1,10 +1,10 @@
import {createAction} from '@reduxjs/toolkit';
import {createResponseDialogAction} from '../utils';
import { createAction } from '@reduxjs/toolkit';
import { createResponseDialogAction } from '../utils';
export const confirmYesNoAction = createResponseDialogAction('common', 'confirmYesNo');
import * as Constants from '../../constants';
import {getIPCRenderer} from '../../utils.jsx';
import { getIPCRenderer } from '../../utils.jsx';
const ipcRenderer = getIPCRenderer();
@@ -12,7 +12,7 @@ export const NOTIFY_APPLICATION_BUSY = 'common/notifyApplicationBusy';
export const notifyApplicationBusy = (busy, transparent) => {
return {
type: NOTIFY_APPLICATION_BUSY,
payload: {busy, transparent},
payload: { busy, transparent },
};
};
@@ -48,7 +48,7 @@ export const saveState = () => {
}
if (ipcRenderer) {
ipcRenderer.send(Constants.IPC_Save_State, {State: currentState});
ipcRenderer.send(Constants.IPC_Save_State, { State: currentState });
}
}
};

View File

@@ -1,16 +1,16 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import {getIPCRenderer} from '../../utils.jsx';
import { getIPCRenderer } from '../../utils.jsx';
import {notifyError} from './error_actions';
import {installDependency, installRelease, installUpgrade} from './install_actions';
import { notifyError } from './error_actions';
import { installDependency, installRelease, installUpgrade } from './install_actions';
export const setAllowDownload = createAction('download/setAllowDownload');
export const SET_DOWNLOAD_BEGIN = 'download/setDownloadBegin';
export const setDownloadBegin = (name, type, url) => {
return {type: SET_DOWNLOAD_BEGIN, payload: {name, type, url}};
return { type: SET_DOWNLOAD_BEGIN, payload: { name, type, url } };
};
export const setDownloadEnd = createAction('download/setDownloadEnd');

View File

@@ -1,4 +1,4 @@
import {showWindow, shutdownApplication} from './common_actions';
import { showWindow, shutdownApplication } from './common_actions';
let ErrorActions = [];
@@ -57,13 +57,13 @@ export const notifyInfo = (title, msg, saveToFile, fileName, extension) => {
export const SET_ERROR_INFO = 'error/setErrorInfo';
export const setErrorInfo = (msg, critical) => {
return {type: SET_ERROR_INFO, payload: {msg, critical}};
return { type: SET_ERROR_INFO, payload: { msg, critical } };
};
export const SET_INFO = 'error/setInfo';
export const setInfo = (title, msg, saveToFile, fileName, extension) => {
return {
type: SET_INFO,
payload: {title, msg, saveToFile, fileName, extension},
payload: { title, msg, saveToFile, fileName, extension },
};
};

View File

@@ -1,3 +1,3 @@
import {createResponseDialogAction} from '../utils';
import { createResponseDialogAction } from '../utils';
export const addEditHostAction = createResponseDialogAction('host', 'displayAddEditHost');

View File

@@ -1,7 +1,7 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import {getIPCRenderer, getSelectedVersionFromState} from '../../utils.jsx';
import { getIPCRenderer, getSelectedVersionFromState } from '../../utils.jsx';
import {
confirmYesNoAction,
@@ -11,9 +11,9 @@ import {
showWindow,
shutdownApplication,
} from './common_actions';
import {downloadItem, setAllowDownload} from './download_actions';
import {notifyError} from './error_actions';
import {unmountAll} from './mount_actions';
import { downloadItem, setAllowDownload } from './download_actions';
import { notifyError } from './error_actions';
import { unmountAll } from './mount_actions';
import {
setActiveRelease,
setInstalledVersion,
@@ -60,7 +60,7 @@ export const checkInstalled = (dependencies, version) => {
dispatch(setAllowMount(false));
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));
@@ -166,13 +166,13 @@ export const installReleaseByVersion = (release, version) => {
};
if (getState().mounts.MountsBusy) {
dispatch(confirmYesNoAction.display(true, null, {title: 'Unmount all drives?'}))
.then(({changed}) => {
if (changed) {
dispatch(unmountAll(install));
}
})
.catch((error) => notifyError(error));
dispatch(confirmYesNoAction.display(true, null, { title: 'Unmount all drives?' }))
.then(({ changed }) => {
if (changed) {
dispatch(unmountAll(install));
}
})
.catch((error) => notifyError(error));
} else {
install();
}

View File

@@ -1,10 +1,10 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import {getIPCRenderer} from '../../utils.jsx';
import { getIPCRenderer } from '../../utils.jsx';
import {confirmYesNoAction, saveState} from './common_actions';
import {notifyError} from './error_actions';
import { confirmYesNoAction, saveState } from './common_actions';
import { notifyError } from './error_actions';
export const addRemoteMount = (hostNameOrIp, port, token) => {
return (dispatch, getState) => {
@@ -30,10 +30,10 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
ipcRenderer.send(Constants.IPC_Set_Config_Values, {
Items: [
{Name: 'RemoteMount.RemoteHostNameOrIp', Value: hostNameOrIp},
{Name: 'RemoteMount.RemoteToken', Value: token},
{Name: 'RemoteMount.RemotePort', Value: port.toString()},
{Name: 'RemoteMount.IsRemoteMount', Value: 'true'},
{ Name: 'RemoteMount.RemoteHostNameOrIp', Value: hostNameOrIp },
{ Name: 'RemoteMount.RemoteToken', Value: token },
{ Name: 'RemoteMount.RemotePort', Value: port.toString() },
{ Name: 'RemoteMount.IsRemoteMount', Value: 'true' },
],
Provider: provider,
Remote: true,
@@ -65,11 +65,11 @@ export const addS3Mount = (name, accessKey, secretKey, region, bucketName, url)
ipcRenderer.send(Constants.IPC_Set_Config_Values, {
Items: [
{Name: 'S3Config.AccessKey', Value: accessKey},
{Name: 'S3Config.SecretKey', Value: secretKey},
{Name: 'S3Config.Region', Value: region},
{Name: 'S3Config.BucketName', Value: bucketName},
{Name: 'S3Config.URL', Value: url},
{ Name: 'S3Config.AccessKey', Value: accessKey },
{ Name: 'S3Config.SecretKey', Value: secretKey },
{ Name: 'S3Config.Region', Value: region },
{ Name: 'S3Config.BucketName', Value: bucketName },
{ Name: 'S3Config.URL', Value: url },
],
Provider: provider,
S3: true,
@@ -100,7 +100,7 @@ export const removeMount = (provider) => {
confirmYesNoAction.display(true, null, {
title: 'Delete [' + provider.substr(isRemote ? 6 : 2) + ']?',
})
).then(({changed}) => {
).then(({ changed }) => {
if (changed) {
dispatch(removeMount2(provider));
}
@@ -129,34 +129,34 @@ export const removeMount3 = createAction('mounts/removeMount3');
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
export const resetMountsState = () => {
return {type: RESET_MOUNTS_STATE, payload: null};
return { type: RESET_MOUNTS_STATE, payload: null };
};
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
export const setAllowMount = (provider, allow) => {
return {type: SET_ALLOW_MOUNT, payload: {provider, allow}};
return { type: SET_ALLOW_MOUNT, payload: { provider, allow } };
};
export const SET_AUTO_MOUNT_PROCESSED = 'mounts/setAutoMountProcessed';
export const setAutoMountProcessed = (provider, processed) => {
return {type: SET_AUTO_MOUNT_PROCESSED, payload: {provider, processed}};
return { type: SET_AUTO_MOUNT_PROCESSED, payload: { provider, processed } };
};
export const setBusy = createAction('mounts/setBusy');
export const SET_MOUNT_STATE = 'mounts/setMountState';
export const setMountState = (provider, state) => {
return {type: SET_MOUNT_STATE, payload: {provider, state}};
return { type: SET_MOUNT_STATE, payload: { provider, state } };
};
export const SET_MOUNTED = 'mounts/setMounted';
export const setMounted = (provider, mounted) => {
return {type: SET_MOUNTED, payload: {provider, mounted}};
return { type: SET_MOUNTED, payload: { provider, mounted } };
};
export const SET_PROVIDER_STATE = 'mounts/setProviderState';
export const setProviderState = (provider, state) => {
return {type: SET_PROVIDER_STATE, payload: {provider, state}};
return { type: SET_PROVIDER_STATE, payload: { provider, state } };
};
export const unmountAll = (completedCallback) => {

View File

@@ -1,3 +1,3 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
export const displayPinnedManager = createAction('pinned/displayPinnedManager');

View File

@@ -1,4 +1,4 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
import axios from 'axios';
import * as Constants from '../../constants';
@@ -9,10 +9,10 @@ import {
getSelectedVersionFromState,
} from '../../utils.jsx';
import {saveState, setAllowMount, setApplicationReady, showWindow} from './common_actions';
import {notifyError} from './error_actions';
import {checkVersionInstalled, setDismissDependencies} from './install_actions';
import {unmountAll} from './mount_actions';
import { saveState, setAllowMount, setApplicationReady, showWindow } from './common_actions';
import { notifyError } from './error_actions';
import { checkVersionInstalled, setDismissDependencies } from './install_actions';
import { unmountAll } from './mount_actions';
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
export const clearUIUpgrade = () => {
@@ -36,35 +36,35 @@ const cleanupOldReleases = (versionList) => {
export const detectUIUpgrade = () => {
return (dispatch, getState) => {
axios
.get(Constants.UI_RELEASES_URL)
.then((response) => {
const state = getState();
const appPlatform = state.common.AppPlatform;
const version = state.common.Version;
const data = response.data;
.get(Constants.UI_RELEASES_URL)
.then((response) => {
const state = getState();
const appPlatform = state.common.AppPlatform;
const version = state.common.Version;
const data = response.data;
if (
data.Versions &&
data.Versions[appPlatform] &&
data.Versions[appPlatform].length > 0 &&
data.Versions[appPlatform][0] !== version
) {
dispatch(
setUIUpgradeData(
data.Locations[appPlatform][data.Versions[appPlatform][0]],
data.Versions[appPlatform][0]
)
);
if (!state.relver.UpgradeDismissed) {
dispatch(showWindow());
if (
data.Versions &&
data.Versions[appPlatform] &&
data.Versions[appPlatform].length > 0 &&
data.Versions[appPlatform][0] !== version
) {
dispatch(
setUIUpgradeData(
data.Locations[appPlatform][data.Versions[appPlatform][0]],
data.Versions[appPlatform][0]
)
);
if (!state.relver.UpgradeDismissed) {
dispatch(showWindow());
}
} else {
dispatch(clearUIUpgrade());
}
} else {
})
.catch(() => {
dispatch(clearUIUpgrade());
}
})
.catch(() => {
dispatch(clearUIUpgrade());
});
});
};
};
@@ -121,61 +121,61 @@ export const loadReleases = () => {
};
axios
.get(Constants.RELEASES_URL)
.then((response) => {
const appPlatform = getState().common.AppPlatform;
const versionLookup = {
Release: response.data.Versions.Release[appPlatform],
RC: response.data.Versions.RC[appPlatform],
Beta: response.data.Versions.Beta[appPlatform],
Alpha: response.data.Versions.Alpha[appPlatform],
};
const locationsLookup = {
...response.data.Locations[appPlatform],
};
.get(Constants.RELEASES_URL)
.then((response) => {
const appPlatform = getState().common.AppPlatform;
const versionLookup = {
Release: response.data.Versions.Release[appPlatform],
RC: response.data.Versions.RC[appPlatform],
Beta: response.data.Versions.Beta[appPlatform],
Alpha: response.data.Versions.Alpha[appPlatform],
};
const locationsLookup = {
...response.data.Locations[appPlatform],
};
const storedReleases = localStorage.getItem('releases');
let newReleases = [];
if (storedReleases && storedReleases.length > 0) {
newReleases = getNewReleases(
JSON.parse(storedReleases).VersionLookup,
versionLookup,
getSelectedVersionFromState(getState())
const storedReleases = localStorage.getItem('releases');
let newReleases = [];
if (storedReleases && storedReleases.length > 0) {
newReleases = getNewReleases(
JSON.parse(storedReleases).VersionLookup,
versionLookup,
getSelectedVersionFromState(getState())
);
}
localStorage.setItem(
'releases',
JSON.stringify({
LocationsLookup: locationsLookup,
VersionLookup: versionLookup,
})
);
}
localStorage.setItem(
'releases',
JSON.stringify({
LocationsLookup: locationsLookup,
VersionLookup: versionLookup,
})
);
dispatchActions(locationsLookup, versionLookup);
dispatch(setNewReleasesAvailable(newReleases));
if (getState().relver.NewReleasesAvailable.length > 0) {
dispatch(setNewReleasesAvailable2(newReleases));
localStorage.setItem('previous_releases', storedReleases);
dispatch(showWindow());
} else if (
(newReleases = checkNewReleases(getSelectedVersionFromState(getState()))).length > 0
) {
dispatch(setNewReleasesAvailable2(newReleases));
}
})
.catch((error) => {
const releases = localStorage.getItem('releases');
if (releases && releases.length > 0) {
const obj = JSON.parse(releases);
const locationsLookup = obj.LocationsLookup;
const versionLookup = obj.VersionLookup;
dispatchActions(locationsLookup, versionLookup);
} else {
dispatch(notifyError(error, true));
}
});
dispatch(setNewReleasesAvailable(newReleases));
if (getState().relver.NewReleasesAvailable.length > 0) {
dispatch(setNewReleasesAvailable2(newReleases));
localStorage.setItem('previous_releases', storedReleases);
dispatch(showWindow());
} else if (
(newReleases = checkNewReleases(getSelectedVersionFromState(getState()))).length > 0
) {
dispatch(setNewReleasesAvailable2(newReleases));
}
})
.catch((error) => {
const releases = localStorage.getItem('releases');
if (releases && releases.length > 0) {
const obj = JSON.parse(releases);
const locationsLookup = obj.LocationsLookup;
const versionLookup = obj.VersionLookup;
dispatchActions(locationsLookup, versionLookup);
} else {
dispatch(notifyError(error, true));
}
});
};
};
@@ -183,7 +183,7 @@ export const NOTIFY_ACTIVE_RELEASE = 'relver/notifyActiveRelease';
export const notifyActiveRelease = (release, version) => {
return {
type: NOTIFY_ACTIVE_RELEASE,
payload: {release: release, version: version},
payload: { release: release, version: version },
};
};

View File

@@ -1,4 +1,4 @@
import {createAction} from '@reduxjs/toolkit';
import { createAction } from '@reduxjs/toolkit';
export const displaySkynetExport = createAction('skynet/displaySkynetExport');
export const displaySkynetImport = createAction('skynet/displaySkynetImport');

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
confirmYesNoAction,
NOTIFY_APPLICATION_BUSY,
@@ -31,7 +31,7 @@ export const createCommonReducer = (platformInfo, version) => {
};
},
[setAllowMount]: (state, action) => {
return {...state, AllowMount: action.payload};
return { ...state, AllowMount: action.payload };
},
[setApplicationReady]: (state, action) => {
return {

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
SET_DOWNLOAD_BEGIN,
@@ -48,7 +48,7 @@ export const downloadReducer = createReducer(
};
},
[setDownloadProgress]: (state, action) => {
return {...state, DownloadProgress: action.payload};
return { ...state, DownloadProgress: action.payload };
},
}
);

View File

@@ -1,5 +1,5 @@
import {createReducer} from '@reduxjs/toolkit';
import {CLEAR_ERROR, CLEAR_INFO, SET_ERROR_INFO, SET_INFO} from '../actions/error_actions';
import { createReducer } from '@reduxjs/toolkit';
import { CLEAR_ERROR, CLEAR_INFO, SET_ERROR_INFO, SET_INFO } from '../actions/error_actions';
export const errorReducer = createReducer(
{
@@ -46,7 +46,7 @@ export const errorReducer = createReducer(
},
...state.InfoStack,
];
return {...state, DisplayInfo: true, InfoStack: infoStack};
return { ...state, DisplayInfo: true, InfoStack: infoStack };
},
}
);

View File

@@ -1,5 +1,5 @@
import {createReducer} from '@reduxjs/toolkit';
import {addEditHostAction} from '../actions/host_actions';
import { createReducer } from '@reduxjs/toolkit';
import { addEditHostAction } from '../actions/host_actions';
export const hostReducer = createReducer(
{

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import {
setAutoInstallRelease,
setDismissDependencies,
@@ -20,10 +20,10 @@ export const installReducer = createReducer(
},
{
[setAutoInstallRelease]: (state, action) => {
return {...state, AutoInstallRelease: action.payload};
return { ...state, AutoInstallRelease: action.payload };
},
[setDismissDependencies]: (state, action) => {
return {...state, DismissDependencies: action.payload};
return { ...state, DismissDependencies: action.payload };
},
[setInstallActive]: (state, action) => {
return {
@@ -42,10 +42,10 @@ export const installReducer = createReducer(
};
},
[setInstallTestActive]: (state, action) => {
return {...state, InstallTestActive: action.payload};
return { ...state, InstallTestActive: action.payload };
},
[setMissingDependencies]: (state, action) => {
return {...state, MissingDependencies: action.payload};
return { ...state, MissingDependencies: action.payload };
},
}
);

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import {
@@ -22,40 +22,40 @@ export const createMountReducer = (state) => {
...(state.S3Mounts || []),
];
const providerState = providerList
.map((provider) => {
return {
[provider]: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
};
})
.reduce((map, obj) => {
return {...map, ...obj};
});
.map((provider) => {
return {
[provider]: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
};
})
.reduce((map, obj) => {
return { ...map, ...obj };
});
const mountState = providerList
.map((provider) => {
return {
[provider]: {
AllowMount: false,
DriveLetters: [],
Mounted: false,
},
};
})
.reduce((map, obj) => {
return {...map, ...obj};
});
.map((provider) => {
return {
[provider]: {
AllowMount: false,
DriveLetters: [],
Mounted: false,
},
};
})
.reduce((map, obj) => {
return { ...map, ...obj };
});
const autoMountProcessed = providerList
.map((provider) => {
return {[provider]: false};
})
.reduce((map, obj) => {
return {...map, ...obj};
});
.map((provider) => {
return { [provider]: false };
})
.reduce((map, obj) => {
return { ...map, ...obj };
});
return createReducer(
{
@@ -71,21 +71,21 @@ export const createMountReducer = (state) => {
},
{
[addRemoteMount2]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
mountState[action.payload] = {
AllowMount: false,
DriveLetters: [],
Mounted: false,
};
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
providerState[action.payload] = {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
};
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
autoMountProcessed[action.payload] = true;
return {
@@ -97,21 +97,21 @@ export const createMountReducer = (state) => {
};
},
[addS3Mount2]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
mountState[action.payload] = {
AllowMount: false,
DriveLetters: [],
Mounted: false,
};
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
providerState[action.payload] = {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
};
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
autoMountProcessed[action.payload] = true;
return {
@@ -131,13 +131,13 @@ export const createMountReducer = (state) => {
};
},
[removeMount3]: (state, action) => {
let mountState = {...state.MountState};
let mountState = { ...state.MountState };
delete mountState[action.payload];
let providerState = {...state.ProviderState};
let providerState = { ...state.ProviderState };
delete providerState[action.payload];
let autoMountProcessed = {...state.AutoMountProcessed};
let autoMountProcessed = { ...state.AutoMountProcessed };
delete autoMountProcessed[action.payload];
const remoteMounts = state.RemoteMounts.filter((i) => i !== action.payload);
@@ -152,7 +152,7 @@ export const createMountReducer = (state) => {
};
},
[RESET_MOUNTS_STATE]: (state) => {
return {...state, MountsBusy: false, MountState: mountState};
return { ...state, MountsBusy: false, MountState: mountState };
},
[SET_AUTO_MOUNT_PROCESSED]: (state, action) => {
return {
@@ -176,7 +176,7 @@ export const createMountReducer = (state) => {
};
},
[setBusy]: (state, action) => {
return {...state, MountsBusy: action.payload};
return { ...state, MountsBusy: action.payload };
},
[SET_MOUNT_STATE]: (state, action) => {
return {

View File

@@ -1,5 +1,5 @@
import {createReducer} from '@reduxjs/toolkit';
import {displayPinnedManager} from '../actions/pinned_manager_actions';
import { createReducer } from '@reduxjs/toolkit';
import { displayPinnedManager } from '../actions/pinned_manager_actions';
export const pinnedManagerReducer = createReducer(
{

View File

@@ -1,10 +1,10 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import * as Constants from '../../constants';
import * as Actions from '../actions/release_version_actions';
const versionLookup = Constants.RELEASE_TYPES.map((k) => {
return {[k]: ['unavailable']};
return { [k]: ['unavailable'] };
}).reduce((map, obj) => {
return {
...map,
@@ -65,7 +65,7 @@ export const releaseVersionReducer = createReducer(
};
},
[Actions.setInstalledVersion]: (state, action) => {
return {...state, InstalledVersion: action.payload};
return { ...state, InstalledVersion: action.payload };
},
[Actions.setNewReleasesAvailable]: (state, action) => {
return {

View File

@@ -1,4 +1,4 @@
import {createReducer} from '@reduxjs/toolkit';
import { createReducer } from '@reduxjs/toolkit';
import * as Actions from '../actions/skynet_actions';
export const skynetReducer = createReducer(
@@ -8,10 +8,10 @@ export const skynetReducer = createReducer(
},
{
[Actions.displaySkynetExport]: (state, action) => {
return {...state, DisplayExport: action.payload};
return { ...state, DisplayExport: action.payload };
},
[Actions.displaySkynetImport]: (state, action) => {
return {...state, DisplayImport: action.payload};
return { ...state, DisplayImport: action.payload };
},
}
);

View File

@@ -1,14 +1,14 @@
import {configureStore, getDefaultMiddleware} from '@reduxjs/toolkit';
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import {createCommonReducer} from '../reducers/common_reducer';
import {downloadReducer} from '../reducers/download_reducer';
import {errorReducer} from '../reducers/error_reducer';
import {installReducer} from '../reducers/install_reducer';
import {createMountReducer} from '../reducers/mount_reducer';
import {pinnedManagerReducer} from '../reducers/pinned_manager_reducer';
import {releaseVersionReducer} from '../reducers/release_version_reducer';
import {skynetReducer} from '../reducers/skynet_reducer';
import {hostReducer} from '../reducers/host_reducer';
import { createCommonReducer } from '../reducers/common_reducer';
import { downloadReducer } from '../reducers/download_reducer';
import { errorReducer } from '../reducers/error_reducer';
import { installReducer } from '../reducers/install_reducer';
import { createMountReducer } from '../reducers/mount_reducer';
import { pinnedManagerReducer } from '../reducers/pinned_manager_reducer';
import { releaseVersionReducer } from '../reducers/release_version_reducer';
import { skynetReducer } from '../reducers/skynet_reducer';
import { hostReducer } from '../reducers/host_reducer';
export default function createAppStore(platformInfo, version, state) {
const reducer = {

View File

@@ -4,7 +4,7 @@ export const createResponseDialogAction = (type, name) => {
const display = (show, cb, data) => {
return (dispatch) => {
if (cb) {
dispatch(display(show, null, data)).then(({changed, data}) => cb(changed, data));
dispatch(display(show, null, data)).then(({ changed, data }) => cb(changed, data));
} else {
return new Promise((resolve) => {
dispatch(handleDisplay(show, data, resolve));
@@ -27,7 +27,7 @@ export const createResponseDialogAction = (type, name) => {
const complete = (changed, data) => {
return (dispatch) => {
if (changed) {
resolverList[0]({changed, data});
resolverList[0]({ changed, data });
}
resolverList.splice(0, 1);
dispatch(displayAction(false));
@@ -36,7 +36,7 @@ export const createResponseDialogAction = (type, name) => {
const DISPLAY_ACTION = type + '/' + name;
const displayAction = (display, data) => {
return {type: DISPLAY_ACTION, payload: {display, data}};
return { type: DISPLAY_ACTION, payload: { display, data } };
};
return {

View File

@@ -1,6 +1,6 @@
const Constants = require('../../constants');
const addListeners = (ipcMain, {closeApplication, setWindowVisibility}) => {
const addListeners = (ipcMain, { closeApplication, setWindowVisibility }) => {
ipcMain.on(Constants.IPC_Shutdown, () => {
closeApplication();
});
@@ -15,4 +15,4 @@ const addListeners = (ipcMain, {closeApplication, setWindowVisibility}) => {
});
};
module.exports = {addListeners};
module.exports = { addListeners };

View File

@@ -1,55 +1,55 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {standardIPCReply}) => {
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Config, (event, data) => {
helpers
.getConfig(data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
if (data.Code === 0) {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {
Config: data.Data,
});
} else {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, data.Code);
}
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, error);
});
.getConfig(data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
if (data.Code === 0) {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {
Config: data.Data,
});
} else {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, data.Code);
}
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, error);
});
});
ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
helpers
.getConfigTemplate(data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {
Template: data,
.getConfigTemplate(data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {
Template: data,
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {}, error);
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {}, error);
});
});
ipcMain.on(Constants.IPC_Set_Config_Values, (event, data) => {
const setConfigValue = (i) => {
if (i < data.Items.length) {
helpers
.setConfigValue(
data.Items[i].Name,
data.Items[i].Value,
data.Provider,
data.Remote,
data.S3,
data.Version
)
.then(() => {
setConfigValue(++i);
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}, error);
});
.setConfigValue(
data.Items[i].Name,
data.Items[i].Value,
data.Provider,
data.Remote,
data.S3,
data.Version
)
.then(() => {
setConfigValue(++i);
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}, error);
});
} else {
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {});
}

View File

@@ -1,45 +1,45 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {standardIPCReply}) => {
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Check_Daemon_Version, (event, data) => {
helpers
.checkDaemonVersion(data.Version, data.Provider)
.then((code) => {
standardIPCReply(event, Constants.IPC_Check_Daemon_Version_Reply, {
Valid: code === 0,
Code: code,
.checkDaemonVersion(data.Version, data.Provider)
.then((code) => {
standardIPCReply(event, Constants.IPC_Check_Daemon_Version_Reply, {
Valid: code === 0,
Code: code,
});
})
.catch((e) => {
standardIPCReply(
event,
Constants.IPC_Check_Daemon_Version_Reply,
{
Valid: false,
},
e
);
});
})
.catch((e) => {
standardIPCReply(
event,
Constants.IPC_Check_Daemon_Version_Reply,
{
Valid: false,
},
e
);
});
});
ipcMain.on(Constants.IPC_Check_Daemon_Version + '_sync', (event, data) => {
helpers
.checkDaemonVersion(data.Version, data.Provider)
.then((code) => {
event.returnValue = {
data: {
Success: true,
Valid: code === 0,
Code: code,
},
};
})
.catch((e) => {
event.returnValue = {
data: {Error: e.toString(), Success: false, Valid: false},
};
});
.checkDaemonVersion(data.Version, data.Provider)
.then((code) => {
event.returnValue = {
data: {
Success: true,
Valid: code === 0,
Code: code,
},
};
})
.catch((e) => {
event.returnValue = {
data: { Error: e.toString(), Success: false, Valid: false },
};
});
});
};

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const fs = require('fs');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {standardIPCReply}) => {
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Check_Dependency_Installed, (event, data) => {
try {
const exists = fs.lstatSync(data.File).isFile();
@@ -30,7 +30,7 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
};
} catch (e) {
event.returnValue = {
data: {Exists: false},
data: { Exists: false },
};
}
});
@@ -38,28 +38,7 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
if (data.Source.toLowerCase().endsWith('.dmg')) {
helpers
.executeAsync('open', ['-a', 'Finder', '-W', data.Source])
.then(() => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
URL: data.URL,
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Install_Dependency_Reply,
{
Source: data.Source,
URL: data.URL,
},
error
);
});
} else {
const execInstall = () => {
helpers
.executeAndWait(data.Source)
.executeAsync('open', ['-a', 'Finder', '-W', data.Source])
.then(() => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
Source: data.Source,
@@ -77,32 +56,53 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
error
);
});
};
if (data.IsWinFSP) {
} else {
const execInstall = () => {
helpers
.performWindowsUninstall(Constants.WINFSP_VERSION_NAMES)
.then((uninstalled) => {
if (uninstalled) {
.executeAndWait(data.Source)
.then(() => {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
RebootRequired: true,
Source: data.Source,
URL: data.URL,
});
} else {
execInstall();
}
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Install_Dependency_Reply,
{
Source: data.Source,
URL: data.URL,
},
error
);
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Install_Dependency_Reply,
{
Source: data.Source,
URL: data.URL,
},
error
);
});
};
if (data.IsWinFSP) {
helpers
.performWindowsUninstall(Constants.WINFSP_VERSION_NAMES)
.then((uninstalled) => {
if (uninstalled) {
standardIPCReply(event, Constants.IPC_Install_Dependency_Reply, {
RebootRequired: true,
Source: data.Source,
URL: data.URL,
});
} else {
execInstall();
}
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Install_Dependency_Reply,
{
Source: data.Source,
URL: data.URL,
},
error
);
});
} else {
execInstall();
}

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const helpers = require('../../helpers');
const path = require('path');
const addListeners = (ipcMain, {standardIPCReply}) => {
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Download_File, (event, data) => {
const destination = path.join(helpers.getDataDirectory(), data.Filename);
helpers.downloadFile(
@@ -30,4 +30,4 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
});
};
module.exports = {addListeners};
module.exports = { addListeners };

View File

@@ -1,7 +1,7 @@
const Constants = require('../../constants');
const fs = require('fs');
const addListeners = (ipcMain, {getMainWindow, dialog}) => {
const addListeners = (ipcMain, { getMainWindow, dialog }) => {
ipcMain.on(Constants.IPC_Browse_Directory + '_sync', (event, data) => {
dialog.showOpenDialog(
getMainWindow(),
@@ -43,8 +43,7 @@ const addListeners = (ipcMain, {getMainWindow, dialog}) => {
if (fs.existsSync(data.FilePath)) {
fs.unlinkSync(data.FilePath);
}
} catch (e) {
}
} catch (e) {}
});
ipcMain.on(Constants.IPC_Select_File + '_sync', (event, data) => {
@@ -68,18 +67,18 @@ const addListeners = (ipcMain, {getMainWindow, dialog}) => {
ipcMain.on(Constants.IPC_Read_File + '_sync', (event, data) => {
try {
const contents = fs.readFileSync(data.Location, 'utf8').toString();
event.returnValue = {success: true, contents};
event.returnValue = { success: true, contents };
} catch (err) {
event.returnValue = {success: false, error: err.toString()};
event.returnValue = { success: false, error: err.toString() };
}
});
ipcMain.on(Constants.IPC_Save_File + '_sync', (event, data) => {
try {
fs.writeFileSync(data.Location, data.Data, 'utf8');
event.returnValue = {success: true};
event.returnValue = { success: true };
} catch (err) {
event.returnValue = {success: false, error: err.toString()};
event.returnValue = { success: false, error: err.toString() };
}
});
};

View File

@@ -20,28 +20,28 @@ const clearManualMountDetection = (provider) => {
const monitorMount = (sender, provider, providerList, version, pid, location) => {
manualMountDetection[provider] = setInterval(() => {
helpers
.detectRepertoryMounts(version, providerList)
.then((result) => {
if (result[provider].PID !== pid) {
if (result[provider].PID === -1) {
clearManualMountDetection(provider);
sender.send(Constants.IPC_Unmount_Drive_Reply, {
data: {
Expected: expectedUnmount[provider],
Location: location,
Provider: provider,
Error: Error(provider + ' Unmounted').toString(),
Success: false,
},
});
} else {
pid = result[provider].PID;
.detectRepertoryMounts(version, providerList)
.then((result) => {
if (result[provider].PID !== pid) {
if (result[provider].PID === -1) {
clearManualMountDetection(provider);
sender.send(Constants.IPC_Unmount_Drive_Reply, {
data: {
Expected: expectedUnmount[provider],
Location: location,
Provider: provider,
Error: Error(provider + ' Unmounted').toString(),
Success: false,
},
});
} else {
pid = result[provider].PID;
}
}
}
})
.catch((e) => {
console.log(e);
});
})
.catch((e) => {
console.log(e);
});
}, 6000);
};
@@ -62,9 +62,9 @@ const unmountAllDrives = () => {
mountedData = {};
};
const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
ipcMain.on(Constants.IPC_Check_Mount_Location + '_sync', (event, data) => {
let response = {Success: true, Error: ''};
let response = { Success: true, Error: '' };
try {
if (fs.existsSync(data.Location) && fs.statSync(data.Location).isDirectory()) {
@@ -109,8 +109,7 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
driveLetters[provider].push(drive);
}
}
} catch (e) {
}
} catch (e) {}
}
}
@@ -142,66 +141,66 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
};
helpers
.detectRepertoryMounts(data.Version, providerList)
.then((results) => {
let storageData = {};
let locations = {};
for (const provider of providerList) {
storageData[provider] = results[provider]
? results[provider]
: {
Active: false,
Location: '',
PID: -1,
};
locations[provider] = storageData[provider].Location;
.detectRepertoryMounts(data.Version, providerList)
.then((results) => {
let storageData = {};
let locations = {};
for (const provider of providerList) {
storageData[provider] = results[provider]
? results[provider]
: {
Active: false,
Location: '',
PID: -1,
};
locations[provider] = storageData[provider].Location;
if (storageData[provider].PID !== -1) {
expectedUnmount[provider] = false;
if (firstMountCheck) {
monitorMount(
event.sender,
provider,
providerList,
data.Version,
storageData[provider].PID,
storageData[provider].Location
);
if (storageData[provider].PID !== -1) {
expectedUnmount[provider] = false;
if (firstMountCheck) {
monitorMount(
event.sender,
provider,
providerList,
data.Version,
storageData[provider].PID,
storageData[provider].Location
);
}
}
}
}
if (os.platform() === 'win32') {
grabDriveLetters(locations);
}
if (os.platform() === 'win32') {
grabDriveLetters(locations);
}
setImage(locations);
if (firstMountCheck) {
firstMountCheck = false;
}
standardIPCReply(event, Constants.IPC_Detect_Mount_Reply, {
Active: storageData[provider].Active,
DriveLetters: driveLetters[provider],
Location: locations[provider],
PID: storageData[provider].PID,
Provider: provider,
});
})
.catch((error) => {
if (os.platform() === 'win32') {
grabDriveLetters({});
}
setImage({});
standardIPCReply(
event,
Constants.IPC_Detect_Mount_Reply,
{
setImage(locations);
if (firstMountCheck) {
firstMountCheck = false;
}
standardIPCReply(event, Constants.IPC_Detect_Mount_Reply, {
Active: storageData[provider].Active,
DriveLetters: driveLetters[provider],
Location: locations[provider],
PID: storageData[provider].PID,
Provider: provider,
},
error
);
});
});
})
.catch((error) => {
if (os.platform() === 'win32') {
grabDriveLetters({});
}
setImage({});
standardIPCReply(
event,
Constants.IPC_Detect_Mount_Reply,
{
DriveLetters: driveLetters[provider],
Provider: provider,
},
error
);
});
});
ipcMain.on(Constants.IPC_Mount_Drive, (event, data) => {
@@ -237,26 +236,26 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
);
};
helpers
.executeMount(
data.Version,
data.Provider,
data.Remote,
data.S3,
data.Location,
(error, pid) => {
errorHandler(pid, error);
}
)
.then(() => {
standardIPCReply(event, Constants.IPC_Mount_Drive_Reply, {
Provider: data.Provider,
Remote: data.Remote,
S3: data.S3,
.executeMount(
data.Version,
data.Provider,
data.Remote,
data.S3,
data.Location,
(error, pid) => {
errorHandler(pid, error);
}
)
.then(() => {
standardIPCReply(event, Constants.IPC_Mount_Drive_Reply, {
Provider: data.Provider,
Remote: data.Remote,
S3: data.S3,
});
})
.catch((error) => {
errorHandler(-1, error);
});
})
.catch((error) => {
errorHandler(-1, error);
});
}
});
@@ -277,7 +276,7 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
standardIPCReply(
event,
Constants.IPC_Remove_Mount_Reply,
{DataDirectory: dataDirectory},
{ DataDirectory: dataDirectory },
e
);
}
@@ -293,13 +292,13 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
expectedUnmount[data.Provider] = true;
helpers
.stopMountProcess(data.Version, data.Provider, data.Remote, data.S3)
.then((result) => {
console.log(result);
})
.catch((e) => {
console.log(e);
});
.stopMountProcess(data.Version, data.Provider, data.Remote, data.S3)
.then((result) => {
console.log(result);
})
.catch((e) => {
console.log(e);
});
});
};

View File

@@ -1,45 +1,44 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {standardIPCReply}) => {
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)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
.grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
});
ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => {
helpers
.grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
.grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
});
ipcMain.on(Constants.IPC_Get_Pinned_Files_Status, (event, data) => {
});
ipcMain.on(Constants.IPC_Get_Pinned_Files_Status, (event, data) => {});
ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => {
helpers
.setPinned(data.Path, data.Pinned, data.Version, data.Provider, data.Remote, data.S3)
.then((success) => {
event.returnValue = success;
})
.catch((e) => {
event.returnValue = false;
});
.setPinned(data.Path, data.Pinned, data.Version, data.Provider, data.Remote, data.S3)
.then((success) => {
event.returnValue = success;
})
.catch((e) => {
event.returnValue = false;
});
});
};

View File

@@ -4,7 +4,7 @@ const helpers = require('../../helpers');
const os = require('os');
const path = require('path');
const addListeners = (ipcMain, {detectScript}) => {
const addListeners = (ipcMain, { detectScript }) => {
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
const sendResponse = (appPlatform, platform) => {
event.sender.send(Constants.IPC_Get_Platform_Reply, {
@@ -19,32 +19,32 @@ const addListeners = (ipcMain, {detectScript}) => {
fs.writeFileSync(scriptFile, detectScript);
helpers
.executeScript(scriptFile)
.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, '');
.executeScript(scriptFile)
.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);
})
.catch(() => {
sendResponse(appPlatform, platform);
});
}
});
} else {
sendResponse(appPlatform, platform);
}
})
.catch(() => {
sendResponse(platform, 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);
}
})
.catch(() => {
sendResponse(platform, platform);
});
} else {
sendResponse(platform, platform);
}

View File

@@ -5,34 +5,33 @@ const os = require('os');
const path = require('path');
const unzip = require('unzipper');
const addListeners = (ipcMain, {getCleanupReleases, standardIPCReply}) => {
const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => {
ipcMain.on(Constants.IPC_Check_Installed, (event, data) => {
const destination = path.join(helpers.getDataDirectory(), data.Version);
helpers
.getMissingDependencies(data.Dependencies)
.then((dependencies) => {
let exists = false;
try {
exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
} catch (e) {
}
standardIPCReply(event, Constants.IPC_Check_Installed_Reply, {
Dependencies: dependencies,
Exists: exists,
Version: data.Version,
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Check_Installed_Reply,
{
Dependencies: [],
.getMissingDependencies(data.Dependencies)
.then((dependencies) => {
let exists = false;
try {
exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
} catch (e) {}
standardIPCReply(event, Constants.IPC_Check_Installed_Reply, {
Dependencies: dependencies,
Exists: exists,
Version: data.Version,
},
error
);
});
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Check_Installed_Reply,
{
Dependencies: [],
Version: data.Version,
},
error
);
});
});
ipcMain.on(Constants.IPC_Cleanup_Releases + '_sync', (event, data) => {
@@ -50,59 +49,58 @@ const addListeners = (ipcMain, {getCleanupReleases, standardIPCReply}) => {
const stream = fs.createReadStream(data.Source);
stream
.pipe(unzip.Extract({path: destination}))
.on('error', (error) => {
try {
helpers.removeDirectoryRecursively(destination);
} catch (e) {
}
stream.close();
standardIPCReply(
event,
Constants.IPC_Extract_Release_Complete,
{
Source: data.Source,
},
error
);
})
.on('finish', () => {
stream.close();
if (os.platform() !== 'win32') {
helpers
.executeAndWait('chmod +x "' + path.join(destination, 'repertory') + '"')
.then(() => {
.pipe(unzip.Extract({ path: destination }))
.on('error', (error) => {
try {
helpers.removeDirectoryRecursively(destination);
} catch (e) {}
stream.close();
standardIPCReply(
event,
Constants.IPC_Extract_Release_Complete,
{
Source: data.Source,
},
error
);
})
.on('finish', () => {
stream.close();
if (os.platform() !== 'win32') {
helpers
.executeAndWait('chmod +x "' + path.join(destination, 'repertory') + '"')
.then(() => {
standardIPCReply(event, Constants.IPC_Extract_Release_Complete, {
Source: data.Source,
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Extract_Release_Complete,
{
Source: data.Source,
},
error
);
});
} else {
standardIPCReply(event, Constants.IPC_Extract_Release_Complete, {
Source: data.Source,
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Extract_Release_Complete,
{
Source: data.Source,
},
error
);
});
} else {
standardIPCReply(event, Constants.IPC_Extract_Release_Complete, {
Source: data.Source,
});
}
});
}
});
});
ipcMain.on(Constants.IPC_Test_Release, (event, data) => {
helpers
.testRepertoryBinary(data.Version)
.then(() => {
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {}, error);
});
.testRepertoryBinary(data.Version)
.then(() => {
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {}, error);
});
});
};

View File

@@ -1,59 +1,64 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {standardIPCReply}) => {
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Export_Skylinks, (event, data) => {
helpers
.exportSkylinks(data.Version, data.Paths)
.then((result) => {
standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, {
Result: result,
.exportSkylinks(data.Version, data.Paths)
.then((result) => {
standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, {
Result: result,
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, {}, error);
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Export_Skylinks_Reply, {}, error);
});
});
ipcMain.on(Constants.IPC_Grab_Skynet_Tree, (event, data) => {
helpers
.grabSkynetFileTree(data.Version)
.then((result) => {
standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {
Result: result,
.grabSkynetFileTree(data.Version)
.then((result) => {
standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {
Result: result,
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error);
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error);
});
});
ipcMain.on(Constants.IPC_Import_Skylinks, (event, data) => {
helpers
.importSkylinks(data.Version, data.JsonArray)
.then((result) => {
standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, {
Result: result,
.importSkylinks(data.Version, data.JsonArray)
.then((result) => {
standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, {
Result: result,
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, {}, error);
});
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Import_Skylinks_Reply, {}, error);
});
});
ipcMain.on(Constants.IPC_Skynet_Test_Logon, (event, data) => {
helpers
.testSkynetLogon(data.Version, data.AuthURL, data.AuthUser, data.AuthPassword)
.then((success) => {
if (success) {
standardIPCReply(event, Constants.IPC_Skynet_Test_Logon_Reply, {});
} else {
standardIPCReply(event, Constants.IPC_Skynet_Test_Logon_Reply, {}, 'Logon failed. Please check credentials');
}
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Skynet_Test_Logon_Reply, {}, error);
});
.testSkynetLogon(data.Version, data.AuthURL, data.AuthUser, data.AuthPassword)
.then((success) => {
if (success) {
standardIPCReply(event, Constants.IPC_Skynet_Test_Logon_Reply, {});
} else {
standardIPCReply(
event,
Constants.IPC_Skynet_Test_Logon_Reply,
{},
'Logon failed. Please check credentials'
);
}
})
.catch((error) => {
standardIPCReply(event, Constants.IPC_Skynet_Test_Logon_Reply, {}, error);
});
});
};

View File

@@ -6,9 +6,9 @@ const path = require('path');
const getDirectories = (source) => {
try {
return fs
.readdirSync(source, {withFileTypes: true})
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
.readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
} catch {
return [];
}

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const os = require('os');
const helpers = require('../../helpers');
const addListeners = (ipcMain, {closeApplication}) => {
const addListeners = (ipcMain, { closeApplication }) => {
ipcMain.on(Constants.IPC_Reboot_System, () => {
if (os.platform() === 'win32') {
helpers.executeAsync('shutdown.exe', ['/r', '/t', '30']);
@@ -11,4 +11,4 @@ const addListeners = (ipcMain, {closeApplication}) => {
});
};
module.exports = {addListeners};
module.exports = { addListeners };

View File

@@ -3,7 +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;
@@ -19,8 +19,7 @@ const addListeners = (ipcMain, {setIsInstalling, unmountAllDrives, standardIPCRe
if (tempPub) {
fs.unlinkSync(tempPub);
}
} catch (e) {
}
} catch (e) {}
};
const errorHandler = (err) => {
@@ -76,35 +75,35 @@ const addListeners = (ipcMain, {setIsInstalling, unmountAllDrives, standardIPCRe
const executeInstall = () => {
setIsInstalling(true);
helpers
.executeAsync(command, args)
.then(() => {
cleanupFiles();
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply);
})
.catch((error) => {
setIsInstalling(false);
errorHandler(error);
});
.executeAsync(command, args)
.then(() => {
cleanupFiles();
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply);
})
.catch((error) => {
setIsInstalling(false);
errorHandler(error);
});
};
if (hasSignature) {
helpers
.verifySignature(data.Source, tempSig, tempPub)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package signature'));
});
.verifySignature(data.Source, tempSig, tempPub)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package signature'));
});
} else if (hasHash) {
helpers
.verifyHash(data.Source, data.Sha256)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package hash'));
});
.verifyHash(data.Source, data.Sha256)
.then(() => {
executeInstall();
})
.catch(() => {
errorHandler(Error('Failed to verify installation package hash'));
});
} else {
if (platform === 'darwin') {
setTimeout(executeInstall, 3000);

View File

@@ -86,31 +86,31 @@ export const getChangesForRepertoryVersion = (version) => {
Constants.REPERTORY_BRANCH +
'/CHANGELOG.md';
axios
.get(url, {
responseType: 'text',
})
.then((response) => {
try {
let found = false;
let ended = false;
let lines = response.data
.replace(/(\r\n)/gm, '\n')
.split('\n')
.filter((l) => {
return (
!ended &&
l.length > 0 &&
(found ? !(ended = l.startsWith('## ')) : (found = l.startsWith(`## ${version}`)))
);
});
resolve(lines);
} catch (e) {
reject(e);
}
})
.catch((error) => {
reject(error);
});
.get(url, {
responseType: 'text',
})
.then((response) => {
try {
let found = false;
let ended = false;
let lines = response.data
.replace(/(\r\n)/gm, '\n')
.split('\n')
.filter((l) => {
return (
!ended &&
l.length > 0 &&
(found ? !(ended = l.startsWith('## ')) : (found = l.startsWith(`## ${version}`)))
);
});
resolve(lines);
} catch (e) {
reject(e);
}
})
.catch((error) => {
reject(error);
});
});
};
@@ -123,20 +123,20 @@ export const getNewReleases = (existingLocations, newLocations, selectedVersion)
if (existingLocations && newLocations) {
Constants.RELEASE_TYPES.forEach((release) => {
newLocations[release]
.filter(
(version) =>
version !== selectedVersion &&
!existingLocations[release].includes(version) &&
version !== 'unavailable'
)
.forEach((version) => {
ret.splice(0, 0, {
Display: version,
Release: Constants.RELEASE_TYPES.indexOf(release),
Version: newLocations[release].indexOf(version),
VersionString: version,
.filter(
(version) =>
version !== selectedVersion &&
!existingLocations[release].includes(version) &&
version !== 'unavailable'
)
.forEach((version) => {
ret.splice(0, 0, {
Display: version,
Release: Constants.RELEASE_TYPES.indexOf(release),
Version: newLocations[release].indexOf(version),
VersionString: version,
});
});
});
});
}
@@ -147,7 +147,7 @@ export const getSelectedVersionFromState = (state) => {
return state.relver.Version === -1
? 'unavailable'
: state.relver.VersionLookup[Constants.RELEASE_TYPES[state.relver.Release]][
state.relver.Version
state.relver.Version
];
};