Update prettier/eslint

This commit is contained in:
2021-05-03 16:51:50 -05:00
parent 9246b33440
commit 7cb3094305
52 changed files with 312 additions and 968 deletions

View File

@@ -1,4 +1,5 @@
{ {
"root":true,
"env": { "env": {
"browser": true, "browser": true,
"es2021": true, "es2021": true,

View File

@@ -1,12 +1,4 @@
const { const { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, Tray } = require('electron');
app,
BrowserWindow,
dialog,
ipcMain,
Menu,
nativeImage,
Tray,
} = require('electron');
const AutoLaunch = require('auto-launch'); const AutoLaunch = require('auto-launch');
const Constants = require('../src/constants'); const Constants = require('../src/constants');
const fs = require('fs'); const fs = require('fs');
@@ -44,8 +36,8 @@ const UpgradeIPC = require('../src/renderer/ipc/UpgradeIPC');
const platform = os.platform(); const platform = os.platform();
const dimensions = { const dimensions = {
height: platform === "win32" || platform === "darwin" ? 420 : 400, height: platform === 'win32' || platform === 'darwin' ? 420 : 400,
width: platform === "win32" ? 468 : 628 width: platform === 'win32' ? 468 : 628,
}; };
let isShutdown = false; let isShutdown = false;
@@ -146,9 +138,7 @@ const createWindow = () => {
platform === 'win32' platform === 'win32'
? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe'))
: platform === 'darwin' : platform === 'darwin'
? path.resolve( ? path.resolve(path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui'))
path.join(path.dirname(app.getAppPath()), '../MacOS/repertory-ui')
)
: process.env.APPIMAGE; : process.env.APPIMAGE;
const autoLauncher = new AutoLaunch({ const autoLauncher = new AutoLaunch({
@@ -206,10 +196,7 @@ const createWindow = () => {
]); ]);
const image = nativeImage.createFromPath( const image = nativeImage.createFromPath(
path.join( path.join(__dirname, platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png')
__dirname,
platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png'
)
); );
mainWindowTray = new Tray(image); mainWindowTray = new Tray(image);
@@ -232,10 +219,7 @@ const getMainWindow = () => {
}; };
const loadUiSettings = () => { const loadUiSettings = () => {
const settingFile = path.join( const settingFile = path.join(helpers.resolvePath(Constants.DATA_LOCATIONS[platform]), 'ui.json');
helpers.resolvePath(Constants.DATA_LOCATIONS[platform]),
'ui.json'
);
try { try {
if (fs.statSync(settingFile).isFile()) { if (fs.statSync(settingFile).isFile()) {
const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8')); const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8'));
@@ -271,17 +255,12 @@ const setTrayImage = (driveInUse) => {
image = nativeImage.createFromPath( image = nativeImage.createFromPath(
path.join( path.join(
__dirname, __dirname,
platform === 'darwin' platform === 'darwin' ? '../build/logo_both_mac.png' : '../build/logo_both.png'
? '../build/logo_both_mac.png'
: '../build/logo_both.png'
) )
); );
} else { } else {
image = nativeImage.createFromPath( image = nativeImage.createFromPath(
path.join( path.join(__dirname, platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png')
__dirname,
platform === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png'
)
); );
} }
mainWindowTray.setImage(image); mainWindowTray.setImage(image);

View File

@@ -20,18 +20,12 @@ import {
setNewReleasesAvailable, setNewReleasesAvailable,
} from './redux/actions/release_version_actions'; } from './redux/actions/release_version_actions';
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay'; import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
import { import { displaySelectAppPlatform, saveState } from './redux/actions/common_actions';
displaySelectAppPlatform,
saveState,
} from './redux/actions/common_actions';
import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform'; import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform';
import Text from './components/UI/Text/Text'; import Text from './components/UI/Text/Text';
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon'; import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
import UpgradeUI from './components/UpgradeUI/UpgradeUI'; import UpgradeUI from './components/UpgradeUI/UpgradeUI';
import { import { loadReleases, setDismissUIUpgrade } from './redux/actions/release_version_actions';
loadReleases,
setDismissUIUpgrade,
} from './redux/actions/release_version_actions';
import YesNo from './components/YesNo/YesNo'; import YesNo from './components/YesNo/YesNo';
import { createModalConditionally } from './utils.jsx'; import { createModalConditionally } from './utils.jsx';
import SkynetImport from './containers/SkynetImport/SkynetImport'; import SkynetImport from './containers/SkynetImport/SkynetImport';
@@ -106,8 +100,7 @@ class App extends IPCContainer {
!this.props.DownloadActive && !this.props.DownloadActive &&
selectedVersion !== 'unavailable' && selectedVersion !== 'unavailable' &&
selectedVersion !== this.props.InstalledVersion; selectedVersion !== this.props.InstalledVersion;
const missingDependencies = const missingDependencies = this.props.MissingDependencies.length > 0 && this.props.AllowMount;
this.props.MissingDependencies.length > 0 && this.props.AllowMount;
const allowMount = const allowMount =
this.props.AllowMount && this.props.AllowMount &&
@@ -142,9 +135,7 @@ class App extends IPCContainer {
!this.props.RebootRequired; !this.props.RebootRequired;
const showPinnedManager = const showPinnedManager =
!missingDependencies && !missingDependencies && !this.props.RebootRequired && this.props.DisplayPinnedManager;
!this.props.RebootRequired &&
this.props.DisplayPinnedManager;
const showUpgrade = const showUpgrade =
this.props.UpgradeAvailable && this.props.UpgradeAvailable &&
@@ -214,18 +205,12 @@ class App extends IPCContainer {
remoteSupported={remoteSupported} remoteSupported={remoteSupported}
/> />
); );
const addEditHostDisplay = createModalConditionally( const addEditHostDisplay = createModalConditionally(showAddEditHost, <AddEditHost />);
showAddEditHost,
<AddEditHost />
);
const pinnedManagerDisplay = createModalConditionally( const pinnedManagerDisplay = createModalConditionally(
showPinnedManager, showPinnedManager,
<PinnedManager version={selectedVersion} /> <PinnedManager version={selectedVersion} />
); );
const confirmDisplay = createModalConditionally( const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo />);
this.props.DisplayConfirmYesNo,
<YesNo />
);
const dependencyDisplay = createModalConditionally( const dependencyDisplay = createModalConditionally(
showDependencies, showDependencies,
<DependencyList />, <DependencyList />,
@@ -238,24 +223,10 @@ class App extends IPCContainer {
false, false,
true true
); );
const errorDisplay = createModalConditionally( const errorDisplay = createModalConditionally(this.props.DisplayError, <ErrorDetails />, true);
this.props.DisplayError, const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true);
<ErrorDetails />, const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />);
true const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
);
const infoDisplay = createModalConditionally(
this.props.DisplayInfo,
<InfoDetails />,
true
);
const newReleasesDisplay = createModalConditionally(
showNewReleases,
<NewReleases />
);
const rebootDisplay = createModalConditionally(
this.props.RebootRequired,
<Reboot />
);
const selectAppPlatformDisplay = createModalConditionally( const selectAppPlatformDisplay = createModalConditionally(
this.props.DisplaySelectAppPlatform, this.props.DisplaySelectAppPlatform,
<SelectAppPlatform /> <SelectAppPlatform />
@@ -294,10 +265,7 @@ class App extends IPCContainer {
rowSpan={'17'} rowSpan={'17'}
key={'md_' + key++} key={'md_' + key++}
dxStyle={{ padding: 'var(--default_spacing)' }}> dxStyle={{ padding: 'var(--default_spacing)' }}>
<ReleaseVersionDisplay <ReleaseVersionDisplay downloadDisabled={!downloadEnabled} version={selectedVersion} />
downloadDisabled={!downloadEnabled}
version={selectedVersion}
/>
</Box> </Box>
); );
if (allowMount) { if (allowMount) {
@@ -349,8 +317,7 @@ class App extends IPCContainer {
<UpgradeIcon <UpgradeIcon
available={ available={
!missingDependencies && !missingDependencies &&
(this.props.UpgradeAvailable || (this.props.UpgradeAvailable || this.props.NewReleasesAvailable2.length > 0)
this.props.NewReleasesAvailable2.length > 0)
} }
newReleases={ newReleases={
!missingDependencies && !missingDependencies &&
@@ -428,16 +395,12 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displaySelectAppPlatform: (display) => displaySelectAppPlatform: (display) => dispatch(displaySelectAppPlatform(display)),
dispatch(displaySelectAppPlatform(display)),
loadReleases: () => dispatch(loadReleases()), loadReleases: () => dispatch(loadReleases()),
notifyError: (msg, critical, callback) => notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
dispatch(notifyError(msg, critical, callback)),
saveState: () => dispatch(saveState()), saveState: () => dispatch(saveState()),
setDismissNewReleasesAvailable: (dismiss) => setDismissNewReleasesAvailable: (dismiss) => dispatch(setDismissNewReleasesAvailable(dismiss)),
dispatch(setDismissNewReleasesAvailable(dismiss)), setNewReleasesAvailable: (items) => dispatch(setNewReleasesAvailable(items)),
setNewReleasesAvailable: (items) =>
dispatch(setNewReleasesAvailable(items)),
setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)), setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)),
}; };
}; };

View File

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

View File

@@ -18,10 +18,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
downloadItem: (name, type, url, isWinFSP) => downloadItem: (name, type, url, isWinFSP) => dispatch(downloadItem(name, type, url, isWinFSP)),
dispatch(downloadItem(name, type, url, isWinFSP)), setDismissDependencies: (dismiss) => dispatch(setDismissDependencies(dismiss)),
setDismissDependencies: (dismiss) =>
dispatch(setDismissDependencies(dismiss)),
}; };
}; };

View File

@@ -7,8 +7,7 @@ import './ErrorDetails.css';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
ErrorMessage: ErrorMessage: state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '',
state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '',
}; };
}; };

View File

@@ -8,8 +8,7 @@ import { promptLocationAndSaveFile } from '../../utils';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
InfoMessage: InfoMessage: state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '',
state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '',
}; };
}; };
@@ -75,9 +74,7 @@ export default connect(
clicked={() => { clicked={() => {
if ( if (
promptLocationAndSaveFile( promptLocationAndSaveFile(
props.InfoMessage.fileName + props.InfoMessage.fileName + '.' + props.InfoMessage.extension,
'.' +
props.InfoMessage.extension,
msg, msg,
props.notifyError props.notifyError
) )

View File

@@ -2,10 +2,7 @@ import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import * as Constants from '../../../constants'; import * as Constants from '../../../constants';
import Button from '../../UI/Button/Button'; import Button from '../../UI/Button/Button';
import { import { formatLinesForDisplay, getChangesForRepertoryVersion } from '../../../utils.jsx';
formatLinesForDisplay,
getChangesForRepertoryVersion,
} from '../../../utils.jsx';
import { notifyError, notifyInfo } from '../../../redux/actions/error_actions'; import { notifyError, notifyInfo } from '../../../redux/actions/error_actions';
import { setActiveRelease } from '../../../redux/actions/release_version_actions'; import { setActiveRelease } from '../../../redux/actions/release_version_actions';
import { unmountAll } from '../../../redux/actions/mount_actions'; import { unmountAll } from '../../../redux/actions/mount_actions';
@@ -19,8 +16,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
setActiveRelease: (release, version) => setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
dispatch(setActiveRelease(release, version)),
notifyError: (msg) => dispatch(notifyError(msg)), notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
unmountAll: (completedCallback) => dispatch(unmountAll(completedCallback)), unmountAll: (completedCallback) => dispatch(unmountAll(completedCallback)),
@@ -42,21 +38,17 @@ export default connect(
setActiveRelease, setActiveRelease,
unmountAll, unmountAll,
}) => { }) => {
const title = const title = '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
'[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
const displayChanges = async () => { const displayChanges = async () => {
try { try {
const lines = await getChangesForRepertoryVersion( const lines = await getChangesForRepertoryVersion(release.VersionString);
release.VersionString
);
notifyInfo(title, formatLinesForDisplay(lines)); notifyInfo(title, formatLinesForDisplay(lines));
} catch (e) { } catch (e) {
notifyError(e); notifyError(e);
} }
}; };
const isActiveRelease = const isActiveRelease = release.Release === ActiveRelease && release.Version === ActiveVersion;
release.Release === ActiveRelease && release.Version === ActiveVersion;
const setReleaseAndVersion = () => { const setReleaseAndVersion = () => {
dismiss(); dismiss();
unmountAll(() => { unmountAll(() => {
@@ -72,9 +64,7 @@ export default connect(
<tr style={{ height: '4px' }} /> <tr style={{ height: '4px' }} />
<tr> <tr>
<td width="50%"> <td width="50%">
<Button <Button buttonStyles={{ width: '100%' }} clicked={displayChanges}>
buttonStyles={{ width: '100%' }}
clicked={displayChanges}>
Changes Changes
</Button> </Button>
</td> </td>
@@ -83,17 +73,13 @@ export default connect(
</td> </td>
<td width="50%"> <td width="50%">
{!isActiveRelease ? ( {!isActiveRelease ? (
<Button <Button buttonStyles={{ width: '100%' }} clicked={setReleaseAndVersion}>
buttonStyles={{ width: '100%' }}
clicked={setReleaseAndVersion}>
Activate Activate
</Button> </Button>
) : null} ) : null}
</td> </td>
</tr> </tr>
{lastItem ? null : ( {lastItem ? null : <tr style={{ height: 'var(--default_spacing)' }} />}
<tr style={{ height: 'var(--default_spacing)' }} />
)}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -14,8 +14,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
dismissNewReleasesAvailable: () => dismissNewReleasesAvailable: () => dispatch(setDismissNewReleasesAvailable(true)),
dispatch(setDismissNewReleasesAvailable(true)),
}; };
}; };

View File

@@ -30,10 +30,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
downloadItem: (name, type, urls) => downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)),
dispatch(downloadItem(name, type, urls)), setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
setActiveRelease: (release, version) =>
dispatch(setActiveRelease(release, version)),
}; };
}; };
@@ -44,9 +42,7 @@ export default connect(
const getSelectedVersion = () => { const getSelectedVersion = () => {
return props.ReleaseVersion === -1 return props.ReleaseVersion === -1
? 'unavailable' ? 'unavailable'
: props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][ : props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion];
props.ReleaseVersion
];
}; };
const handleDownloadRelease = () => { const handleDownloadRelease = () => {
@@ -60,15 +56,14 @@ export default connect(
const handleReleaseChanged = (e) => { const handleReleaseChanged = (e) => {
const release = Constants.RELEASE_TYPES.indexOf(e.target.value); const release = Constants.RELEASE_TYPES.indexOf(e.target.value);
const releaseVersion = const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
props.setActiveRelease(release, releaseVersion); props.setActiveRelease(release, releaseVersion);
}; };
const handleVersionChanged = (e) => { const handleVersionChanged = (e) => {
const releaseVersion = props.VersionLookup[ const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[props.Release]].indexOf(
Constants.RELEASE_TYPES[props.Release] e.target.value
].indexOf(e.target.value); );
props.setActiveRelease(props.Release, releaseVersion); props.setActiveRelease(props.Release, releaseVersion);
}; };
@@ -78,8 +73,7 @@ export default connect(
props.InstallActive || props.InstallActive ||
props.MountsBusy || props.MountsBusy ||
(!props.AllowMount && getSelectedVersion() !== 'unavailable'); (!props.AllowMount && getSelectedVersion() !== 'unavailable');
const releaseExtracting = const releaseExtracting = props.InstallType === Constants.INSTALL_TYPES.Release;
props.InstallType === Constants.INSTALL_TYPES.Release;
let optionsDisplay = []; let optionsDisplay = [];
let key = 0; let key = 0;
@@ -185,11 +179,7 @@ export default connect(
items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]} items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]}
row={5} row={5}
rowSpan={7} rowSpan={7}
selected={ selected={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion]}
props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][
props.ReleaseVersion
]
}
/> />
{optionsDisplay} {optionsDisplay}
</Grid> </Grid>

View File

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

View File

@@ -13,11 +13,7 @@ const DropDown = (props) => {
return ( return (
<div className={'DropDown'}> <div className={'DropDown'}>
<select <select
className={ className={'DropDownSelect' + (props.auto ? ' Auto ' : '') + (props.alt ? ' Alt ' : '')}
'DropDownSelect' +
(props.auto ? ' Auto ' : '') +
(props.alt ? ' Alt ' : '')
}
autoFocus={props.autoFocus} autoFocus={props.autoFocus}
disabled={props.disabled} disabled={props.disabled}
onChange={props.changed} onChange={props.changed}

View File

@@ -98,24 +98,11 @@ export default class Grid extends Component {
colSpan = colSpan(dimensions.columns - col, dimensions.columns); colSpan = colSpan(dimensions.columns - col, dimensions.columns);
} }
rowSpan = rowSpan rowSpan = rowSpan ? (rowSpan === 'remain' ? dimensions.rows - row : rowSpan) : null;
? rowSpan === 'remain' colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
? dimensions.rows - row
: rowSpan
: null;
colSpan = colSpan
? colSpan === 'remain'
? dimensions.columns - col
: colSpan
: null;
return ( return (
<GridComponent <GridComponent row={row} col={col} rowSpan={rowSpan} colSpan={colSpan} key={'gc_' + i}>
row={row}
col={col}
rowSpan={rowSpan}
colSpan={colSpan}
key={'gc_' + i}>
{child} {child}
</GridComponent> </GridComponent>
); );

View File

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

View File

@@ -17,8 +17,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
downloadItem: (name, type, urls) => downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)),
dispatch(downloadItem(name, type, urls)),
setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)), setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)),
}; };
}; };
@@ -34,19 +33,13 @@ export default connect(
: props.Platform === 'darwin' : props.Platform === 'darwin'
? 'upgrade.dmg' ? 'upgrade.dmg'
: 'repertory-ui_' + props.UpgradeVersion + '_linux_x86_64.AppImage'; : 'repertory-ui_' + props.UpgradeVersion + '_linux_x86_64.AppImage';
props.downloadItem( props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, props.UpgradeData.urls);
name,
Constants.INSTALL_TYPES.Upgrade,
props.UpgradeData.urls
);
}; };
return ( return (
<Box dxStyle={{ width: '180px', height: 'auto', padding: '5px' }}> <Box dxStyle={{ width: '180px', height: 'auto', padding: '5px' }}>
<div style={{ width: '100%', height: 'auto' }}> <div style={{ width: '100%', height: 'auto' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}> <h1 style={{ width: '100%', textAlign: 'center' }}>UI Upgrade Available</h1>
UI Upgrade Available
</h1>
</div> </div>
<table cellSpacing={5} width="100%"> <table cellSpacing={5} width="100%">
<tbody> <tbody>

View File

@@ -35,9 +35,7 @@ export default connect(
<tbody> <tbody>
<tr> <tr>
<td width="50%"> <td width="50%">
<Button <Button buttonStyles={{ width: '100%' }} clicked={() => props.hideConfirmYesNo(true)}>
buttonStyles={{ width: '100%' }}
clicked={() => props.hideConfirmYesNo(true)}>
Yes Yes
</Button> </Button>
</td> </td>

View File

@@ -33,18 +33,12 @@ exports.REPERTORY_BRANCH = _REPERTORY_BRANCH;
exports.REPERTORY_UI_BRANCH = _REPERTORY_UI_BRANCH; exports.REPERTORY_UI_BRANCH = _REPERTORY_UI_BRANCH;
exports.RELEASES_URL = exports.RELEASES_URL =
'https://bitbucket.org/blockstorage/repertory/raw/' + 'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/releases_1.3.json';
_REPERTORY_BRANCH +
'/releases_1.3.json';
exports.UI_RELEASES_URL = exports.UI_RELEASES_URL =
'https://bitbucket.org/blockstorage/repertory-ui/raw/' + 'https://bitbucket.org/blockstorage/repertory-ui/raw/' + _REPERTORY_UI_BRANCH + '/releases.json';
_REPERTORY_UI_BRANCH +
'/releases.json';
exports.LINUX_DETECT_SCRIPT_URL = exports.LINUX_DETECT_SCRIPT_URL =
'https://bitbucket.org/blockstorage/repertory/raw/' + 'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/detect_linux2.sh';
_REPERTORY_BRANCH +
'/detect_linux2.sh';
exports.LINUX_SELECTABLE_PLATFORMS = ['centos7']; exports.LINUX_SELECTABLE_PLATFORMS = ['centos7'];

View File

@@ -5,10 +5,7 @@ import DropDown from '../../components/UI/DropDown/DropDown';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Text from '../../components/UI/Text/Text'; import Text from '../../components/UI/Text/Text';
import { Component } from 'react'; import { Component } from 'react';
import { import { addEditHost, completeAddEditHost } from '../../redux/actions/host_actions';
addEditHost,
completeAddEditHost,
} from '../../redux/actions/host_actions';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createDismissDisplay } from '../../utils.jsx'; import { createDismissDisplay } from '../../utils.jsx';
import { notifyError } from '../../redux/actions/error_actions'; import { notifyError } from '../../redux/actions/error_actions';
@@ -77,9 +74,7 @@ class AddEditHost extends Component {
</div> </div>
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<input <input
onChange={(e) => onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
this.setState({ HostNameOrIp: e.target.value.trim() })
}
className={'ConfigurationItemInput'} className={'ConfigurationItemInput'}
style={{ width: '100%' }} style={{ width: '100%' }}
type={'text'} type={'text'}
@@ -103,9 +98,7 @@ class AddEditHost extends Component {
<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 <input
onChange={(e) => onChange={(e) => this.setState({ ApiPort: parseInt(e.target.value) })}
this.setState({ ApiPort: parseInt(e.target.value) })
}
className={'ConfigurationItemInput'} className={'ConfigurationItemInput'}
style={{ width: '100%' }} style={{ width: '100%' }}
type={'number'} type={'number'}
@@ -116,9 +109,7 @@ class AddEditHost extends Component {
<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 <input
onChange={(e) => onChange={(e) => this.setState({ TimeoutMs: parseInt(e.target.value) })}
this.setState({ TimeoutMs: parseInt(e.target.value) })
}
className={'ConfigurationItemInput'} className={'ConfigurationItemInput'}
style={{ width: '100%' }} style={{ width: '100%' }}
type={'number'} type={'number'}
@@ -129,17 +120,9 @@ class AddEditHost extends Component {
</div> </div>
<div style={{ height: 'var(--default_spacing)' }} /> <div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<Text <Text text={'Agent String (optional)'} textAlign={'left'} type={'Heading2'} />
text={'Agent String (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
<div style={{ width: 'var(--default_spacing)' }} /> <div style={{ width: 'var(--default_spacing)' }} />
<Text <Text text={'API Key (optional)'} textAlign={'left'} type={'Heading2'} />
text={'API Key (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
</div> </div>
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<input <input
@@ -160,11 +143,7 @@ class AddEditHost extends Component {
</div> </div>
<div style={{ height: 'var(--default_spacing)' }} /> <div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<Text <Text text={'Authentication URL (premium)'} textAlign={'left'} type={'Heading2'} />
text={'Authentication URL (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
</div> </div>
<div style={{ display: 'flex', flexDirection: 'column' }}> <div style={{ display: 'flex', flexDirection: 'column' }}>
<input <input
@@ -176,17 +155,9 @@ class AddEditHost extends Component {
</div> </div>
<div style={{ height: 'var(--default_spacing)' }} /> <div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<Text <Text text={'User Name (premium)'} textAlign={'left'} type={'Heading2'} />
text={'User Name (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
<div style={{ width: 'var(--default_spacing)' }} /> <div style={{ width: 'var(--default_spacing)' }} />
<Text <Text text={'Password (premium)'} textAlign={'left'} type={'Heading2'} />
text={'Password (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
</div> </div>
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<input <input
@@ -235,8 +206,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
Close: () => dispatch(addEditHost(false)), Close: () => dispatch(addEditHost(false)),
completeAddEditHost: (host_data) => completeAddEditHost: (host_data) => dispatch(completeAddEditHost(true, host_data)),
dispatch(completeAddEditHost(true, host_data)),
notifyError: (msg) => dispatch(notifyError(msg)), notifyError: (msg) => dispatch(notifyError(msg)),
}; };
}; };

View File

@@ -24,8 +24,7 @@ const mapDispatchToProps = (dispatch) => {
dispatch(addRemoteMount(hostNameOrIp, port, token)), dispatch(addRemoteMount(hostNameOrIp, port, token)),
addS3Mount: (name, accessKey, secretKey, region, bucketName, url) => addS3Mount: (name, accessKey, secretKey, region, bucketName, url) =>
dispatch(addS3Mount(name, accessKey, secretKey, region, bucketName, url)), dispatch(addS3Mount(name, accessKey, secretKey, region, bucketName, url)),
notifyError: (msg, critical, callback) => notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
dispatch(notifyError(msg, critical, callback)),
}; };
}; };
@@ -56,8 +55,7 @@ export default connect(
if (this.state.HostNameOrIp.length === 0) { if (this.state.HostNameOrIp.length === 0) {
this.props.notifyError('Hostname or IP cannot be empty.'); this.props.notifyError('Hostname or IP cannot be empty.');
} else { } else {
const provider = const provider = 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
if (this.props.RemoteMounts.includes(provider)) { if (this.props.RemoteMounts.includes(provider)) {
this.props.notifyError('Remote host already exists'); this.props.notifyError('Remote host already exists');
} else { } else {
@@ -66,11 +64,7 @@ export default connect(
DisplayRemote: false, DisplayRemote: false,
}, },
() => { () => {
this.props.addRemoteMount( this.props.addRemoteMount(this.state.HostNameOrIp, this.state.Port, this.state.Token);
this.state.HostNameOrIp,
this.state.Port,
this.state.Token
);
this.setState({ this.setState({
...default_state, ...default_state,
}); });
@@ -147,9 +141,7 @@ export default connect(
</h1> </h1>
<Text text={'Hostname or IP'} textAlign={'left'} type={'Heading2'} /> <Text text={'Hostname or IP'} textAlign={'left'} type={'Heading2'} />
<input <input
onChange={(e) => onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
this.setState({ HostNameOrIp: e.target.value.trim() })
}
className={'ConfigurationItemInput'} className={'ConfigurationItemInput'}
type={'text'} type={'text'}
value={this.state.HostNameOrIp} value={this.state.HostNameOrIp}
@@ -174,9 +166,7 @@ export default connect(
/> />
<div style={{ paddingTop: 'var(--default_spacing)' }} /> <div style={{ paddingTop: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<Button <Button buttonStyles={{ width: '100%' }} clicked={() => this.addRemoteMount()}>
buttonStyles={{ width: '100%' }}
clicked={() => this.addRemoteMount()}>
OK OK
</Button> </Button>
<div style={{ paddingLeft: 'var(--default_spacing)' }} /> <div style={{ paddingLeft: 'var(--default_spacing)' }} />
@@ -227,11 +217,7 @@ export default connect(
</div> </div>
<div style={{ paddingTop: 'var(--default_spacing)' }} /> <div style={{ paddingTop: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<Text <Text text={'Bucket Name (optional)'} textAlign={'left'} type={'Heading2'} />
text={'Bucket Name (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
<div style={{ paddingLeft: 'var(--default_spacing)' }} /> <div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Region'} textAlign={'left'} type={'Heading2'} /> <Text text={'Region'} textAlign={'left'} type={'Heading2'} />
</div> </div>
@@ -275,9 +261,7 @@ export default connect(
<div style={{ paddingTop: 'calc(var(--default_spacing) * 2)' }} /> <div style={{ paddingTop: 'calc(var(--default_spacing) * 2)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ width: '200%' }} /> <div style={{ width: '200%' }} />
<Button <Button buttonStyles={{ width: '100%' }} clicked={() => this.addS3Mount()}>
buttonStyles={{ width: '100%' }}
clicked={() => this.addS3Mount()}>
OK OK
</Button> </Button>
<div style={{ paddingLeft: 'var(--default_spacing)' }} /> <div style={{ paddingLeft: 'var(--default_spacing)' }} />
@@ -296,9 +280,7 @@ export default connect(
{displayAddS3} {displayAddS3}
<div className={'AddMountButtons'}> <div className={'AddMountButtons'}>
{this.props.remoteSupported ? ( {this.props.remoteSupported ? (
<Button <Button className={'AddMountButton'} clicked={this.handleAddRemoteMount}>
className={'AddMountButton'}
clicked={this.handleAddRemoteMount}>
Add Remote Mount Add Remote Mount
</Button> </Button>
) : null} ) : null}
@@ -306,9 +288,7 @@ export default connect(
<div style={{ paddingRight: 'var(--default_spacing)' }} /> <div style={{ paddingRight: 'var(--default_spacing)' }} />
) : null} ) : null}
{this.props.s3Supported ? ( {this.props.s3Supported ? (
<Button <Button className={'AddMountButton'} clicked={this.handleAddS3Mount}>
className={'AddMountButton'}
clicked={this.handleAddS3Mount}>
Add S3 Mount Add S3 Mount
</Button> </Button>
) : null} ) : null}

View File

@@ -74,9 +74,7 @@ class Configuration extends IPCContainer {
const changedObjectItems = []; const changedObjectItems = [];
let j = 0; let j = 0;
for (const item of this.state.ObjectLookup[key]) { for (const item of this.state.ObjectLookup[key]) {
if ( if (this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)) {
this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)
) {
changedObjectItems.push(item); changedObjectItems.push(item);
} }
} }
@@ -101,18 +99,9 @@ class Configuration extends IPCContainer {
componentDidMount() { componentDidMount() {
this._isMounted = true; this._isMounted = true;
this.setRequestHandler( this.setRequestHandler(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply);
Constants.IPC_Get_Config_Template_Reply, this.setRequestHandler(Constants.IPC_Get_Config_Reply, this.onGetConfigReply);
this.onGetConfigTemplateReply this.setRequestHandler(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
);
this.setRequestHandler(
Constants.IPC_Get_Config_Reply,
this.onGetConfigReply
);
this.setRequestHandler(
Constants.IPC_Set_Config_Values_Reply,
this.onSetConfigValuesReply
);
this.sendRequest(Constants.IPC_Get_Config_Template, { this.sendRequest(Constants.IPC_Get_Config_Template, {
Provider: this.props.DisplayConfiguration, Provider: this.props.DisplayConfiguration,
Remote: this.props.DisplayRemoteConfiguration, Remote: this.props.DisplayRemoteConfiguration,
@@ -138,8 +127,7 @@ class Configuration extends IPCContainer {
type: template[key] ? template[key].type : null, type: template[key] ? template[key].type : null,
value: value:
template[key] && template[key] &&
(template[key].type === 'string_array' || (template[key].type === 'string_array' || template[key].type === 'object')
template[key].type === 'object')
? config[key] ? config[key]
: template[key] && template[key].type === 'host_list' : template[key] && template[key].type === 'host_list'
? config[key] ? config[key]
@@ -198,19 +186,13 @@ class Configuration extends IPCContainer {
let objectLookup = {}; let objectLookup = {};
for (const obj of list.ObjectList) { for (const obj of list.ObjectList) {
const list2 = this.createItemList( const list2 = this.createItemList(obj.value, this.state.Template[obj.label].template);
obj.value,
this.state.Template[obj.label].template
);
objectLookup[obj.label] = list2.ItemList; objectLookup[obj.label] = list2.ItemList;
} }
const isRemoteMount = const isRemoteMount =
this.props.remoteSupported && this.props.remoteSupported &&
JSON.parse( JSON.parse(objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount').value);
objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount')
.value
);
if (isRemoteMount) { if (isRemoteMount) {
for (const obj of list.ObjectList) { for (const obj of list.ObjectList) {
if (obj.hide_remote) { if (obj.hide_remote) {
@@ -316,14 +298,10 @@ class Configuration extends IPCContainer {
this.props.remoteSupported && this.props.remoteSupported &&
item.label !== 'IsRemoteMount' item.label !== 'IsRemoteMount'
) { ) {
const isRemoteMount = JSON.parse( const isRemoteMount = JSON.parse(itemList.find((s) => s.label === 'IsRemoteMount').value);
itemList.find((s) => s.label === 'IsRemoteMount').value
);
const enableRemoteMount = const enableRemoteMount =
!isRemoteMount && !isRemoteMount && JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value);
JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value); return item.label === 'RemoteHostNameOrIp' || item.label === 'RemoteMaxConnections'
return item.label === 'RemoteHostNameOrIp' ||
item.label === 'RemoteMaxConnections'
? isRemoteMount ? isRemoteMount
: item.label === 'RemoteReceiveTimeoutSeconds' || : item.label === 'RemoteReceiveTimeoutSeconds' ||
item.label === 'RemoteSendTimeoutSeconds' || item.label === 'RemoteSendTimeoutSeconds' ||
@@ -343,23 +321,17 @@ class Configuration extends IPCContainer {
confirmSave = ( confirmSave = (
<Modal> <Modal>
<Box dxStyle={{ width: '40vw', padding: 'var(--default_spacing)' }}> <Box dxStyle={{ width: '40vw', padding: 'var(--default_spacing)' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}> <h1 style={{ width: '100%', textAlign: 'center' }}>Save Changes?</h1>
Save Changes?
</h1>
<table width="100%"> <table width="100%">
<tbody> <tbody>
<tr> <tr>
<td align="center" width="50%"> <td align="center" width="50%">
<Button <Button clicked={this.saveAndClose} disabled={this.state.Saving}>
clicked={this.saveAndClose}
disabled={this.state.Saving}>
Yes Yes
</Button> </Button>
</td> </td>
<td align="center" width="50%"> <td align="center" width="50%">
<Button <Button clicked={this.props.hideConfiguration} disabled={this.state.Saving}>
clicked={this.props.hideConfiguration}
disabled={this.state.Saving}>
No No
</Button> </Button>
</td> </td>
@@ -401,8 +373,7 @@ class Configuration extends IPCContainer {
label={k.label} label={k.label}
readOnly={ readOnly={
this.state.IsRemoteMount && this.state.IsRemoteMount &&
(k.label === 'RemoteHostNameOrIp' || (k.label === 'RemoteHostNameOrIp' || k.label === 'RemotePort')
k.label === 'RemotePort')
} }
template={this.state.Template[key].template[k.label]} template={this.state.Template[key].template[k.label]}
value={k.value} value={k.value}
@@ -485,8 +456,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displayPinnedManager: (display) => dispatch(displayPinnedManager(display)), displayPinnedManager: (display) => dispatch(displayPinnedManager(display)),
notifyError: (msg, critical, callback) => notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
dispatch(notifyError(msg, critical, callback)),
hideConfiguration: () => dispatch(displayConfiguration(null, false)), hideConfiguration: () => dispatch(displayConfiguration(null, false)),
}; };
}; };

View File

@@ -26,9 +26,7 @@ export default connect(
if (target.type === 'checkbox') { if (target.type === 'checkbox') {
target.value = e.target.checked ? 'true' : 'false'; target.value = e.target.checked ? 'true' : 'false';
} else if (target.type === 'textarea') { } else if (target.type === 'textarea') {
e.target.string_array = String(e.target.value) e.target.string_array = String(e.target.value).replace(/\r\n/g, '\n').split('\n');
.replace(/\r\n/g, '\n')
.split('\n');
} }
props.changed(target); props.changed(target);
}; };

View File

@@ -11,20 +11,21 @@ import { faTrashAlt, faEdit } from '@fortawesome/free-solid-svg-icons';
// //
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
addEditHost: (host_data, cb) => dispatch(addEditHost(true, host_data, cb)), addEditHost: (host_list, host_data, cb) =>
dispatch(addEditHost(true, host_list, host_data, cb)),
}; };
}; };
const Host = ({ allowDelete, addEditHost, value, onChange, onDelete }) => { const Host = ({ allowDelete, addEditHost, host_list, host_data, onChange, onDelete }) => {
const handleEditHost = () => { const handleEditHost = () => {
addEditHost(value, (changed, host_data) => { addEditHost(host_list, host_data, (changed, host_data) => {
if (changed) { if (changed) {
onChange(host_data); onChange(host_data);
} }
}); });
}; };
const premium = value.AuthURL && value.AuthUser; const premium = host_data.AuthURL && host_data.AuthUser;
return ( return (
<div style={{ display: 'flex', flexDirection: 'row' }}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div <div
@@ -51,20 +52,20 @@ const Host = ({ allowDelete, addEditHost, value, onChange, onDelete }) => {
<p> <p>
<b> <b>
{'(premium) ' + {'(premium) ' +
value.HostNameOrIp + host_data.HostNameOrIp +
((value.Protocol === 'http' && value.ApiPort === 80) || ((host_data.Protocol === 'http' && host_data.ApiPort === 80) ||
(value.Protocol === 'https' && value.ApiPort === 443) (host_data.Protocol === 'https' && host_data.ApiPort === 443)
? '' ? ''
: ':' + value.ApiPort)} : ':' + host_data.ApiPort)}
</b> </b>
</p> </p>
) : ( ) : (
<p> <p>
{value.HostNameOrIp + {host_data.HostNameOrIp +
((value.Protocol === 'http' && value.ApiPort === 80) || ((host_data.Protocol === 'http' && host_data.ApiPort === 80) ||
(value.Protocol === 'https' && value.ApiPort === 443) (host_data.Protocol === 'https' && host_data.ApiPort === 443)
? '' ? ''
: ':' + value.ApiPort)} : ':' + host_data.ApiPort)}
</p> </p>
)} )}
</div> </div>
@@ -76,7 +77,8 @@ Host.propTypes = {
addEditHost: PropTypes.func.isRequired, addEditHost: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired,
value: PropTypes.object.isRequired, host_data: PropTypes.object.isRequired,
host_list: PropTypes.array.isRequired,
}; };
export default connect(null, mapDispatchToProps)(Host); export default connect(null, mapDispatchToProps)(Host);

View File

@@ -28,7 +28,7 @@ class HostList extends Component {
}; };
handleAddHost = () => { handleAddHost = () => {
this.props.addEditHost((changed, host_data) => { this.props.addEditHost(this.state.items, (changed, host_data) => {
if (changed) { if (changed) {
const items = [...this.state.items, host_data]; const items = [...this.state.items, host_data];
this.updateItems(items); this.updateItems(items);
@@ -86,7 +86,8 @@ class HostList extends Component {
onChange={(host_data) => this.handleChanged(host_data, index)} onChange={(host_data) => this.handleChanged(host_data, index)}
onDelete={() => this.handleDeleted(index)} onDelete={() => this.handleDeleted(index)}
allowDelete={this.state.items.length > 1} allowDelete={this.state.items.length > 1}
value={v} host_data={v}
host_list={this.state.items}
/> />
); );
})} })}
@@ -107,7 +108,7 @@ class HostList extends Component {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
addEditHost: (cb) => dispatch(addEditHost(true, null, cb)), addEditHost: (list, cb) => dispatch(addEditHost(true, list, null, cb)),
ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNo(title, cb)), ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNo(title, cb)),
}; };
}; };

View File

@@ -13,10 +13,7 @@ import {
removeMount, removeMount,
setProviderState, setProviderState,
} from '../../../redux/actions/mount_actions'; } from '../../../redux/actions/mount_actions';
import { import { displaySkynetExport, displaySkynetImport } from '../../../redux/actions/skynet_actions';
displaySkynetExport,
displaySkynetImport,
} from '../../../redux/actions/skynet_actions';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons'; import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
import CheckBox from '../../../components/UI/CheckBox/CheckBox'; import CheckBox from '../../../components/UI/CheckBox/CheckBox';
@@ -36,8 +33,7 @@ const mapDispatchToProps = (dispatch) => {
displaySkynetExport: (display) => dispatch(displaySkynetExport(display)), displaySkynetExport: (display) => dispatch(displaySkynetExport(display)),
displaySkynetImport: (display) => dispatch(displaySkynetImport(display)), displaySkynetImport: (display) => dispatch(displaySkynetImport(display)),
removeMount: (provider) => dispatch(removeMount(provider)), removeMount: (provider) => dispatch(removeMount(provider)),
setProviderState: (provider, state) => setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
dispatch(setProviderState(provider, state)),
}; };
}; };
@@ -70,12 +66,7 @@ export default connect(
height={'16px'} height={'16px'}
onClick={ onClick={
props.MState.AllowMount props.MState.AllowMount
? () => ? () => props.displayConfiguration(props.provider, props.remote, props.s3)
props.displayConfiguration(
props.provider,
props.remote,
props.s3
)
: (e) => { : (e) => {
e.preventDefault(); e.preventDefault();
} }
@@ -108,11 +99,7 @@ export default connect(
inputControls = []; inputControls = [];
let key = 0; let key = 0;
inputControls.push( inputControls.push(
<RootElem <RootElem colSpan={inputColumnSpan - 8} key={'i' + key++} row={secondRow} rowSpan={7}>
colSpan={inputColumnSpan - 8}
key={'i' + key++}
row={secondRow}
rowSpan={7}>
<input <input
disabled={!props.MState.AllowMount || props.MState.Mounted} disabled={!props.MState.AllowMount || props.MState.Mounted}
maxLength={4096} maxLength={4096}
@@ -126,9 +113,7 @@ export default connect(
); );
inputControls.push( inputControls.push(
<Button <Button
clicked={() => clicked={() => props.browseClicked(props.provider, props.PState.MountLocation)}
props.browseClicked(props.provider, props.PState.MountLocation)
}
col={inputColumnSpan - 7} col={inputColumnSpan - 7}
colSpan={7} colSpan={7}
disabled={props.MState.Mounted || !props.MState.AllowMount} disabled={props.MState.Mounted || !props.MState.AllowMount}
@@ -147,12 +132,7 @@ export default connect(
'Mount' 'Mount'
) )
) : ( ) : (
<Loader <Loader color={'var(--heading_text_color)'} height={19} type="Circles" width={19} />
color={'var(--heading_text_color)'}
height={19}
type="Circles"
width={19}
/>
); );
const actionsDisplay = ( const actionsDisplay = (
@@ -176,11 +156,7 @@ export default connect(
); );
const autoMountControl = ( const autoMountControl = (
<RootElem <RootElem col={inputColumnSpan + 24} colSpan={28} row={secondRow} rowSpan={7}>
col={inputColumnSpan + 24}
colSpan={28}
row={secondRow}
rowSpan={7}>
<CheckBox <CheckBox
changed={handleAutoMountChanged} changed={handleAutoMountChanged}
checked={props.PState.AutoMount} checked={props.PState.AutoMount}
@@ -190,11 +166,7 @@ export default connect(
); );
const autoRestartControl = ( const autoRestartControl = (
<RootElem <RootElem col={inputColumnSpan + 24 + 28} colSpan={24} row={secondRow} rowSpan={7}>
col={inputColumnSpan + 24 + 28}
colSpan={24}
row={secondRow}
rowSpan={7}>
<CheckBox <CheckBox
changed={handleAutoRestartChanged} changed={handleAutoRestartChanged}
checked={props.PState.AutoRestart} checked={props.PState.AutoRestart}
@@ -215,9 +187,7 @@ export default connect(
} }
}; };
removeControl = ( removeControl = (
<RootElem <RootElem col={(dimensions) => dimensions.columns - 6} row={secondRow + 3}>
col={(dimensions) => dimensions.columns - 6}
row={secondRow + 3}>
<a href={'#'} onClick={handleRemoveMount} style={removeStyle}> <a href={'#'} onClick={handleRemoveMount} style={removeStyle}>
<FontAwesomeIcon icon={faTrashAlt} /> <FontAwesomeIcon icon={faTrashAlt} />
</a> </a>

View File

@@ -59,18 +59,9 @@ class MountItems extends IPCContainer {
}; };
componentDidMount() { componentDidMount() {
this.setRequestHandler( this.setRequestHandler(Constants.IPC_Detect_Mount_Reply, this.onDetectMountReply);
Constants.IPC_Detect_Mount_Reply, this.setRequestHandler(Constants.IPC_Mount_Drive_Reply, this.onMountDriveReply);
this.onDetectMountReply this.setRequestHandler(Constants.IPC_Unmount_Drive_Reply, this.onUnmountDriveReply);
);
this.setRequestHandler(
Constants.IPC_Mount_Drive_Reply,
this.onMountDriveReply
);
this.setRequestHandler(
Constants.IPC_Unmount_Drive_Reply,
this.onUnmountDriveReply
);
this.props.resetMountsState(); this.props.resetMountsState();
this.detectMounts(); this.detectMounts();
} }
@@ -136,13 +127,7 @@ class MountItems extends IPCContainer {
const retrySeconds = retryItems[provider].RetrySeconds - 1; const retrySeconds = retryItems[provider].RetrySeconds - 1;
if (retrySeconds === 0) { if (retrySeconds === 0) {
this.cancelRetryMount(provider, () => { this.cancelRetryMount(provider, () => {
this.handleMountUnMount( this.handleMountUnMount(provider, remote, s3, true, mountLocation);
provider,
remote,
s3,
true,
mountLocation
);
}); });
} else { } else {
retryItems[provider].RetrySeconds = retrySeconds; retryItems[provider].RetrySeconds = retrySeconds;
@@ -192,12 +177,9 @@ class MountItems extends IPCContainer {
if (result.Success) { if (result.Success) {
if (result.Valid) { if (result.Valid) {
if (this.props.Platform !== 'win32') { if (this.props.Platform !== 'win32') {
result = this.sendSyncRequest( result = this.sendSyncRequest(Constants.IPC_Check_Mount_Location, {
Constants.IPC_Check_Mount_Location, Location: location,
{ });
Location: location,
}
);
if (!result.Success) { if (!result.Success) {
allowAction = false; allowAction = false;
this.props.notifyError(result.Error.toString()); this.props.notifyError(result.Error.toString());
@@ -225,11 +207,7 @@ class MountItems extends IPCContainer {
remote, remote,
s3, s3,
location, location,
'Incompatible ' + 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.'
provider +
' daemon. Please upgrade ' +
provider +
'.'
); );
} else { } else {
this.displayRetryMount( this.displayRetryMount(
@@ -319,8 +297,7 @@ class MountItems extends IPCContainer {
if (!this.state.RetryItems[provider]) { if (!this.state.RetryItems[provider]) {
if ( if (
arg.data.Success && arg.data.Success &&
(!arg.data.Active || (!arg.data.Active || (arg.data.Location && arg.data.Location.length > 0))
(arg.data.Location && arg.data.Location.length > 0))
) { ) {
const mountState = { const mountState = {
AllowMount: true, AllowMount: true,
@@ -358,11 +335,7 @@ class MountItems extends IPCContainer {
arg.data.Location && arg.data.Location &&
this.props.ProviderState[arg.data.Provider].AutoRestart this.props.ProviderState[arg.data.Provider].AutoRestart
) { ) {
this.displayRetryMount( this.displayRetryMount(arg.data.Provider, arg.data.Remote, arg.data.Location);
arg.data.Provider,
arg.data.Remote,
arg.data.Location
);
} else { } else {
this.detectMount(arg.data.Provider); this.detectMount(arg.data.Provider);
} }
@@ -374,9 +347,7 @@ class MountItems extends IPCContainer {
if (idx > -1) { if (idx > -1) {
this.activeDetections.splice(idx, 1); this.activeDetections.splice(idx, 1);
} }
this.props.setMountsBusy( this.props.setMountsBusy(this.activeDetections.length > 0 || this.hasActiveMount());
this.activeDetections.length > 0 || this.hasActiveMount()
);
}; };
updateMountLocation = (provider, location, mounted, driveLetters) => { updateMountLocation = (provider, location, mounted, driveLetters) => {
@@ -384,8 +355,7 @@ class MountItems extends IPCContainer {
if (location.length === 0) { if (location.length === 0) {
location = location =
this.props.Platform === 'win32' this.props.Platform === 'win32'
? !providerState.MountLocation || ? !providerState.MountLocation || providerState.MountLocation.trim().length === 0
providerState.MountLocation.trim().length === 0
? driveLetters[0] ? driveLetters[0]
: providerState.MountLocation : providerState.MountLocation
: providerState.MountLocation; : providerState.MountLocation;
@@ -420,19 +390,14 @@ class MountItems extends IPCContainer {
if (this.state.RetryItems.hasOwnProperty(provider)) { if (this.state.RetryItems.hasOwnProperty(provider)) {
if (this.state.RetryItems[provider].RetryMessage) { if (this.state.RetryItems[provider].RetryMessage) {
retryList.push( retryList.push(
<p key={'rl_' + retryList.length}> <p key={'rl_' + retryList.length}>{this.state.RetryItems[provider].RetryMessage}</p>
{this.state.RetryItems[provider].RetryMessage}
</p>
); );
} }
retryList.push( retryList.push(
<Button <Button
clicked={() => clicked={() => this.cancelRetryMount(provider, () => this.detectMounts())}
this.cancelRetryMount(provider, () => this.detectMounts())
}
key={'rl_' + retryList.length}> key={'rl_' + retryList.length}>
Cancel {provider} Remount ( Cancel {provider} Remount ({this.state.RetryItems[provider].RetrySeconds}s)
{this.state.RetryItems[provider].RetrySeconds}s)
</Button> </Button>
); );
if (++retryCount < Object.keys(this.state.RetryItems).length) { if (++retryCount < Object.keys(this.state.RetryItems).length) {
@@ -448,9 +413,7 @@ class MountItems extends IPCContainer {
retryDisplay = ( retryDisplay = (
<Modal> <Modal>
<Box <Box dxDark dxStyle={{ padding: 'var(--default_spacing)', minWidth: '70vw' }}>
dxDark
dxStyle={{ padding: 'var(--default_spacing)', minWidth: '70vw' }}>
<h1 <h1
style={{ style={{
textAlign: 'center', textAlign: 'center',
@@ -475,9 +438,7 @@ class MountItems extends IPCContainer {
/> />
); );
} else { } else {
footerItems.push( footerItems.push(<div key={'hi_' + footerItems.length} style={{ height: '27px' }} />);
<div key={'hi_' + footerItems.length} style={{ height: '27px' }} />
);
} }
let mountItems = []; let mountItems = [];
@@ -495,9 +456,7 @@ class MountItems extends IPCContainer {
<MountItem <MountItem
allowRemove={remote || s3} allowRemove={remote || s3}
browseClicked={this.handleBrowseLocation} browseClicked={this.handleBrowseLocation}
changed={(e) => changed={(e) => this.handleMountLocationChanged(provider, e.target.value)}
this.handleMountLocationChanged(provider, e.target.value)
}
clicked={this.handleMountUnMount} clicked={this.handleMountUnMount}
key={'it_' + mountItems.length} key={'it_' + mountItems.length}
provider={provider} provider={provider}
@@ -528,9 +487,7 @@ class MountItems extends IPCContainer {
{retryDisplay} {retryDisplay}
<div <div
className={ className={
this.props.remoteSupported || this.props.s3Supported this.props.remoteSupported || this.props.s3Supported ? 'MountItemsRemote' : 'MountItems'
? 'MountItemsRemote'
: 'MountItems'
}> }>
{mountItems} {mountItems}
</div> </div>
@@ -556,19 +513,15 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
notifyError: (msg, critical, callback) => notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
dispatch(notifyError(msg, critical, callback)),
resetMountsState: () => dispatch(resetMountsState()), resetMountsState: () => dispatch(resetMountsState()),
setAllowMount: (provider, allow) => setAllowMount: (provider, allow) => dispatch(setAllowMount(provider, allow)),
dispatch(setAllowMount(provider, allow)),
setAutoMountProcessed: (provider, processed) => setAutoMountProcessed: (provider, processed) =>
dispatch(setAutoMountProcessed(provider, processed)), dispatch(setAutoMountProcessed(provider, processed)),
setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)), setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)),
setMountsBusy: (busy) => dispatch(setBusy(busy)), setMountsBusy: (busy) => dispatch(setBusy(busy)),
setMountState: (provider, state) => setMountState: (provider, state) => dispatch(setMountState(provider, state)),
dispatch(setMountState(provider, state)), setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
setProviderState: (provider, state) =>
dispatch(setProviderState(provider, state)),
}; };
}; };

View File

@@ -24,8 +24,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displayPinnedManager: (display) => dispatch(displayPinnedManager(display)), displayPinnedManager: (display) => dispatch(displayPinnedManager(display)),
notifyApplicationBusy: (busy) => notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg, cb) => dispatch(notifyError(msg, false, cb)), notifyError: (msg, cb) => dispatch(notifyError(msg, false, cb)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
}; };
@@ -68,15 +67,11 @@ export default connect(
if (data.Success) { if (data.Success) {
const items = data.Items.filter( const items = data.Items.filter(
(i) => (i) =>
i.path !== '.' && i.path !== '.' && (this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.')
(this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.')
).map((i) => { ).map((i) => {
return { return {
...i, ...i,
name: name: i.path === '..' ? i.path : i.path.substr(i.path.lastIndexOf('/') + 1),
i.path === '..'
? i.path
: i.path.substr(i.path.lastIndexOf('/') + 1),
meta: { meta: {
...i.meta, ...i.meta,
pinned: i.meta.pinned === '1', pinned: i.meta.pinned === '1',
@@ -143,8 +138,7 @@ export default connect(
checked={pinned} checked={pinned}
changed={() => { changed={() => {
const items = JSON.parse(JSON.stringify(this.state.items)); const items = JSON.parse(JSON.stringify(this.state.items));
const pinned = (items[item_idx].meta.pinned = !items[item_idx] const pinned = (items[item_idx].meta.pinned = !items[item_idx].meta.pinned);
.meta.pinned);
this.setState( this.setState(
{ {
items, items,
@@ -187,9 +181,7 @@ export default connect(
X X
</a> </a>
</div> </div>
<h1 style={{ width: '100%', textAlign: 'center' }}> <h1 style={{ width: '100%', textAlign: 'center' }}>{'Pinned File Manager'}</h1>
{'Pinned File Manager'}
</h1>
<div className={'PinnedManagerActiveDirectory'}> <div className={'PinnedManagerActiveDirectory'}>
<b>&nbsp;{this.state.active_directory}</b> <b>&nbsp;{this.state.active_directory}</b>
</div> </div>
@@ -198,13 +190,7 @@ export default connect(
<div className={'PinnedManagerItems'}> <div className={'PinnedManagerItems'}>
{this.state.items.map((i, k) => { {this.state.items.map((i, k) => {
return i.directory return i.directory
? this.createDirectory( ? this.createDirectory(i.name, i.path, idx++, this.state.items.length, k)
i.name,
i.path,
idx++,
this.state.items.length,
k
)
: this.createFile( : this.createFile(
i.name, i.name,
i.path, i.path,

View File

@@ -5,10 +5,7 @@ import { connect } from 'react-redux';
import * as Constants from '../../constants'; import * as Constants from '../../constants';
import Box from '../../components/UI/Box/Box'; import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button'; import Button from '../../components/UI/Button/Button';
import { import { downloadItem, setAllowDownload } from '../../redux/actions/download_actions';
downloadItem,
setAllowDownload,
} from '../../redux/actions/download_actions';
import DropDown from '../../components/UI/DropDown/DropDown'; import DropDown from '../../components/UI/DropDown/DropDown';
import IPCContainer from '../IPCContainer/IPCContainer'; import IPCContainer from '../IPCContainer/IPCContainer';
import { notifyError } from '../../redux/actions/error_actions'; import { notifyError } from '../../redux/actions/error_actions';
@@ -52,9 +49,7 @@ class SelectAppPlatform extends IPCContainer {
handleTestClicked = () => { handleTestClicked = () => {
this.props.setInstallTestActive(true); this.props.setInstallTestActive(true);
this.props.setAllowDownload(true); this.props.setAllowDownload(true);
this.grabLatestRelease( this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]);
Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]
);
}; };
handleChanged = (e) => { handleChanged = (e) => {
@@ -70,8 +65,8 @@ class SelectAppPlatform extends IPCContainer {
<h1 className={'SAPHeading'}>Select Linux Platform</h1> <h1 className={'SAPHeading'}>Select Linux Platform</h1>
<div className={'SAPContent'}> <div className={'SAPContent'}>
<p> <p>
Repertory was unable to detect your Linux distribution. Please Repertory was unable to detect your Linux distribution. Please select one of the
select one of the following and click <b>Test</b> to continue: following and click <b>Test</b> to continue:
</p> </p>
</div> </div>
<div className={'SAPActions'}> <div className={'SAPActions'}>
@@ -81,9 +76,7 @@ class SelectAppPlatform extends IPCContainer {
items={Constants.LINUX_SELECTABLE_PLATFORMS} items={Constants.LINUX_SELECTABLE_PLATFORMS}
selected={Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]} selected={Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]}
/> />
<Button <Button clicked={this.handleTestClicked} disabled={this.props.InstallTestActive}>
clicked={this.handleTestClicked}
disabled={this.props.InstallTestActive}>
Test Test
</Button> </Button>
</div> </div>
@@ -101,9 +94,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) => downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) =>
dispatch( dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)),
downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)
),
notifyError: (msg) => dispatch(notifyError(msg)), notifyError: (msg) => dispatch(notifyError(msg)),
setAllowDownload: (allow) => dispatch(setAllowDownload(allow)), setAllowDownload: (allow) => dispatch(setAllowDownload(allow)),
setInstallTestActive: (active) => dispatch(setInstallTestActive(active)), setInstallTestActive: (active) => dispatch(setInstallTestActive(active)),

View File

@@ -33,11 +33,9 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displaySkynetExport: (display) => dispatch(displaySkynetExport(display)), displaySkynetExport: (display) => dispatch(displaySkynetExport(display)),
notifyApplicationBusy: (busy) => notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg) => dispatch(notifyError(msg)), notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) => notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')),
dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')),
}; };
}; };
@@ -55,14 +53,8 @@ export default connect(
}; };
componentDidMount() { componentDidMount() {
this.setRequestHandler( this.setRequestHandler(Constants.IPC_Grab_Skynet_Tree_Reply, this.onGrabSkynetTreeReply);
Constants.IPC_Grab_Skynet_Tree_Reply, this.setRequestHandler(Constants.IPC_Export_Skylinks_Reply, this.onExportSkylinksReply);
this.onGrabSkynetTreeReply
);
this.setRequestHandler(
Constants.IPC_Export_Skylinks_Reply,
this.onExportSkylinksReply
);
this.sendRequest(Constants.IPC_Grab_Skynet_Tree, { this.sendRequest(Constants.IPC_Grab_Skynet_Tree, {
Version: this.props.version, Version: this.props.version,
}); });
@@ -86,12 +78,7 @@ export default connect(
const treeItem = { const treeItem = {
label: item.name, label: item.name,
path: item.path, path: item.path,
value: value: item.name === '/' ? 0 : item.path ? item.path : JSON.stringify(item),
item.name === '/'
? 0
: item.path
? item.path
: JSON.stringify(item),
}; };
if (item.directory) { if (item.directory) {
@@ -136,8 +123,7 @@ export default connect(
() => { () => {
this.props.notifyInfo( this.props.notifyInfo(
'Skylink Exports', 'Skylink Exports',
'!alternate!!copyable!' + '!alternate!!copyable!' + JSON.stringify(arg.data.Result.success, null, 2)
JSON.stringify(arg.data.Result.success, null, 2)
); );
this.sendRequest(Constants.IPC_Grab_Skynet_Tree, { this.sendRequest(Constants.IPC_Grab_Skynet_Tree, {
Version: this.props.version, Version: this.props.version,
@@ -200,10 +186,7 @@ export default connect(
<h1 className={'SkynetExportHeading'}> <h1 className={'SkynetExportHeading'}>
{this.state.second_stage ? 'Verify Exports' : 'Export Files'} {this.state.second_stage ? 'Verify Exports' : 'Export Files'}
</h1> </h1>
<div <div className={this.state.second_stage ? 'SkynetExportList' : 'SkynetExportTree'}>
className={
this.state.second_stage ? 'SkynetExportList' : 'SkynetExportTree'
}>
{this.state.second_stage ? ( {this.state.second_stage ? (
this.state.checked.map((path) => { this.state.checked.map((path) => {
return ( return (
@@ -235,11 +218,7 @@ export default connect(
/> />
), ),
uncheck: ( uncheck: (
<FontAwesomeIcon <FontAwesomeIcon icon={faSquare} fixedWidth style={{ padding: 0, margin: 0 }} />
icon={faSquare}
fixedWidth
style={{ padding: 0, margin: 0 }}
/>
), ),
halfCheck: ( halfCheck: (
<FontAwesomeIcon <FontAwesomeIcon

View File

@@ -18,11 +18,7 @@ const ImportList = ({ imports_array }) => {
text={'Skylink'} text={'Skylink'}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }} style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/> />
<Text <Text type={'Heading1'} text={'Token'} style={{ minWidth: '33.33%', maxWidth: '33.33%' }} />
type={'Heading1'}
text={'Token'}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/>
</div> </div>
<hr /> <hr />
<div className={'ImportListOwner'}> <div className={'ImportListOwner'}>

View File

@@ -21,8 +21,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displaySkynetImport: (display) => dispatch(displaySkynetImport(display)), displaySkynetImport: (display) => dispatch(displaySkynetImport(display)),
notifyApplicationBusy: (busy) => notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg) => dispatch(notifyError(msg)), notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
}; };
@@ -40,10 +39,7 @@ export default connect(
}; };
componentDidMount() { componentDidMount() {
this.setRequestHandler( this.setRequestHandler(Constants.IPC_Import_Skylinks_Reply, this.onImportSkylinksReply);
Constants.IPC_Import_Skylinks_Reply,
this.onImportSkylinksReply
);
} }
componentWillUnmount() { componentWillUnmount() {
@@ -119,9 +115,7 @@ export default connect(
part = part.trim(); part = part.trim();
const pair = part.split('='); const pair = part.split('=');
if (pair.length !== 2) { if (pair.length !== 2) {
throw new Error( throw new Error('Invalid syntax for import: directory="",skylink="",token=""');
'Invalid syntax for import: directory="",skylink="",token=""'
);
} }
importItem = { importItem = {
...importItem, ...importItem,
@@ -129,9 +123,7 @@ export default connect(
}; };
} }
if (!importItem.skylink) { if (!importItem.skylink) {
throw new Error( throw new Error('Invalid syntax for import: directory="",skylink="",token=""');
'Invalid syntax for import: directory="",skylink="",token=""'
);
} }
importsArray.push(importItem); importsArray.push(importItem);
} else if (item.length > 0) { } else if (item.length > 0) {
@@ -165,22 +157,15 @@ export default connect(
this.setState( this.setState(
{ {
import_text: import_text:
failedImportsArray.length > 0 failedImportsArray.length > 0 ? JSON.stringify(failedImportsArray, null, 2) : '',
? JSON.stringify(failedImportsArray, null, 2)
: '',
imports_array: [], imports_array: [],
second_stage: false, second_stage: false,
}, },
() => { () => {
if (failedImportsArray.length > 0) { if (failedImportsArray.length > 0) {
this.props.notifyError( this.props.notifyError(`Failed to import ${failedImportsArray.length} item(s)`);
`Failed to import ${failedImportsArray.length} item(s)`
);
} else { } else {
this.props.notifyInfo( this.props.notifyInfo('Import Result', `Successfully imported ${count} item(s)`);
'Import Result',
`Successfully imported ${count} item(s)`
);
} }
} }
); );

View File

@@ -48,10 +48,7 @@ export default class Password extends Component {
this.props.changed(this.state.password); this.props.changed(this.state.password);
this.setState({ this.setState({
...this.state, ...this.state,
button_text: button_text: this.state.password && this.state.password.length > 0 ? 'clear' : 'set',
this.state.password && this.state.password.length > 0
? 'clear'
: 'set',
password2: '', password2: '',
}); });
} else { } else {
@@ -119,10 +116,7 @@ export default class Password extends Component {
return ( return (
<div className={'PasswordOwner'} style={{ ...this.props.style }}> <div className={'PasswordOwner'} style={{ ...this.props.style }}>
{this.props.readOnly ? null : ( {this.props.readOnly ? null : (
<a <a href={'#'} className={'PasswordLink'} onClick={this.handleActionClick}>
href={'#'}
className={'PasswordLink'}
onClick={this.handleActionClick}>
<u>{this.state.button_text}</u> <u>{this.state.button_text}</u>
</a> </a>
)} )}
@@ -134,20 +128,10 @@ export default class Password extends Component {
onChange={this.handlePasswordChanged} onChange={this.handlePasswordChanged}
onKeyUp={this.handlePasswordKeyUp} onKeyUp={this.handlePasswordKeyUp}
type={this.state.show_password ? 'text' : 'password'} type={this.state.show_password ? 'text' : 'password'}
value={ value={this.state.button_text === 'confirm' ? this.state.password2 : this.state.password}
this.state.button_text === 'confirm'
? this.state.password2
: this.state.password
}
/> />
<a <a href={'#'} className={'PasswordShowHide'} onClick={this.handleShowHideClick}>
href={'#'} <FontAwesomeIcon icon={this.state.show_password ? faEye : faEyeSlash} fixedWidth />
className={'PasswordShowHide'}
onClick={this.handleShowHideClick}>
<FontAwesomeIcon
icon={this.state.show_password ? faEye : faEyeSlash}
fixedWidth
/>
</a> </a>
</div> </div>
); );

View File

@@ -40,12 +40,7 @@ const _vcRuntimeExists = () => {
args2.push('REG_SZ'); args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2) _execProcessGetOutput(cmd, null, args2)
.then((lines) => { .then((lines) => {
const value = lines[2] const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
if ( if (
value.includes( value.includes(
IS_64BIT IS_64BIT
@@ -84,20 +79,14 @@ const _createTreeNodes = (fileList) => {
let tree = {}; let tree = {};
const directorySort = (a, b) => { const directorySort = (a, b) => {
return !!a.directory === !!b.directory return !!a.directory === !!b.directory ? a.name.localeCompare(b.name) : a.directory ? -1 : 1;
? a.name.localeCompare(b.name)
: a.directory
? -1
: 1;
}; };
const addNode = (obj) => { const addNode = (obj) => {
let fullPath; let fullPath;
const idx = obj.skylink.indexOf('/'); const idx = obj.skylink.indexOf('/');
if (idx > -1) { if (idx > -1) {
fullPath = path fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1)).replace(/\\/g, '/');
.join(obj.directory, obj.skylink.substr(idx + 1))
.replace(/\\/g, '/');
} else { } else {
fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/'); fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/');
} }
@@ -403,8 +392,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
provider, provider,
!Constants.PROVIDER_LIST.includes(provider) && !Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('remote'), provider.toLowerCase().startsWith('remote'),
!Constants.PROVIDER_LIST.includes(provider) && !Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3')
provider.toLowerCase().startsWith('s3')
); );
args.push('-status'); args.push('-status');
@@ -420,12 +408,10 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
}); });
process.on('exit', () => { process.on('exit', () => {
mountState[provider] = mountState[provider] = _tryParse(result, defaultData)[provider] || defaultData;
_tryParse(result, defaultData)[provider] || defaultData;
if ( if (
mountState[provider].Active && mountState[provider].Active &&
(mountState[provider].Location === 'elevating' || (mountState[provider].Location === 'elevating' || mountState[provider].Location === '')
mountState[provider].Location === '')
) { ) {
setTimeout(() => { setTimeout(() => {
grabStatus(index); grabStatus(index);
@@ -441,12 +427,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
}); });
}; };
module.exports.downloadFile = ( module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
url,
destination,
progressCallback,
completeCallback
) => {
try { try {
if (fs.existsSync(destination)) { if (fs.existsSync(destination)) {
fs.unlinkSync(destination); fs.unlinkSync(destination);
@@ -482,9 +463,7 @@ module.exports.downloadFile = (
if (downloaded === 0) { if (downloaded === 0) {
completeCallback(new Error('Received 0 bytes')); completeCallback(new Error('Received 0 bytes'));
} else if (downloaded !== total) { } else if (downloaded !== total) {
completeCallback( completeCallback(new Error('Received incorrect number of bytes'));
new Error('Received incorrect number of bytes')
);
} else { } else {
completeCallback(); completeCallback();
} }
@@ -536,9 +515,7 @@ module.exports.executeAsync = (command, args = []) => {
const launchProcess = (count, timeout) => { const launchProcess = (count, timeout) => {
let cmd = path.basename(command); let cmd = path.basename(command);
const working = const working =
cmd.length === command.length cmd.length === command.length ? null : command.substr(0, command.length - cmd.length);
? null
: command.substr(0, command.length - cmd.length);
let processOptions = { let processOptions = {
detached: true, detached: true,
shell: false, shell: false,
@@ -626,14 +603,7 @@ module.exports.executeScript = (script) => {
}); });
}; };
module.exports.executeMount = ( module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => {
version,
provider,
remote,
s3,
location,
exitCallback
) => {
return new Promise((resolve) => { return new Promise((resolve) => {
const repertoryExec = _getRepertoryExec(version); const repertoryExec = _getRepertoryExec(version);
const processOptions = { const processOptions = {
@@ -876,12 +846,7 @@ module.exports.getMissingDependencies = (dependencies) => {
} else { } else {
for (const dep of dependencies) { for (const dep of dependencies) {
try { try {
if ( if (!(fs.lstatSync(dep.file).isFile() || fs.lstatSync(dep.file).isSymbolicLink())) {
!(
fs.lstatSync(dep.file).isFile() ||
fs.lstatSync(dep.file).isSymbolicLink()
)
) {
missing.push(dep); missing.push(dep);
} }
} catch (e) { } catch (e) {
@@ -1037,10 +1002,7 @@ module.exports.importSkylinks = (version, jsonArray) => {
}; };
// https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync // https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync
module.exports.mkDirByPathSync = ( module.exports.mkDirByPathSync = (targetDir, { isRelativeToScript = false } = {}) => {
targetDir,
{ isRelativeToScript = false } = {}
) => {
const sep = path.sep; const sep = path.sep;
const initDir = path.isAbsolute(targetDir) ? sep : ''; const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.'; const baseDir = isRelativeToScript ? __dirname : '.';
@@ -1099,20 +1061,11 @@ module.exports.performWindowsUninstall = (names) => {
args2.push('REG_SZ'); args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2) _execProcessGetOutput(cmd, null, args2)
.then((lines) => { .then((lines) => {
const value = lines[2] const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
if (names.includes(value)) { if (names.includes(value)) {
const items = line.split('\\'); const items = line.split('\\');
const productCode = items[items.length - 1]; const productCode = items[items.length - 1];
_executeProcess('msiexec.exe', null, [ _executeProcess('msiexec.exe', null, ['/x', productCode, '/norestart'])
'/x',
productCode,
'/norestart',
])
.then((code) => { .then((code) => {
if (code === 0 || code === 3010 || code === 1641) { if (code === 0 || code === 3010 || code === 1641) {
resolve(true); resolve(true);
@@ -1150,14 +1103,7 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
module.exports.resolvePath = _resolvePath; module.exports.resolvePath = _resolvePath;
module.exports.setConfigValue = ( module.exports.setConfigValue = (name, value, provider, remote, s3, version) => {
name,
value,
provider,
remote,
s3,
version
) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const repertoryExec = _getRepertoryExec(version); const repertoryExec = _getRepertoryExec(version);
const processOptions = { const processOptions = {
@@ -1290,15 +1236,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
const executeVerify = (openssl) => { const executeVerify = (openssl) => {
execFile( execFile(
openssl, openssl,
[ ['dgst', '-sha256', '-verify', publicKeyFile, '-signature', signatureFile, file],
'dgst',
'-sha256',
'-verify',
publicKeyFile,
'-signature',
signatureFile,
file,
],
(err, stdout) => { (err, stdout) => {
if (err) { if (err) {
reject(err); reject(err);

View File

@@ -31,10 +31,7 @@ test('create temp signature files', () => {
encoding: 'utf8', encoding: 'utf8',
}) })
.replace(/(\r\n|\n|\r)/gm, ''); .replace(/(\r\n|\n|\r)/gm, '');
const data = helpers.createSignatureFiles( const data = helpers.createSignatureFiles(b64signature, Constants.DEV_PUBLIC_KEY);
b64signature,
Constants.DEV_PUBLIC_KEY
);
expect(data).toBeDefined(); expect(data).toBeDefined();
expect(data.PublicKeyFile).toBeDefined(); expect(data.PublicKeyFile).toBeDefined();
expect(data.SignatureFile).toBeDefined(); expect(data.SignatureFile).toBeDefined();

View File

@@ -44,9 +44,7 @@ if (ipcRenderer) {
} }
store.dispatch(setProviderState(provider, state)); store.dispatch(setProviderState(provider, state));
} }
store.dispatch( store.dispatch(setActiveRelease(result.data.Release, result.data.Version));
setActiveRelease(result.data.Release, result.data.Version)
);
} else { } else {
store = createAppStore(platformInfo, packageJson.version, {}); store = createAppStore(platformInfo, packageJson.version, {});
} }

View File

@@ -21,14 +21,7 @@ export const setDownloadBegin = (name, type, url) => {
export const setDownloadEnd = createAction('download/setDownloadEnd'); export const setDownloadEnd = createAction('download/setDownloadEnd');
export const setDownloadProgress = createAction('download/setDownloadProgress'); export const setDownloadProgress = createAction('download/setDownloadProgress');
export const downloadItem = ( export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatform) => {
name,
type,
urls,
isWinFSP,
testVersion,
appPlatform
) => {
return (dispatch, getState) => { return (dispatch, getState) => {
if (!Array.isArray(urls)) { if (!Array.isArray(urls)) {
urls = [urls]; urls = [urls];
@@ -38,35 +31,20 @@ export const downloadItem = (
if (result.Success) { if (result.Success) {
switch (type) { switch (type) {
case Constants.INSTALL_TYPES.Dependency: case Constants.INSTALL_TYPES.Dependency:
dispatch( dispatch(installDependency(result.Destination, result.URL, isWinFSP));
installDependency(result.Destination, result.URL, isWinFSP)
);
break; break;
case Constants.INSTALL_TYPES.Release: case Constants.INSTALL_TYPES.Release:
dispatch(installRelease(result.Destination)); dispatch(installRelease(result.Destination));
break; break;
case Constants.INSTALL_TYPES.TestRelease: case Constants.INSTALL_TYPES.TestRelease:
dispatch( dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform));
installAndTestRelease(
result.Destination,
testVersion,
appPlatform
)
);
break; break;
case Constants.INSTALL_TYPES.Upgrade: case Constants.INSTALL_TYPES.Upgrade:
// const info = // const info =
// this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]]; // this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]];
//const sha256 = null; // info.sha256; //const sha256 = null; // info.sha256;
//const signature = null; // info.sig; //const signature = null; // info.sig;
dispatch( dispatch(installUpgrade(result.Destination, null, null, !!result.SkipVerification));
installUpgrade(
result.Destination,
null,
null,
!!result.SkipVerification
)
);
break; break;
default: default:
dispatch(notifyError('Unknown download type: ' + type)); dispatch(notifyError('Unknown download type: ' + type));
@@ -83,10 +61,7 @@ export const downloadItem = (
const downloadAtIndex = (index) => { const downloadAtIndex = (index) => {
const url = urls[index]; const url = urls[index];
const state = getState(); const state = getState();
if ( if (index > 0 || (!state.download.DownloadActive && state.download.AllowDownload)) {
index > 0 ||
(!state.download.DownloadActive && state.download.AllowDownload)
) {
const ipcRenderer = getIPCRenderer(); const ipcRenderer = getIPCRenderer();
if (ipcRenderer) { if (ipcRenderer) {
dispatch(setDownloadBegin(name, type, url)); dispatch(setDownloadBegin(name, type, url));
@@ -96,10 +71,7 @@ export const downloadItem = (
}; };
const downloadFileComplete = (_, arg) => { const downloadFileComplete = (_, arg) => {
ipcRenderer.removeListener( ipcRenderer.removeListener(Constants.IPC_Download_File_Progress, downloadFileProgress);
Constants.IPC_Download_File_Progress,
downloadFileProgress
);
if (!arg.data.Success && ++index < urls.length) { if (!arg.data.Success && ++index < urls.length) {
downloadAtIndex(index); downloadAtIndex(index);
} else { } else {
@@ -108,14 +80,8 @@ export const downloadItem = (
} }
}; };
ipcRenderer.on( ipcRenderer.on(Constants.IPC_Download_File_Progress, downloadFileProgress);
Constants.IPC_Download_File_Progress, ipcRenderer.once(Constants.IPC_Download_File_Complete, downloadFileComplete);
downloadFileProgress
);
ipcRenderer.once(
Constants.IPC_Download_File_Complete,
downloadFileComplete
);
ipcRenderer.send(Constants.IPC_Download_File, { ipcRenderer.send(Constants.IPC_Download_File, {
Filename: name, Filename: name,

View File

@@ -1,24 +1,24 @@
let addEditHostResolvers = []; let addEditHostResolvers = [];
export const addEditHost = (display, host_data, cb) => { export const addEditHost = (display, host_list, host_data, cb) => {
return (dispatch) => { return (dispatch) => {
if (cb) { if (cb) {
dispatch(addEditHost(display, host_data)).then(({ changed, host_data }) => dispatch(addEditHost(display, host_list, host_data)).then(({ changed, host_data }) =>
cb(changed, host_data) cb(changed, host_data)
); );
} else { } else {
return new Promise((resolve) => { return new Promise((resolve) => {
dispatch(handleDisplayAddEditHost(display, host_data, resolve)); dispatch(handleDisplayAddEditHost(display, host_list, host_data, resolve));
}); });
} }
}; };
}; };
const handleDisplayAddEditHost = (display, host_data, resolve) => { const handleDisplayAddEditHost = (display, host_list, host_data, resolve) => {
return (dispatch) => { return (dispatch) => {
if (display) { if (display) {
addEditHostResolvers.push(resolve); addEditHostResolvers.push(resolve);
dispatch(displayAddEditHost(display, host_data)); dispatch(displayAddEditHost(display, host_list, host_data));
} else { } else {
dispatch(completeAddEditHost(false)); dispatch(completeAddEditHost(false));
} }
@@ -36,6 +36,6 @@ export const completeAddEditHost = (changed, host_data) => {
}; };
export const DISPLAY_ADD_EDIT_HOST = 'host/displayAddEditHost'; export const DISPLAY_ADD_EDIT_HOST = 'host/displayAddEditHost';
export const displayAddEditHost = (display, host_data) => { export const displayAddEditHost = (display, host_list, host_data) => {
return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data } }; return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data, host_list } };
}; };

View File

@@ -31,8 +31,7 @@ export const checkInstalled = (dependencies, version) => {
const checkInstalledComplete = (_, arg) => { const checkInstalledComplete = (_, arg) => {
const result = arg.data; const result = arg.data;
const updateState = () => { const updateState = () => {
const installedVersion = const installedVersion = result.Success && result.Exists ? result.Version : 'none';
result.Success && result.Exists ? result.Version : 'none';
const state = getState(); const state = getState();
const release = state.relver.Release; const release = state.relver.Release;
@@ -41,8 +40,7 @@ export const checkInstalled = (dependencies, version) => {
let upgradeAvailable = false; let upgradeAvailable = false;
if (installedVersion !== 'none') { if (installedVersion !== 'none') {
const latestVersion = const latestVersion =
state.relver.VersionLookup[Constants.RELEASE_TYPES[release]] state.relver.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
.length - 1;
if (version === -1) { if (version === -1) {
version = latestVersion; version = latestVersion;
dispatch(setActiveRelease(release, version)); dispatch(setActiveRelease(release, version));
@@ -63,14 +61,12 @@ export const checkInstalled = (dependencies, version) => {
dispatch(showWindow()); dispatch(showWindow());
} else if (installedVersion === 'none' && autoInstallRelease) { } else if (installedVersion === 'none' && autoInstallRelease) {
dispatch(setAllowMount(false)); dispatch(setAllowMount(false));
const versionString = getState().relver.VersionLookup[ const versionString = getState().relver.VersionLookup[Constants.RELEASE_TYPES[release]][
Constants.RELEASE_TYPES[release] version
][version]; ];
const urls = getState().relver.LocationsLookup[versionString].urls; const urls = getState().relver.LocationsLookup[versionString].urls;
const fileName = versionString + '.zip'; const fileName = versionString + '.zip';
dispatch( dispatch(downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls));
downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls)
);
} }
}; };
@@ -81,10 +77,7 @@ export const checkInstalled = (dependencies, version) => {
} }
}; };
ipcRenderer.once( ipcRenderer.once(Constants.IPC_Check_Installed_Reply, checkInstalledComplete);
Constants.IPC_Check_Installed_Reply,
checkInstalledComplete
);
ipcRenderer.send(Constants.IPC_Check_Installed, { ipcRenderer.send(Constants.IPC_Check_Installed, {
Dependencies: dependencies, Dependencies: dependencies,
Version: version, Version: version,
@@ -104,8 +97,7 @@ export const checkVersionInstalled = () => {
state.relver.LocationsLookup[selectedVersion] && state.relver.LocationsLookup[selectedVersion] &&
state.relver.LocationsLookup[selectedVersion].dependencies state.relver.LocationsLookup[selectedVersion].dependencies
) { ) {
dependencies = dependencies = state.relver.LocationsLookup[selectedVersion].dependencies;
state.relver.LocationsLookup[selectedVersion].dependencies;
} }
dispatch(checkInstalled(dependencies, selectedVersion)); dispatch(checkInstalled(dependencies, selectedVersion));
} else { } else {
@@ -139,12 +131,9 @@ export const installDependency = (source, url, isWinFSP) => {
return d.download === url; return d.download === url;
}); });
const i = setInterval(() => { const i = setInterval(() => {
const ret = ipcRenderer.sendSync( const ret = ipcRenderer.sendSync(Constants.IPC_Check_Dependency_Installed + '_sync', {
Constants.IPC_Check_Dependency_Installed + '_sync', File: dep.file,
{ });
File: dep.file,
}
);
if (ret.data.Exists) { if (ret.data.Exists) {
clearInterval(i); clearInterval(i);
@@ -158,10 +147,7 @@ export const installDependency = (source, url, isWinFSP) => {
} }
}; };
ipcRenderer.once( ipcRenderer.once(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
Constants.IPC_Install_Dependency_Reply,
installDependencyComplete
);
ipcRenderer.send(Constants.IPC_Install_Dependency, { ipcRenderer.send(Constants.IPC_Install_Dependency, {
Source: source, Source: source,
URL: url, URL: url,
@@ -199,10 +185,7 @@ export const installAndTestRelease = (source, version, appPlatform) => {
}); });
}; };
ipcRenderer.once( ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
Constants.IPC_Extract_Release_Complete,
extractReleaseComplete
);
ipcRenderer.send(Constants.IPC_Extract_Release, { ipcRenderer.send(Constants.IPC_Extract_Release, {
Source: source, Source: source,
Version: version, Version: version,
@@ -214,10 +197,7 @@ export const installAndTestRelease = (source, version, appPlatform) => {
export const installReleaseByVersion = (release, version) => { export const installReleaseByVersion = (release, version) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const install = () => { const install = () => {
if ( if (getState().download.AllowDownload && !getState().download.DownloadActive) {
getState().download.AllowDownload &&
!getState().download.DownloadActive
) {
dispatch(setAutoInstallRelease(true)); dispatch(setAutoInstallRelease(true));
dispatch(setActiveRelease(release, version)); dispatch(setActiveRelease(release, version));
} else { } else {
@@ -251,10 +231,7 @@ export const installRelease = (source) => {
}); });
if (arg.data.Success) { if (arg.data.Success) {
localStorage.setItem( localStorage.setItem('previous_releases', localStorage.getItem('releases'));
'previous_releases',
localStorage.getItem('releases')
);
dispatch(setNewReleasesAvailable2([])); dispatch(setNewReleasesAvailable2([]));
} }
@@ -262,10 +239,7 @@ export const installRelease = (source) => {
dispatch(checkVersionInstalled()); dispatch(checkVersionInstalled());
}; };
ipcRenderer.once( ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
Constants.IPC_Extract_Release_Complete,
extractReleaseComplete
);
ipcRenderer.send(Constants.IPC_Extract_Release, { ipcRenderer.send(Constants.IPC_Extract_Release, {
Source: source, Source: source,
Version: version, Version: version,
@@ -303,10 +277,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => {
} }
}; };
ipcRenderer.once( ipcRenderer.once(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);
Constants.IPC_Install_Upgrade_Reply,
installUpgradeComplete
);
ipcRenderer.send(Constants.IPC_Install_Upgrade, { ipcRenderer.send(Constants.IPC_Install_Upgrade, {
Sha256: sha256, Sha256: sha256,
Signature: signature, Signature: signature,
@@ -317,17 +288,9 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => {
}; };
}; };
export const setAutoInstallRelease = createAction( export const setAutoInstallRelease = createAction('install/setAutoInstallRelease');
'install/setAutoInstallRelease' export const setDismissDependencies = createAction('install/setDismissDependencies');
);
export const setDismissDependencies = createAction(
'install/setDismissDependencies'
);
export const setInstallActive = createAction('install/setInstallActive'); export const setInstallActive = createAction('install/setInstallActive');
export const setInstallTestActive = createAction( export const setInstallTestActive = createAction('install/setInstallTestActive');
'install/setInstallTestActive'
);
export const setInstallComplete = createAction('install/setInstallComplete'); export const setInstallComplete = createAction('install/setInstallComplete');
export const setMissingDependencies = createAction( export const setMissingDependencies = createAction('install/setMissingDependencies');
'install/setMissingDependencies'
);

View File

@@ -23,9 +23,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
Version: getState().relver.InstalledVersion, Version: getState().relver.InstalledVersion,
}); });
} else { } else {
dispatch( dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error));
notifyError('Failed to create S3 instance: ' + arg.data.Error)
);
dispatch(setBusy(false)); dispatch(setBusy(false));
} }
}); });
@@ -44,14 +42,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
}; };
}; };
export const addS3Mount = ( export const addS3Mount = (name, accessKey, secretKey, region, bucketName, url) => {
name,
accessKey,
secretKey,
region,
bucketName,
url
) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const ipcRenderer = getIPCRenderer(); const ipcRenderer = getIPCRenderer();
const provider = 'S3' + name; const provider = 'S3' + name;
@@ -67,9 +58,7 @@ export const addS3Mount = (
Version: getState().relver.InstalledVersion, Version: getState().relver.InstalledVersion,
}); });
} else { } else {
dispatch( dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error));
notifyError('Failed to create S3 instance: ' + arg.data.Error)
);
dispatch(setBusy(false)); dispatch(setBusy(false));
} }
}); });
@@ -107,13 +96,13 @@ export const displayConfiguration = (provider, remote, s3) => {
export const removeMount = (provider) => { export const removeMount = (provider) => {
return (dispatch) => { return (dispatch) => {
const isRemote = provider.startsWith('Remote'); const isRemote = provider.startsWith('Remote');
dispatch( dispatch(confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?')).then(
confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?') (confirmed) => {
).then((confirmed) => { if (confirmed) {
if (confirmed) { dispatch(removeMount2(provider));
dispatch(removeMount2(provider)); }
} }
}); );
}; };
}; };

View File

@@ -9,17 +9,9 @@ import {
getSelectedVersionFromState, getSelectedVersionFromState,
} from '../../utils.jsx'; } from '../../utils.jsx';
import { import { saveState, setAllowMount, setApplicationReady, showWindow } from './common_actions';
saveState,
setAllowMount,
setApplicationReady,
showWindow,
} from './common_actions';
import { notifyError } from './error_actions'; import { notifyError } from './error_actions';
import { import { checkVersionInstalled, setDismissDependencies } from './install_actions';
checkVersionInstalled,
setDismissDependencies,
} from './install_actions';
import { unmountAll } from './mount_actions'; import { unmountAll } from './mount_actions';
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade'; export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
@@ -85,19 +77,12 @@ export const loadReleases = () => {
release = Constants.DEFAULT_RELEASE; release = Constants.DEFAULT_RELEASE;
} }
let latestVersion = let latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
let version = state.Version; let version = state.Version;
if ( if (versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable') {
versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable'
) {
release = Constants.DEFAULT_RELEASE; release = Constants.DEFAULT_RELEASE;
version = latestVersion = version = latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
versionLookup[Constants.RELEASE_TYPES[release]].length - 1; } else if (version === -1 || !versionLookup[Constants.RELEASE_TYPES[release]][version]) {
} else if (
version === -1 ||
!versionLookup[Constants.RELEASE_TYPES[release]][version]
) {
version = latestVersion; version = latestVersion;
} }
@@ -109,9 +94,7 @@ export const loadReleases = () => {
dispatch(detectUIUpgrade()); dispatch(detectUIUpgrade());
if (processAllowDismiss) { if (processAllowDismiss) {
dispatch( dispatch(
setAllowDismissDependencies( setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1)
versionLookup[Constants.RELEASE_TYPES[release]].length > 1
)
); );
} }
dispatch(checkVersionInstalled()); dispatch(checkVersionInstalled());
@@ -176,9 +159,7 @@ export const loadReleases = () => {
localStorage.setItem('previous_releases', storedReleases); localStorage.setItem('previous_releases', storedReleases);
dispatch(showWindow()); dispatch(showWindow());
} else if ( } else if (
(newReleases = checkNewReleases( (newReleases = checkNewReleases(getSelectedVersionFromState(getState()))).length > 0
getSelectedVersionFromState(getState())
)).length > 0
) { ) {
dispatch(setNewReleasesAvailable2(newReleases)); dispatch(setNewReleasesAvailable2(newReleases));
} }
@@ -225,20 +206,12 @@ export const setActiveRelease = (release, version) => {
}; };
}; };
export const setAllowDismissDependencies = createAction( export const setAllowDismissDependencies = createAction('relver/setAllowDismissDependencies');
'relver/setAllowDismissDependencies' export const setDismissNewReleasesAvailable = createAction('relver/setDismissNewReleasesAvailable');
);
export const setDismissNewReleasesAvailable = createAction(
'relver/setDismissNewReleasesAvailable'
);
export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade'); export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade');
export const setInstalledVersion = createAction('relver/setInstalledVersion'); export const setInstalledVersion = createAction('relver/setInstalledVersion');
export const setNewReleasesAvailable = createAction( export const setNewReleasesAvailable = createAction('relver/setNewReleasesAvailable');
'relver/setNewReleasesAvailable' export const setNewReleasesAvailable2 = createAction('relver/setNewReleasesAvailable2');
);
export const setNewReleasesAvailable2 = createAction(
'relver/setNewReleasesAvailable2'
);
export const SET_RELEASE_DATA = 'relver/setReleaseData'; export const SET_RELEASE_DATA = 'relver/setReleaseData';
export const setReleaseData = (locationsLookup, versionLookup) => { export const setReleaseData = (locationsLookup, versionLookup) => {
@@ -251,9 +224,7 @@ export const setReleaseData = (locationsLookup, versionLookup) => {
}; };
}; };
export const setReleaseUpgradeAvailable = createAction( export const setReleaseUpgradeAvailable = createAction('relver/setReleaseUpgradeAvailable');
'relver/setReleaseUpgradeAvailable'
);
export const SET_UI_UPGRADE_DATA = 'relver/setUIUpgradeData'; export const SET_UI_UPGRADE_DATA = 'relver/setUIUpgradeData';
export const setUIUpgradeData = (upgradeData, version) => { export const setUIUpgradeData = (upgradeData, version) => {

View File

@@ -1,10 +1,5 @@
import { createReducer } from '@reduxjs/toolkit'; import { createReducer } from '@reduxjs/toolkit';
import { import { CLEAR_ERROR, CLEAR_INFO, SET_ERROR_INFO, SET_INFO } from '../actions/error_actions';
CLEAR_ERROR,
CLEAR_INFO,
SET_ERROR_INFO,
SET_INFO,
} from '../actions/error_actions';
export const errorReducer = createReducer( export const errorReducer = createReducer(
{ {
@@ -16,8 +11,7 @@ export const errorReducer = createReducer(
}, },
{ {
[CLEAR_ERROR]: (state) => { [CLEAR_ERROR]: (state) => {
const errorStack = const errorStack = state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : [];
state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : [];
return { return {
...state, ...state,
DisplayError: errorStack.length > 0, DisplayError: errorStack.length > 0,
@@ -25,8 +19,7 @@ export const errorReducer = createReducer(
}; };
}, },
[CLEAR_INFO]: (state) => { [CLEAR_INFO]: (state) => {
const infoStack = const infoStack = state.InfoStack.length > 0 ? state.InfoStack.slice(1) : [];
state.InfoStack.length > 0 ? state.InfoStack.slice(1) : [];
return { return {
...state, ...state,
DisplayInfo: infoStack.length > 0, DisplayInfo: infoStack.length > 0,

View File

@@ -140,9 +140,7 @@ export const createMountReducer = (state) => {
let autoMountProcessed = { ...state.AutoMountProcessed }; let autoMountProcessed = { ...state.AutoMountProcessed };
delete autoMountProcessed[action.payload]; delete autoMountProcessed[action.payload];
const remoteMounts = state.RemoteMounts.filter( const remoteMounts = state.RemoteMounts.filter((i) => i !== action.payload);
(i) => i !== action.payload
);
const s3Mounts = state.S3Mounts.filter((i) => i !== action.payload); const s3Mounts = state.S3Mounts.filter((i) => i !== action.payload);
return { return {
...state, ...state,

View File

@@ -11,12 +11,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
Config: data.Data, Config: data.Data,
}); });
} else { } else {
standardIPCReply( standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, data.Code);
event,
Constants.IPC_Get_Config_Reply,
{},
data.Code
);
} }
}) })
.catch((error) => { .catch((error) => {
@@ -33,12 +28,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
}); });
}) })
.catch((error) => { .catch((error) => {
standardIPCReply( standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {}, error);
event,
Constants.IPC_Get_Config_Template_Reply,
{},
error
);
}); });
}); });
@@ -58,12 +48,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
setConfigValue(++i); setConfigValue(++i);
}) })
.catch((error) => { .catch((error) => {
standardIPCReply( standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}, error);
event,
Constants.IPC_Set_Config_Values_Reply,
{},
error
);
}); });
} else { } else {
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}); standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {});

View File

@@ -20,23 +20,20 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
} }
}); });
ipcMain.on( ipcMain.on(Constants.IPC_Check_Dependency_Installed + '_sync', (event, data) => {
Constants.IPC_Check_Dependency_Installed + '_sync', try {
(event, data) => { const ls = fs.lstatSync(data.File);
try { event.returnValue = {
const ls = fs.lstatSync(data.File); data: {
event.returnValue = { Exists: ls.isFile() || ls.isSymbolicLink(),
data: { },
Exists: ls.isFile() || ls.isSymbolicLink(), };
}, } catch (e) {
}; event.returnValue = {
} catch (e) { data: { Exists: false },
event.returnValue = { };
data: { Exists: false },
};
}
} }
); });
ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => { ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
if (data.Source.toLowerCase().endsWith('.dmg')) { if (data.Source.toLowerCase().endsWith('.dmg')) {

View File

@@ -17,14 +17,7 @@ const clearManualMountDetection = (provider) => {
} }
}; };
const monitorMount = ( const monitorMount = (sender, provider, providerList, version, pid, location) => {
sender,
provider,
providerList,
version,
pid,
location
) => {
manualMountDetection[provider] = setInterval(() => { manualMountDetection[provider] = setInterval(() => {
helpers helpers
.detectRepertoryMounts(version, providerList) .detectRepertoryMounts(version, providerList)
@@ -62,12 +55,7 @@ const unmountAllDrives = () => {
// Unmount all items // Unmount all items
for (const mountLocation of mountedLocations) { for (const mountLocation of mountedLocations) {
const data = mountedData[mountLocation]; const data = mountedData[mountLocation];
helpers.stopMountProcessSync( helpers.stopMountProcessSync(data.Version, data.Provider, data.Remote, data.S3);
data.Version,
data.Provider,
data.Remote,
data.S3
);
} }
mountedLocations = []; mountedLocations = [];
@@ -79,10 +67,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
let response = { Success: true, Error: '' }; let response = { Success: true, Error: '' };
try { try {
if ( if (fs.existsSync(data.Location) && fs.statSync(data.Location).isDirectory()) {
fs.existsSync(data.Location) &&
fs.statSync(data.Location).isDirectory()
) {
if (fs.readdirSync(data.Location).length !== 0) { if (fs.readdirSync(data.Location).length !== 0) {
response.Success = false; response.Success = false;
response.Error = 'Directory not empty: ' + data.Location; response.Error = 'Directory not empty: ' + data.Location;
@@ -102,11 +87,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
const provider = data.Provider; const provider = data.Provider;
let driveLetters = {}; let driveLetters = {};
const providerList = [ const providerList = [...Constants.PROVIDER_LIST, ...data.RemoteMounts, ...data.S3Mounts];
...Constants.PROVIDER_LIST,
...data.RemoteMounts,
...data.S3Mounts,
];
for (const provider of providerList) { for (const provider of providerList) {
driveLetters[provider] = []; driveLetters[provider] = [];
} }
@@ -283,12 +264,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
data.Name = data.Name.replace(':', '_'); data.Name = data.Name.replace(':', '_');
} }
const dataDirectory = path.resolve( const dataDirectory = path.resolve(
path.join( path.join(helpers.getDataDirectory(), '..', data.Remote ? 'remote' : 's3', data.Name)
helpers.getDataDirectory(),
'..',
data.Remote ? 'remote' : 's3',
data.Name
)
); );
try { try {

View File

@@ -4,13 +4,7 @@ const helpers = require('../../helpers');
const addListeners = (ipcMain, { standardIPCReply }) => { const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Directory_Items, (event, data) => { ipcMain.on(Constants.IPC_Get_Directory_Items, (event, data) => {
helpers helpers
.grabDirectoryItems( .grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((data) => { .then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, { standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items, Items: data.items,
@@ -23,13 +17,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => { ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => {
helpers helpers
.grabDirectoryItems( .grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((data) => { .then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, { standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items, Items: data.items,
@@ -44,14 +32,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => { ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => {
helpers helpers
.setPinned( .setPinned(data.Path, data.Pinned, data.Version, data.Provider, data.Remote, data.S3)
data.Path,
data.Pinned,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((success) => { .then((success) => {
event.returnValue = success; event.returnValue = success;
}) })

View File

@@ -36,26 +36,21 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
.then((data) => { .then((data) => {
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
if (appPlatform === 'unknown') { if (appPlatform === 'unknown') {
helpers.downloadFile( helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
Constants.LINUX_DETECT_SCRIPT_URL, if (err) {
scriptFile, sendResponse(appPlatform, platform);
null, } else {
(err) => { helpers
if (err) { .executeScript(scriptFile)
sendResponse(appPlatform, platform); .then((data) => {
} else { appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
helpers sendResponse(appPlatform, platform);
.executeScript(scriptFile) })
.then((data) => { .catch(() => {
appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); sendResponse(appPlatform, platform);
sendResponse(appPlatform, platform); });
})
.catch(() => {
sendResponse(appPlatform, platform);
});
}
} }
); });
} else { } else {
sendResponse(appPlatform, platform); sendResponse(appPlatform, platform);
} }

View File

@@ -13,9 +13,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => {
.then((dependencies) => { .then((dependencies) => {
let exists = false; let exists = false;
try { try {
exists = exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
fs.existsSync(destination) &&
fs.lstatSync(destination).isDirectory();
} catch (e) {} } catch (e) {}
standardIPCReply(event, Constants.IPC_Check_Installed_Reply, { standardIPCReply(event, Constants.IPC_Check_Installed_Reply, {
Dependencies: dependencies, Dependencies: dependencies,
@@ -70,9 +68,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => {
stream.close(); stream.close();
if (os.platform() !== 'win32') { if (os.platform() !== 'win32') {
helpers helpers
.executeAndWait( .executeAndWait('chmod +x "' + path.join(destination, 'repertory') + '"')
'chmod +x "' + path.join(destination, 'repertory') + '"'
)
.then(() => { .then(() => {
standardIPCReply(event, Constants.IPC_Extract_Release_Complete, { standardIPCReply(event, Constants.IPC_Extract_Release_Complete, {
Source: data.Source, Source: data.Source,

View File

@@ -24,12 +24,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
}); });
}) })
.catch((error) => { .catch((error) => {
standardIPCReply( standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error);
event,
Constants.IPC_Grab_Skynet_Tree_Reply,
{},
error
);
}); });
}); });

View File

@@ -40,9 +40,7 @@ const addListeners = (ipcMain) => {
data.RemoteMounts = data.RemoteMounts || []; data.RemoteMounts = data.RemoteMounts || [];
data.S3Mounts = data.S3Mounts || []; data.S3Mounts = data.S3Mounts || [];
const remoteItems = getDirectories( const remoteItems = getDirectories(path.join(helpers.getRepertoryDirectory(), 'remote'));
path.join(helpers.getRepertoryDirectory(), 'remote')
);
for (const dir of remoteItems) { for (const dir of remoteItems) {
const name = 'Remote' + dir.replace('_', ':'); const name = 'Remote' + dir.replace('_', ':');
if (!data.RemoteMounts || data.RemoteMounts.indexOf(name) === -1) { if (!data.RemoteMounts || data.RemoteMounts.indexOf(name) === -1) {
@@ -55,9 +53,7 @@ const addListeners = (ipcMain) => {
} }
} }
const s3Items = getDirectories( const s3Items = getDirectories(path.join(helpers.getRepertoryDirectory(), 's3'));
path.join(helpers.getRepertoryDirectory(), 's3')
);
for (const dir of s3Items) { for (const dir of s3Items) {
const name = 'S3' + dir; const name = 'S3' + dir;
if (!data.S3Mounts || data.S3Mounts.indexOf(name) === -1) { if (!data.S3Mounts || data.S3Mounts.indexOf(name) === -1) {

View File

@@ -3,10 +3,7 @@ const fs = require('fs');
const helpers = require('../../helpers'); const helpers = require('../../helpers');
const os = require('os'); const os = require('os');
const addListeners = ( const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCReply }) => {
ipcMain,
{ setIsInstalling, unmountAllDrives, standardIPCReply }
) => {
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => { ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
let allowSkipVerification = true; let allowSkipVerification = true;
@@ -46,10 +43,7 @@ const addListeners = (
//! (data.Sha256.length > 0); //! (data.Sha256.length > 0);
if (hasSignature) { if (hasSignature) {
try { try {
const files = helpers.createSignatureFiles( const files = helpers.createSignatureFiles(data.Signature, Constants.DEV_PUBLIC_KEY);
data.Signature,
Constants.DEV_PUBLIC_KEY
);
tempPub = files.PublicKeyFile; tempPub = files.PublicKeyFile;
tempSig = files.SignatureFile; tempSig = files.SignatureFile;
} catch (e) { } catch (e) {
@@ -99,9 +93,7 @@ const addListeners = (
executeInstall(); executeInstall();
}) })
.catch(() => { .catch(() => {
errorHandler( errorHandler(Error('Failed to verify installation package signature'));
Error('Failed to verify installation package signature')
);
}); });
} else if (hasHash) { } else if (hasHash) {
helpers helpers

View File

@@ -15,9 +15,7 @@ const isLocalhost = Boolean(
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' || window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
); );
export function register(config) { export function register(config) {
@@ -120,9 +118,7 @@ function checkValidServiceWorker(swUrl, config) {
} }
}) })
.catch(() => { .catch(() => {
console.log( console.log('No internet connection found. App is running in offline mode.');
'No internet connection found. App is running in offline mode.'
);
}); });
} }

View File

@@ -100,9 +100,7 @@ export const getChangesForRepertoryVersion = (version) => {
return ( return (
!ended && !ended &&
l.length > 0 && l.length > 0 &&
(found (found ? !(ended = l.startsWith('## ')) : (found = l.startsWith(`## ${version}`)))
? !(ended = l.startsWith('## '))
: (found = l.startsWith(`## ${version}`)))
); );
}); });
resolve(lines); resolve(lines);
@@ -120,11 +118,7 @@ export const getIPCRenderer = () => {
return ipcRenderer; return ipcRenderer;
}; };
export const getNewReleases = ( export const getNewReleases = (existingLocations, newLocations, selectedVersion) => {
existingLocations,
newLocations,
selectedVersion
) => {
const ret = []; const ret = [];
if (existingLocations && newLocations) { if (existingLocations && newLocations) {
Constants.RELEASE_TYPES.forEach((release) => { Constants.RELEASE_TYPES.forEach((release) => {