Reduced Linux binaries
This commit is contained in:
14
.vim/coc-settings.json
Normal file
14
.vim/coc-settings.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"HKEY",
|
||||
"HKLM",
|
||||
"Redistributable",
|
||||
"Skylinks",
|
||||
"Skynet",
|
||||
"Unmount",
|
||||
"msiexec",
|
||||
"relver",
|
||||
"siaprime",
|
||||
"skylink"
|
||||
]
|
||||
}
|
||||
5
.vimrc
5
.vimrc
@@ -1,2 +1,7 @@
|
||||
set autoread
|
||||
set path+=.,public/**,src/**,test/**
|
||||
if has('win32')
|
||||
let &makeprg="create_dist.cmd"
|
||||
else
|
||||
let &makeprg="./create_dist.sh"
|
||||
endif
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* \#48: Support pinning files to cache
|
||||
* Fixed Skynet export display
|
||||
* Properly detect existing remote
|
||||
* Reduced number of Linux binaries to:
|
||||
* CentOS 7
|
||||
* Solus
|
||||
* S3 mount support [disabled]
|
||||
|
||||
## 1.3.1
|
||||
* \#45: Skynet mount support
|
||||
@@ -17,8 +21,6 @@
|
||||
* CentOS 7
|
||||
* Debian 9
|
||||
* Debian 10
|
||||
* Debian 9 ARM64
|
||||
* Debian 10 ARM64
|
||||
* Solus
|
||||
* Added `FocusTrap` to modals
|
||||
|
||||
|
||||
30
README.md
30
README.md
@@ -24,32 +24,16 @@ Repertory allows you to mount Sia, Skynet and/or ScPrime blockchain storage solu
|
||||
* Antergos
|
||||
* Arch Linux
|
||||
* Bodhi 5.0.0
|
||||
* CentOS 7
|
||||
* CentOS 8
|
||||
* Debian 9
|
||||
* Debian 10
|
||||
* Elementary OS 5.0
|
||||
* Elementary OS 5.1
|
||||
* Fedora 28
|
||||
* Fedora 29
|
||||
* Fedora 30
|
||||
* Fedora 31
|
||||
* Fedora 32
|
||||
* Fedora 33
|
||||
* Linux Mint 19
|
||||
* Linux Mint 19.1
|
||||
* Linux Mint 19.2
|
||||
* Linux Mint 19.3
|
||||
* CentOS 7, 8
|
||||
* Debian 9, 10
|
||||
* Elementary OS 5.0, 5.1
|
||||
* Fedora 28, 29, 30, 31, 32, 33
|
||||
* Linux Mint 19, 19.1, 19.2, 19.3, 20, 20.1
|
||||
* Manjaro
|
||||
* OpenSUSE Leap 15.0
|
||||
* OpenSUSE Leap 15.1
|
||||
* OpenSUSE Leap 15.0, 15.1
|
||||
* OpenSUSE Tumbleweed
|
||||
* Solus
|
||||
* Ubuntu 18.04
|
||||
* Ubuntu 18.10
|
||||
* Ubuntu 19.04
|
||||
* Ubuntu 19.10
|
||||
* Ubuntu 20.04
|
||||
* Ubuntu 18.04, 18.10, 19.04, 19.10, 20.04
|
||||
|
||||
## Issues/Suggestions
|
||||
Please submit [here](https://bitbucket.org/blockstorage/repertory-ui/issues?status=new&status=open)
|
||||
|
||||
97
public/detect_linux.sh
Normal file → Executable file
97
public/detect_linux.sh
Normal file → Executable file
@@ -8,104 +8,23 @@ resetDistVer() {
|
||||
DISTVER=
|
||||
}
|
||||
|
||||
if [ -f /etc/centos-release ]; then
|
||||
. /etc/os-release
|
||||
if [ "$VERSION_ID" = "7" ]; then
|
||||
DISTNAME=centos
|
||||
DISTVER=7
|
||||
elif [ "$VERSION_ID" = "8" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=10
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
. /etc/os-release
|
||||
if [ "$VERSION_ID" != "33" ] && "$VERSION_ID" != "32" ] && [ "$VERSION_ID" != "31" ] && [ "$VERSION_ID" != "30" ] && [ "$VERSION_ID" != "29" ] && [ "$VERSION_ID" != "28" ]; then
|
||||
resetDistVer
|
||||
else
|
||||
DISTNAME=debian
|
||||
if [ "$VERSION_ID" = "28" ]; then
|
||||
DISTVER=9
|
||||
else
|
||||
DISTVER=10
|
||||
fi
|
||||
fi
|
||||
elif [ -f /etc/solus-release ]; then
|
||||
DISTNAME=solus
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
. /etc/lsb-release
|
||||
DISTNAME=$(echo ${DISTRIB_ID} | awk '{print tolower($0)}')
|
||||
DISTVER=${DISTRIB_RELEASE}
|
||||
if [ "$DISTNAME" != "ubuntu" ]; then
|
||||
if [ "$DISTNAME" = "linuxmint" ]; then
|
||||
if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ] || [ "$DISTVER" = "19.2" ] || [ "$DISTVER" = "19.3" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
elif [ "$DISTNAME" = "elementary" ]; then
|
||||
if [ "$DISTVER" = "5.0" ] || [ "$DISTVER" = "5.1" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
elif [ "$DISTVER" != "18.04" ] && [ "$DISTVER" != "18.10" ] && [ "$DISTVER" != "19.04" ] && [ "$DISTVER" != "19.10" ] && [ "$DISTVER" != "20.04" ] && [ "$DISTVER" != "20.10" ]; then
|
||||
resetDistVer
|
||||
else
|
||||
DISTNAME=debian
|
||||
if [ "$DISTVER" = "18.04" ]; then
|
||||
DISTVER=9
|
||||
else
|
||||
DISTVER=10
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
IS_ARM=`(uname -a | grep aarch64) 1>/dev/null 2>&1 && echo 1`
|
||||
|
||||
if [ "$DISTNAME" = "unknown" ] && [ -f /etc/debian_version ]; then
|
||||
if [ -f /etc/solus-release ]; then
|
||||
DISTNAME=solus
|
||||
elif [ "$IS_ARM" = "1" ] && [ -f /etc/debian_version ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}')
|
||||
if [ "$DISTVER" != "9" ] && [ "$DISTVER" != "10" ]; then
|
||||
resetDistVer
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DISTNAME" = "unknown" ]; then
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "arch" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=10
|
||||
elif [ "$ID" = "antergos" ] || [ "$ID" = "manjaro" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
elif [ "$ID" = "opensuse-leap" ]; then
|
||||
if [ "$VERSION_ID" = "15.0" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
elif [ "$VERSION_ID" = "15.1" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
elif [ "$VERSION_ID" = "15.2" ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=9
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
elif [ "$ID" = "opensuse-tumbleweed" ]; then
|
||||
DISTNAME=debian
|
||||
if [ $(grep sid /etc/debian_version) ]; then
|
||||
DISTVER=10
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
else
|
||||
resetDistVer
|
||||
fi
|
||||
else
|
||||
DISTNAME=centos7
|
||||
DISTVER=
|
||||
fi
|
||||
|
||||
echo ${DISTNAME}${DISTVER}
|
||||
|
||||
@@ -18,24 +18,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"debian9": {
|
||||
"1.3.2": {
|
||||
"sha256": "",
|
||||
"sig": "",
|
||||
"urls": [
|
||||
"https://bitbucket.org/blockstorage/repertory-ui/downloads/repertory-ui_1.3.2_linux_x86_64.AppImage"
|
||||
]
|
||||
}
|
||||
},
|
||||
"debian10": {
|
||||
"1.3.2": {
|
||||
"sha256": "",
|
||||
"sig": "",
|
||||
"urls": [
|
||||
"https://bitbucket.org/blockstorage/repertory-ui/downloads/repertory-ui_1.3.2_linux_x86_64.AppImage"
|
||||
]
|
||||
}
|
||||
},
|
||||
"solus": {
|
||||
"1.3.2": {
|
||||
"sha256": "",
|
||||
@@ -62,12 +44,6 @@
|
||||
"darwin": [
|
||||
"1.3.2"
|
||||
],
|
||||
"debian9": [
|
||||
"1.3.2"
|
||||
],
|
||||
"debian10": [
|
||||
"1.3.2"
|
||||
],
|
||||
"linux": [
|
||||
"unavailable"
|
||||
],
|
||||
|
||||
340
src/App.js
340
src/App.js
@@ -1,340 +0,0 @@
|
||||
import React from 'react';
|
||||
import './App.css';
|
||||
import Box from './components/UI/Box/Box';
|
||||
import Configuration from './containers/Configuration/Configuration';
|
||||
import {connect} from 'react-redux';
|
||||
import DependencyList from './components/DependencyList/DependencyList';
|
||||
import DownloadProgress from './components/DownloadProgress/DownloadProgress';
|
||||
import ErrorDetails from './components/ErrorDetails/ErrorDetails';
|
||||
import Grid from './components/UI/Grid/Grid';
|
||||
import InfoDetails from './components/InfoDetails/InfoDetails';
|
||||
import IPCContainer from './containers/IPCContainer/IPCContainer';
|
||||
import Loading from './components/UI/Loading/Loading';
|
||||
import MountItems from './containers/MountItems/MountItems';
|
||||
import NewReleases from './components/NewReleases/NewReleases';
|
||||
import {notifyError} from './redux/actions/error_actions';
|
||||
import Reboot from './components/Reboot/Reboot';
|
||||
import {
|
||||
setDismissNewReleasesAvailable,
|
||||
setNewReleasesAvailable
|
||||
} from './redux/actions/release_version_actions';
|
||||
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
|
||||
import {
|
||||
displaySelectAppPlatform,
|
||||
saveState
|
||||
} from './redux/actions/common_actions';
|
||||
import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform';
|
||||
import Text from './components/UI/Text/Text';
|
||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||
import {
|
||||
loadReleases,
|
||||
setDismissUIUpgrade
|
||||
} from './redux/actions/release_version_actions';
|
||||
import YesNo from './components/YesNo/YesNo';
|
||||
import {createModalConditionally} from './utils';
|
||||
import SkynetImport from './containers/SkynetImport/SkynetImport';
|
||||
import ApplicationBusy from './components/ApplicationBusy/ApplicationBusy';
|
||||
import SkynetExport from './containers/SkynetExport/SkynetExport';
|
||||
import PinnedManager from './containers/PinnedManager/PinnedManager';
|
||||
|
||||
const Constants = require('./constants');
|
||||
const Scheduler = require('node-schedule');
|
||||
|
||||
class App extends IPCContainer {
|
||||
componentDidMount() {
|
||||
const detectUpgrades = () => {
|
||||
if (this.props.AppPlatform === 'unknown') {
|
||||
if (this.props.Platform === 'linux') {
|
||||
this.props.displaySelectAppPlatform(true);
|
||||
} else {
|
||||
this.props.notifyError('Operating system is not supported.', true);
|
||||
}
|
||||
} else {
|
||||
this.props.loadReleases();
|
||||
}
|
||||
};
|
||||
detectUpgrades();
|
||||
this.scheduledUpdateJob = Scheduler.scheduleJob('23 11 * * *', detectUpgrades);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if ((prevProps.Release !== this.props.Release) ||
|
||||
(prevProps.ReleaseVersion !== this.props.ReleaseVersion) ||
|
||||
(prevProps.VersionLookup !== this.props.VersionLookup)) {
|
||||
this.props.saveState();
|
||||
} else if (Object.keys(this.props.ProviderState).filter(k => {
|
||||
return this.props.ProviderState[k] !== prevProps.ProviderState[k];
|
||||
}).length > 0) {
|
||||
this.props.saveState();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
Scheduler.cancelJob(this.scheduledUpdateJob);
|
||||
super.componentWillUnmount();
|
||||
}
|
||||
|
||||
getSelectedVersion = () => {
|
||||
return (this.props.ReleaseVersion === -1) ?
|
||||
'unavailable' :
|
||||
this.props.VersionLookup[Constants.RELEASE_TYPES[this.props.Release]][this.props.ReleaseVersion];
|
||||
};
|
||||
|
||||
handleUpgradeIconClicked = () => {
|
||||
if (this.props.UpgradeAvailable) {
|
||||
this.props.setDismissUIUpgrade(false)
|
||||
} else if (this.props.NewReleasesAvailable2.length > 0) {
|
||||
this.props.setNewReleasesAvailable(this.props.NewReleasesAvailable2);
|
||||
this.props.setDismissNewReleasesAvailable(false);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const selectedVersion = this.getSelectedVersion();
|
||||
|
||||
const downloadEnabled = this.props.AllowDownload &&
|
||||
!this.props.MountsBusy &&
|
||||
!this.props.DownloadActive &&
|
||||
(selectedVersion !== 'unavailable') &&
|
||||
(selectedVersion !== this.props.InstalledVersion);
|
||||
|
||||
const missingDependencies = (this.props.MissingDependencies.length > 0) &&
|
||||
this.props.AllowMount;
|
||||
|
||||
const allowMount = this.props.AllowMount &&
|
||||
this.props.InstalledVersion !== 'none' &&
|
||||
!missingDependencies &&
|
||||
!this.props.InstallActive;
|
||||
|
||||
const remoteSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].supports_remote;
|
||||
|
||||
const s3Supported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].s3_support;
|
||||
|
||||
const skynetSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].skynet_support;
|
||||
|
||||
const scPrimeSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].siaprime_support;
|
||||
|
||||
const siaSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].sia_support;
|
||||
|
||||
const showConfig = !missingDependencies &&
|
||||
!this.props.DisplayPinnedManager &&
|
||||
this.props.DisplayConfiguration &&
|
||||
!this.props.RebootRequired;
|
||||
|
||||
const showPinnedManager = !missingDependencies &&
|
||||
!this.props.RebootRequired &&
|
||||
this.props.DisplayPinnedManager;
|
||||
|
||||
const showUpgrade = this.props.UpgradeAvailable &&
|
||||
!this.props.DisplayError &&
|
||||
!showConfig &&
|
||||
!this.props.DownloadActive &&
|
||||
!this.props.UpgradeDismissed &&
|
||||
!this.props.InstallActive &&
|
||||
!this.props.RebootRequired;
|
||||
|
||||
const showDependencies = !showUpgrade &&
|
||||
missingDependencies &&
|
||||
!this.props.DownloadActive &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DismissDependencies &&
|
||||
this.props.AllowMount;
|
||||
|
||||
const showNewReleases = !showConfig &&
|
||||
!this.props.DisplayConfirmYesNo &&
|
||||
!showDependencies &&
|
||||
!this.props.DownloadActive &&
|
||||
!this.props.DisplayError &&
|
||||
!this.props.DisplayInfo &&
|
||||
!this.props.InstallActive &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
!this.props.DismissNewReleasesAvailable &&
|
||||
(this.props.NewReleasesAvailable.length > 0);
|
||||
|
||||
const showSkynetImport = !showConfig &&
|
||||
!showDependencies &&
|
||||
!this.props.DownloadActive &&
|
||||
!showNewReleases &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
this.props.DisplayImport;
|
||||
|
||||
const showSkynetExport = !showConfig &&
|
||||
!showDependencies &&
|
||||
!this.props.DownloadActive &&
|
||||
!showNewReleases &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
this.props.DisplayExport;
|
||||
|
||||
const configDisplay = createModalConditionally(showConfig, <Configuration
|
||||
version={selectedVersion}
|
||||
s3Supported={s3Supported}
|
||||
remoteSupported={remoteSupported}/>);
|
||||
const pinnedManagerDisplay = createModalConditionally(showPinnedManager, <PinnedManager
|
||||
version={selectedVersion}/>)
|
||||
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
||||
const dependencyDisplay = createModalConditionally(showDependencies,
|
||||
<DependencyList/>, false, this.props.InstallActive);
|
||||
const downloadDisplay = createModalConditionally(this.props.DownloadActive,
|
||||
<DownloadProgress/>, false, true);
|
||||
const errorDisplay = createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true);
|
||||
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails/>, true);
|
||||
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases/>);
|
||||
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot/>);
|
||||
const selectAppPlatformDisplay = createModalConditionally(this.props.DisplaySelectAppPlatform,
|
||||
<SelectAppPlatform/>);
|
||||
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI/>);
|
||||
const importDisplay = createModalConditionally(showSkynetImport, <SkynetImport
|
||||
version={selectedVersion}/>);
|
||||
const exportDisplay = createModalConditionally(showSkynetExport, <SkynetExport
|
||||
version={selectedVersion}/>)
|
||||
const appBusyDisplay = createModalConditionally(this.props.AppBusy,
|
||||
<ApplicationBusy/>, false, true, this.props.AppBusyTransparent);
|
||||
|
||||
let mainContent = [];
|
||||
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
||||
mainContent = (
|
||||
<Box dxStyle={{height: '100%'}}>
|
||||
<Loading/>
|
||||
</Box>);
|
||||
} else {
|
||||
let key = 0;
|
||||
mainContent.push((
|
||||
<Box key={'md_' + key++}
|
||||
dxStyle={{padding: 'var(--default_spacing)', height: 'auto'}}>
|
||||
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled}
|
||||
version={selectedVersion}/>
|
||||
</Box>
|
||||
));
|
||||
mainContent.push(<div key={'md_' + key++}
|
||||
style={{paddingTop: 'var(--default_spacing)'}}/>);
|
||||
if (allowMount) {
|
||||
mainContent.push((
|
||||
<Box dxStyle={{padding: 'var(--default_spacing)', height: 'auto'}}
|
||||
key={'md_' + key++}>
|
||||
<MountItems s3Supported={s3Supported}
|
||||
remoteSupported={remoteSupported}
|
||||
scPrimeSupported={scPrimeSupported}
|
||||
siaSupported={siaSupported}
|
||||
skynetSupported={skynetSupported}/>
|
||||
</Box>
|
||||
));
|
||||
} else if (selectedVersion !== 'unavailable') {
|
||||
mainContent.push((
|
||||
<Box dxStyle={{padding: 'var(--default_spacing)', height: '170px'}}
|
||||
key={'md_' + key++}>
|
||||
<Loading/>
|
||||
</Box>
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'App'}>
|
||||
<div className={'AppContainer'}>
|
||||
<div className={'AppHeader'}>
|
||||
<Box>
|
||||
<Grid>
|
||||
<Text col={0}
|
||||
colSpan={'remain'}
|
||||
row={0}
|
||||
rowSpan={'remain'}
|
||||
text={'Repertory UI v' + this.props.Version}
|
||||
textAlign={'center'}
|
||||
type={'Heading1'}/>
|
||||
<UpgradeIcon
|
||||
available={this.props.UpgradeAvailable || (this.props.NewReleasesAvailable2.length > 0)}
|
||||
newReleases={!this.props.UpgradeAvailable && (this.props.NewReleasesAvailable2.length > 0)}
|
||||
clicked={this.handleUpgradeIconClicked}
|
||||
col={dimensions => dimensions.columns - 6}
|
||||
colSpan={5}
|
||||
row={1}
|
||||
rowSpan={remain => remain - 1}/>
|
||||
</Grid>
|
||||
</Box>
|
||||
</div>
|
||||
<div className={'AppContent'}>
|
||||
{mainContent}
|
||||
</div>
|
||||
</div>
|
||||
{importDisplay}
|
||||
{exportDisplay}
|
||||
{newReleasesDisplay}
|
||||
{selectAppPlatformDisplay}
|
||||
{dependencyDisplay}
|
||||
{upgradeDisplay}
|
||||
{pinnedManagerDisplay}
|
||||
{configDisplay}
|
||||
{infoDisplay}
|
||||
{confirmDisplay}
|
||||
{downloadDisplay}
|
||||
{rebootDisplay}
|
||||
{appBusyDisplay}
|
||||
{errorDisplay}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
AllowDownload: state.download.AllowDownload,
|
||||
AllowMount: state.common.AllowMount,
|
||||
AppPlatform: state.common.AppPlatform,
|
||||
AppBusy: state.common.AppBusy,
|
||||
AppBusyTransparent: state.common.AppBusyTransparent,
|
||||
AppReady: state.common.AppReady,
|
||||
DismissDependencies: state.install.DismissDependencies,
|
||||
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
||||
DisplayConfirmYesNo: state.common.DisplayConfirmYesNo,
|
||||
DisplayError: state.error.DisplayError,
|
||||
DisplayExport: state.skynet.DisplayExport,
|
||||
DisplayImport: state.skynet.DisplayImport,
|
||||
DisplayInfo: state.error.DisplayInfo,
|
||||
DisplayPinnedManager: state.pinned.DisplayPinnedManager,
|
||||
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
|
||||
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
|
||||
DownloadActive: state.download.DownloadActive,
|
||||
InstallActive: state.install.InstallActive,
|
||||
InstalledVersion: state.relver.InstalledVersion,
|
||||
LocationsLookup: state.relver.LocationsLookup,
|
||||
MissingDependencies: state.install.MissingDependencies,
|
||||
MountsBusy: state.mounts.MountsBusy,
|
||||
NewReleasesAvailable: state.relver.NewReleasesAvailable,
|
||||
NewReleasesAvailable2: state.relver.NewReleasesAvailable2,
|
||||
Platform: state.common.Platform,
|
||||
ProviderState: state.mounts.ProviderState,
|
||||
RebootRequired: state.common.RebootRequired,
|
||||
Release: state.relver.Release,
|
||||
ReleaseVersion: state.relver.Version,
|
||||
UpgradeAvailable: state.relver.UpgradeAvailable,
|
||||
UpgradeDismissed: state.relver.UpgradeDismissed,
|
||||
Version: state.common.Version,
|
||||
VersionLookup: state.relver.VersionLookup,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
displaySelectAppPlatform: display => dispatch(displaySelectAppPlatform(display)),
|
||||
loadReleases: () => dispatch(loadReleases()),
|
||||
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
||||
saveState: () => dispatch(saveState()),
|
||||
setDismissNewReleasesAvailable: dismiss => dispatch(setDismissNewReleasesAvailable(dismiss)),
|
||||
setNewReleasesAvailable: items => dispatch(setNewReleasesAvailable(items)),
|
||||
setDismissUIUpgrade: dismiss => dispatch(setDismissUIUpgrade(dismiss)),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
||||
@@ -41,8 +41,6 @@ exports.LINUX_DETECT_SCRIPT_URL =
|
||||
|
||||
exports.LINUX_SELECTABLE_PLATFORMS = [
|
||||
'centos7',
|
||||
'debian9',
|
||||
'debian10',
|
||||
];
|
||||
|
||||
exports.WINFSP_VERSION_NAMES = [
|
||||
|
||||
345
src/helpers.js
345
src/helpers.js
@@ -18,7 +18,10 @@ const _vcRuntimeExists = () => {
|
||||
resolve(true);
|
||||
} else {
|
||||
const cmd = path.join(process.env.windir, 'system32', 'reg.exe');
|
||||
const args = ['QUERY', 'HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'];
|
||||
const args = [
|
||||
'QUERY',
|
||||
'HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'
|
||||
];
|
||||
_execProcessGetOutput(cmd, null, args)
|
||||
.then(lines => {
|
||||
const parseLine = index => {
|
||||
@@ -33,17 +36,21 @@ const _vcRuntimeExists = () => {
|
||||
args2.push('REG_SZ');
|
||||
_execProcessGetOutput(cmd, null, args2)
|
||||
.then(lines => {
|
||||
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
|
||||
if (value.includes('Microsoft Visual C++ 2015-2019 Redistributable (x64)')) {
|
||||
const value = lines[2]
|
||||
.trim()
|
||||
.substr(args2[3].length)
|
||||
.trim()
|
||||
.substr(6)
|
||||
.trim();
|
||||
if (value.includes(
|
||||
'Microsoft Visual C++ 2015-2019 Redistributable (x64)')) {
|
||||
vcRuntimeExists = true;
|
||||
resolve(true);
|
||||
} else {
|
||||
parseLine(++index);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
parseLine(++index);
|
||||
});
|
||||
.catch(() => { parseLine(++index); });
|
||||
} else {
|
||||
parseLine(++index);
|
||||
}
|
||||
@@ -53,9 +60,7 @@ const _vcRuntimeExists = () => {
|
||||
};
|
||||
parseLine(0);
|
||||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
.catch(err => { reject(err); });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -66,14 +71,17 @@ const _createTreeNodes = fileList => {
|
||||
let tree = {}
|
||||
|
||||
const directorySort = (a, b) => {
|
||||
return !!a.directory === !!b.directory ? a.name.localeCompare(b.name) : a.directory ? -1 : 1;
|
||||
return !!a.directory === !!b.directory ? a.name.localeCompare(b.name)
|
||||
: a.directory ? -1 : 1;
|
||||
};
|
||||
|
||||
const addNode = obj => {
|
||||
const addNode =
|
||||
obj => {
|
||||
let fullPath;
|
||||
const idx = obj.skylink.indexOf('/');
|
||||
if (idx > -1) {
|
||||
fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1)).replace(/\\/g, '/');
|
||||
fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1))
|
||||
.replace(/\\/g, '/');
|
||||
} else {
|
||||
fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/');
|
||||
}
|
||||
@@ -94,7 +102,8 @@ const _createTreeNodes = fileList => {
|
||||
}
|
||||
}
|
||||
|
||||
const objectToArray = node => {
|
||||
const objectToArray =
|
||||
node => {
|
||||
Object.keys(node || {}).map((k) => {
|
||||
if (node[k].children) {
|
||||
objectToArray(node[k])
|
||||
@@ -128,17 +137,11 @@ const _exportAllSkylinks = version => {
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stderr.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
@@ -166,13 +169,9 @@ const _executeProcess = (command, working, args = []) => {
|
||||
const process = new spawn(command, args, processOptions);
|
||||
const pid = process.pid;
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err, pid);
|
||||
});
|
||||
process.on('error', (err) => { reject(err, pid); });
|
||||
|
||||
process.on('exit', (code) => {
|
||||
resolve(code);
|
||||
});
|
||||
process.on('exit', (code) => { resolve(code); });
|
||||
|
||||
process.unref();
|
||||
});
|
||||
@@ -190,18 +189,12 @@ const _execProcessGetOutput = (cmd, working, args) => {
|
||||
const proc = spawn(cmd, args, processOptions);
|
||||
|
||||
let output;
|
||||
proc.stdout.on('data', data => {
|
||||
output += data.toString();
|
||||
});
|
||||
proc.stdout.on('data', data => { output += data.toString(); });
|
||||
|
||||
proc.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
proc.on('error', (err) => { reject(err); });
|
||||
|
||||
proc.on('exit', () => {
|
||||
const lines = output
|
||||
.replace(/\r\n/g, '\n')
|
||||
.split('\n');
|
||||
const lines = output.replace(/\r\n/g, '\n').split('\n');
|
||||
resolve(lines);
|
||||
});
|
||||
|
||||
@@ -209,9 +202,8 @@ const _execProcessGetOutput = (cmd, working, args) => {
|
||||
});
|
||||
};
|
||||
|
||||
const _getDataDirectory = () => {
|
||||
return _resolvePath(Constants.DATA_LOCATIONS[os.platform()]);
|
||||
};
|
||||
const _getDataDirectory =
|
||||
() => { return _resolvePath(Constants.DATA_LOCATIONS[os.platform()]); };
|
||||
|
||||
const _getRepertoryDirectory = () => {
|
||||
return _resolvePath(Constants.REPERTORY_LOCATIONS[os.platform()]);
|
||||
@@ -227,7 +219,8 @@ const _getDefaultRepertoryArgs = (provider, remote, s3) => {
|
||||
} else if (remote) {
|
||||
args.push('-rm');
|
||||
args.push(provider.substr(6));
|
||||
} else if (Constants.PROVIDER_ARG[providerLower] && (Constants.PROVIDER_ARG[providerLower].length > 0)) {
|
||||
} else if (Constants.PROVIDER_ARG[providerLower] &&
|
||||
(Constants.PROVIDER_ARG[providerLower].length > 0)) {
|
||||
args.push(Constants.PROVIDER_ARG[providerLower]);
|
||||
}
|
||||
return args;
|
||||
@@ -242,9 +235,7 @@ const _getRepertoryExec = version => {
|
||||
|
||||
const _removeDirectoryRecursively = dir => {
|
||||
if (fs.existsSync(dir)) {
|
||||
fs
|
||||
.readdirSync(dir)
|
||||
.forEach(file => {
|
||||
fs.readdirSync(dir).forEach(file => {
|
||||
const curPath = path.join(dir, file);
|
||||
if (fs.lstatSync(curPath).isDirectory()) {
|
||||
module.exports.removeDirectoryRecursively(curPath);
|
||||
@@ -258,9 +249,7 @@ const _removeDirectoryRecursively = dir => {
|
||||
|
||||
const _resolvePath = str => {
|
||||
if (os.platform() === 'win32') {
|
||||
return str.replace(/%([^%]+)%/g, (_, n) => {
|
||||
return process.env[n];
|
||||
});
|
||||
return str.replace(/%([^%]+)%/g, (_, n) => { return process.env[n]; });
|
||||
} else {
|
||||
return str.replace('~', os.homedir());
|
||||
}
|
||||
@@ -288,13 +277,9 @@ module.exports.checkDaemonVersion = (version, provider) => {
|
||||
args.push('-cv');
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', err => { reject(err); });
|
||||
|
||||
process.on('exit', code => {
|
||||
resolve(code);
|
||||
});
|
||||
process.on('exit', code => { resolve(code); });
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
@@ -304,13 +289,12 @@ module.exports.cleanupOldReleases = versionList => {
|
||||
try {
|
||||
if (versionList && versionList.length > 0) {
|
||||
const dataDir = _getDataDirectory();
|
||||
const directoryList = fs
|
||||
.readdirSync(dataDir, {withFileTypes: true})
|
||||
const directoryList = fs.readdirSync(dataDir, {withFileTypes : true})
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent);
|
||||
|
||||
const removeList = directoryList
|
||||
.filter(dirent => !versionList.includes(dirent.name))
|
||||
const removeList =
|
||||
directoryList.filter(dirent => !versionList.includes(dirent.name))
|
||||
.map(dirent => dirent.name);
|
||||
|
||||
for (const dir of removeList) {
|
||||
@@ -330,14 +314,10 @@ module.exports.cleanupOldReleases = versionList => {
|
||||
};
|
||||
|
||||
module.exports.createSignatureFiles = (signature, publicKey) => {
|
||||
const fileName1 = RandomString.generate({
|
||||
length: 12,
|
||||
charset: 'alphabetic'
|
||||
});
|
||||
const fileName2 = RandomString.generate({
|
||||
length: 12,
|
||||
charset: 'alphabetic'
|
||||
});
|
||||
const fileName1 =
|
||||
RandomString.generate({length : 12, charset : 'alphabetic'});
|
||||
const fileName2 =
|
||||
RandomString.generate({length : 12, charset : 'alphabetic'});
|
||||
|
||||
const signatureFile = path.join(os.tmpdir(), fileName1 + '.sig');
|
||||
const publicKeyFile = path.join(os.tmpdir(), fileName2 + '.pub');
|
||||
@@ -376,29 +356,28 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
|
||||
windowsHide : true,
|
||||
};
|
||||
|
||||
const args = _getDefaultRepertoryArgs(provider,
|
||||
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('remote'),
|
||||
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3'));
|
||||
const args = _getDefaultRepertoryArgs(
|
||||
provider,
|
||||
!Constants.PROVIDER_LIST.includes(provider) &&
|
||||
provider.toLowerCase().startsWith('remote'),
|
||||
!Constants.PROVIDER_LIST.includes(provider) &&
|
||||
provider.toLowerCase().startsWith('s3'));
|
||||
args.push('-status');
|
||||
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
let result = '';
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', () => {
|
||||
mountState[provider] = _tryParse(result, defaultData)[provider] || defaultData;
|
||||
mountState[provider] =
|
||||
_tryParse(result, defaultData)[provider] || defaultData;
|
||||
if (mountState[provider].Active &&
|
||||
((mountState[provider].Location === 'elevating') || (mountState[provider].Location === ''))) {
|
||||
setTimeout(() => {
|
||||
grabStatus(index);
|
||||
}, 2000);
|
||||
((mountState[provider].Location === 'elevating') ||
|
||||
(mountState[provider].Location === ''))) {
|
||||
setTimeout(() => { grabStatus(index); }, 2000);
|
||||
} else {
|
||||
grabStatus(++index);
|
||||
}
|
||||
@@ -410,7 +389,8 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
|
||||
module.exports.downloadFile = (url, destination, progressCallback,
|
||||
completeCallback) => {
|
||||
try {
|
||||
if (fs.existsSync(destination)) {
|
||||
fs.unlinkSync(destination);
|
||||
@@ -446,26 +426,23 @@ module.exports.downloadFile = (url, destination, progressCallback, completeCallb
|
||||
if (downloaded === 0) {
|
||||
completeCallback(new Error('Received 0 bytes'));
|
||||
} else if (downloaded !== total) {
|
||||
completeCallback(new Error('Received incorrect number of bytes'));
|
||||
completeCallback(
|
||||
new Error('Received incorrect number of bytes'));
|
||||
} else {
|
||||
completeCallback();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
response.data.on('error', error => {
|
||||
stream.end(() => {
|
||||
completeCallback(error);
|
||||
});
|
||||
});
|
||||
response.data.on(
|
||||
'error',
|
||||
error => { stream.end(() => { completeCallback(error); }); });
|
||||
}
|
||||
} catch (error) {
|
||||
completeCallback(error);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
completeCallback(error);
|
||||
});
|
||||
.catch(error => { completeCallback(error); });
|
||||
};
|
||||
|
||||
module.exports.executeAndWait = (command, ignoreResult) => {
|
||||
@@ -475,9 +452,7 @@ module.exports.executeAndWait = (command, ignoreResult) => {
|
||||
exec(command, error => {
|
||||
if (error) {
|
||||
if (!ignoreResult && (error.code === 1)) {
|
||||
setTimeout(() => {
|
||||
retryExecute(count, error);
|
||||
}, 1000);
|
||||
setTimeout(() => { retryExecute(count, error); }, 1000);
|
||||
} else {
|
||||
reject(error);
|
||||
}
|
||||
@@ -497,7 +472,9 @@ module.exports.executeAsync = (command, args = []) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const launchProcess = (count, timeout) => {
|
||||
let cmd = path.basename(command);
|
||||
const working = cmd.length === command.length ? null : command.substr(0, command.length - cmd.length);
|
||||
const working = cmd.length === command.length
|
||||
? null
|
||||
: command.substr(0, command.length - cmd.length);
|
||||
let processOptions = {
|
||||
detached : true,
|
||||
shell : false,
|
||||
@@ -517,7 +494,9 @@ module.exports.executeAsync = (command, args = []) => {
|
||||
reject(err, pid);
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
setTimeout(() => launchProcess(count, setTimeout(() => resolve(), 3000)), 1000);
|
||||
setTimeout(
|
||||
() => launchProcess(count, setTimeout(() => resolve(), 3000)),
|
||||
1000);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -527,7 +506,9 @@ module.exports.executeAsync = (command, args = []) => {
|
||||
reject(code, pid);
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
setTimeout(() => launchProcess(count, setTimeout(() => resolve(), 3000)), 1000);
|
||||
setTimeout(
|
||||
() => launchProcess(count, setTimeout(() => resolve(), 3000)),
|
||||
1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -548,29 +529,22 @@ module.exports.executeScript = script => {
|
||||
};
|
||||
|
||||
const command = '/bin/sh';
|
||||
const args = [
|
||||
script
|
||||
];
|
||||
const args = [ script ];
|
||||
|
||||
const process = new spawn(command, args, processOptions);
|
||||
let result = '';
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', () => {
|
||||
resolve(result);
|
||||
});
|
||||
process.on('exit', () => { resolve(result); });
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => {
|
||||
module.exports.executeMount =
|
||||
(version, provider, remote, s3, location, exitCallback) => {
|
||||
return new Promise((resolve) => {
|
||||
const repertoryExec = _getRepertoryExec(version);
|
||||
const processOptions = {
|
||||
@@ -595,9 +569,7 @@ module.exports.executeMount = (version, provider, remote, s3, location, exitCall
|
||||
let process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
const pid = process.pid;
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
resolve(pid);
|
||||
}, 3000);
|
||||
const timeout = setTimeout(() => { resolve(pid); }, 3000);
|
||||
|
||||
process.on('error', (err) => {
|
||||
clearTimeout(timeout);
|
||||
@@ -630,17 +602,11 @@ module.exports.exportSkylinks = (version, paths) => {
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stderr.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
@@ -671,18 +637,12 @@ module.exports.getConfig = (version, provider, remote, s3) => {
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
let result = '';
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', () => {
|
||||
const lines = result
|
||||
.replace(/\r\n/g, '\n')
|
||||
.split('\n');
|
||||
const lines = result.replace(/\r\n/g, '\n').split('\n');
|
||||
|
||||
const code = parseInt(lines[0], 10);
|
||||
if (code === 0) {
|
||||
@@ -715,17 +675,11 @@ module.exports.getConfigTemplate = (version, provider, remote, s3) => {
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
let result = '';
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', () => {
|
||||
resolve(JSON.parse(result));
|
||||
});
|
||||
process.on('exit', () => { resolve(JSON.parse(result)); });
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
@@ -792,10 +746,7 @@ module.exports.getMissingDependencies = dependencies => {
|
||||
}
|
||||
|
||||
const key = dep.registry[index].substr(hiveName.length);
|
||||
const regKey = new Registry({
|
||||
hive: hive,
|
||||
key: key
|
||||
});
|
||||
const regKey = new Registry({hive : hive, key : key});
|
||||
regKey.valueExists('DisplayName', (err, exists) => {
|
||||
if (err || !exists) {
|
||||
regKey.valueExists('ProductName', (err, exists) => {
|
||||
@@ -818,7 +769,8 @@ module.exports.getMissingDependencies = dependencies => {
|
||||
} else {
|
||||
for (const dep of dependencies) {
|
||||
try {
|
||||
if (!(fs.lstatSync(dep.file).isFile() || fs.lstatSync(dep.file).isSymbolicLink())) {
|
||||
if (!(fs.lstatSync(dep.file).isFile() ||
|
||||
fs.lstatSync(dep.file).isSymbolicLink())) {
|
||||
missing.push(dep);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -840,9 +792,7 @@ module.exports.grabSkynetFileTree = version => {
|
||||
children : _createTreeNodes(results.success),
|
||||
} ]);
|
||||
})
|
||||
.catch(e => {
|
||||
reject(e);
|
||||
});
|
||||
.catch(e => { reject(e); });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -863,17 +813,11 @@ module.exports.grabDirectoryItems = (path, version, provider, remote, s3) => {
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stderr.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
@@ -905,17 +849,11 @@ module.exports.setPinned = (path, pinned, version, provider, remote, s3) => {
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stderr.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
@@ -946,17 +884,11 @@ module.exports.importSkylinks = (version, jsonArray) => {
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stdout.on('data', (d) => { result += d; });
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
process.stderr.on('data', (d) => { result += d; });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
@@ -972,7 +904,8 @@ module.exports.importSkylinks = (version, jsonArray) => {
|
||||
};
|
||||
|
||||
// https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync
|
||||
module.exports.mkDirByPathSync = (targetDir, {isRelativeToScript = false} = {}) => {
|
||||
module.exports.mkDirByPathSync = (targetDir,
|
||||
{isRelativeToScript = false} = {}) => {
|
||||
const sep = path.sep;
|
||||
const initDir = path.isAbsolute(targetDir) ? sep : '';
|
||||
const baseDir = isRelativeToScript ? __dirname : '.';
|
||||
@@ -986,8 +919,10 @@ module.exports.mkDirByPathSync = (targetDir, {isRelativeToScript = false} = {})
|
||||
return curDir;
|
||||
}
|
||||
|
||||
// To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on Windows.
|
||||
if (err.code === 'ENOENT') { // Throw the original parentDir error on curDir `ENOENT` failure.
|
||||
// To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on
|
||||
// Windows.
|
||||
if (err.code === 'ENOENT') { // Throw the original parentDir error on
|
||||
// curDir `ENOENT` failure.
|
||||
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
|
||||
}
|
||||
|
||||
@@ -1007,7 +942,10 @@ module.exports.performWindowsUninstall = names => {
|
||||
reject('Windows OS is not being used');
|
||||
} else {
|
||||
const cmd = path.join(process.env.windir, 'system32', 'reg.exe');
|
||||
const args = ['QUERY', 'HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'];
|
||||
const args = [
|
||||
'QUERY',
|
||||
'HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'
|
||||
];
|
||||
_execProcessGetOutput(cmd, null, args)
|
||||
.then(lines => {
|
||||
const parseLine = index => {
|
||||
@@ -1022,28 +960,32 @@ module.exports.performWindowsUninstall = names => {
|
||||
args2.push('REG_SZ');
|
||||
_execProcessGetOutput(cmd, null, args2)
|
||||
.then(lines => {
|
||||
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
|
||||
const value = lines[2]
|
||||
.trim()
|
||||
.substr(args2[3].length)
|
||||
.trim()
|
||||
.substr(6)
|
||||
.trim();
|
||||
if (names.includes(value)) {
|
||||
const items = line.split('\\');
|
||||
const productCode = items[items.length - 1];
|
||||
_executeProcess('msiexec.exe', null, ['/x', productCode, '/norestart'])
|
||||
_executeProcess('msiexec.exe', null,
|
||||
[ '/x', productCode, '/norestart' ])
|
||||
.then(code => {
|
||||
if ((code === 0) || (code === 3010) || (code === 1641)) {
|
||||
if ((code === 0) || (code === 3010) ||
|
||||
(code === 1641)) {
|
||||
resolve(true);
|
||||
} else {
|
||||
reject('[' + value + '] uninstall failed: ' + code);
|
||||
reject('[' + value +
|
||||
'] uninstall failed: ' + code);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
.catch(err => { reject(err); });
|
||||
} else {
|
||||
parseLine(++index);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
parseLine(++index);
|
||||
});
|
||||
.catch(() => { parseLine(++index); });
|
||||
} else {
|
||||
parseLine(++index);
|
||||
}
|
||||
@@ -1053,9 +995,7 @@ module.exports.performWindowsUninstall = names => {
|
||||
};
|
||||
parseLine(0);
|
||||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
.catch(err => { reject(err); });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1064,7 +1004,8 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
|
||||
|
||||
module.exports.resolvePath = _resolvePath;
|
||||
|
||||
module.exports.setConfigValue = (name, value, provider, remote, s3, version) => {
|
||||
module.exports.setConfigValue =
|
||||
(name, value, provider, remote, s3, version) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const repertoryExec = _getRepertoryExec(version);
|
||||
const processOptions = {
|
||||
@@ -1081,9 +1022,7 @@ module.exports.setConfigValue = (name, value, provider, remote, s3, version) =>
|
||||
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code !== 0) {
|
||||
@@ -1112,9 +1051,7 @@ module.exports.stopMountProcess = (version, provider, remote, s3) => {
|
||||
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
const pid = process.pid;
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
process.on('error', (err) => { reject(err); });
|
||||
process.on('exit', (code) => {
|
||||
resolve({
|
||||
PID : pid,
|
||||
@@ -1155,9 +1092,7 @@ module.exports.testRepertoryBinary = version => {
|
||||
reject(new Error('Invalid exit code: ' + code));
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
.catch(error => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1195,7 +1130,12 @@ module.exports.verifyHash = (file, hash) => {
|
||||
module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const executeVerify = openssl => {
|
||||
execFile(openssl, ['dgst', '-sha256', '-verify', publicKeyFile, '-signature', signatureFile, file], (err, stdout) => {
|
||||
execFile(openssl,
|
||||
[
|
||||
'dgst', '-sha256', '-verify', publicKeyFile, '-signature',
|
||||
signatureFile, file
|
||||
],
|
||||
(err, stdout) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
@@ -1208,7 +1148,8 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
|
||||
const Registry = require('winreg');
|
||||
const regKey = new Registry({
|
||||
hive : Registry.HKLM,
|
||||
key: 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1'
|
||||
key :
|
||||
'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1'
|
||||
});
|
||||
regKey.valueExists('InstallLocation', (err, exists) => {
|
||||
if (err) {
|
||||
|
||||
25
src/index.js
25
src/index.js
@@ -1,15 +1,18 @@
|
||||
import './index.css';
|
||||
import 'react-checkbox-tree/lib/react-checkbox-tree.css';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import createAppStore from './redux/store/createAppStore';
|
||||
import {getIPCRenderer} from './utils';
|
||||
import packageJson from '../package.json';
|
||||
import {Provider} from 'react-redux';
|
||||
import {setActiveRelease} from './redux/actions/release_version_actions';
|
||||
|
||||
import packageJson from '../package.json';
|
||||
|
||||
import App from './App';
|
||||
import {setProviderState} from './redux/actions/mount_actions';
|
||||
import {setActiveRelease} from './redux/actions/release_version_actions';
|
||||
import createAppStore from './redux/store/createAppStore';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import 'react-checkbox-tree/lib/react-checkbox-tree.css';
|
||||
import {getIPCRenderer} from './utils';
|
||||
|
||||
const Constants = require('./constants');
|
||||
|
||||
@@ -17,13 +20,13 @@ const ipcRenderer = getIPCRenderer();
|
||||
let store;
|
||||
|
||||
if (ipcRenderer) {
|
||||
ipcRenderer.once(Constants.IPC_Get_Platform_Reply, (event, platformInfo) => {
|
||||
ipcRenderer.once(Constants.IPC_Get_Platform_Reply, (_, platformInfo) => {
|
||||
if (platformInfo.Platform === 'linux') {
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty('--default_font_size', '15.3px');
|
||||
}
|
||||
|
||||
ipcRenderer.once(Constants.IPC_Get_State_Reply, (event, result) => {
|
||||
ipcRenderer.once(Constants.IPC_Get_State_Reply, (_, result) => {
|
||||
if (result.data) {
|
||||
store = createAppStore(platformInfo, packageJson.version, result.data);
|
||||
const providerList = [
|
||||
@@ -41,7 +44,8 @@ if (ipcRenderer) {
|
||||
}
|
||||
store.dispatch(setProviderState(provider, state));
|
||||
}
|
||||
store.dispatch(setActiveRelease(result.data.Release, result.data.Version));
|
||||
store.dispatch(
|
||||
setActiveRelease(result.data.Release, result.data.Version));
|
||||
} else {
|
||||
store = createAppStore(platformInfo, packageJson.version, {});
|
||||
}
|
||||
@@ -57,4 +61,3 @@ if (ipcRenderer) {
|
||||
});
|
||||
ipcRenderer.send(Constants.IPC_Get_Platform);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user