#22: Display error if daemon version is too low

This commit is contained in:
Scott E. Graves
2019-05-24 12:38:31 -05:00
parent 200534dccd
commit 234785180a
3 changed files with 79 additions and 7 deletions

View File

@@ -95,18 +95,24 @@ class MountItems extends IPCContainer {
let allowAction = true;
if (mount) {
let result = this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, {
Directory: this.props.directory,
StorageType: storageType,
Version: this.props.version
});
if (result.Success) {
if (this.props.platform !== 'win32') {
result = this.sendSyncRequest(Constants.IPC_Check_Mount_Location, {
Location: location,
});
if (!result.Success) {
allowAction = false;
this.props.errorHandler(result.Error.toString());
if (result.Valid) {
if (this.props.platform !== 'win32') {
result = this.sendSyncRequest(Constants.IPC_Check_Mount_Location, {
Location: location,
});
if (!result.Success) {
allowAction = false;
this.props.errorHandler(result.Error.toString());
}
}
} else {
allowAction = false;
this.props.errorHandler("Incompatible " + storageType + " daemon. Please upgrade " + storageType);
}
} else {
allowAction = false;

View File

@@ -16,6 +16,34 @@ const tryParse = (j, def) => {
}
};
module.exports.checkDaemonVersion = (directory, version, storageType) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
shell: false,
windowsHide: true,
};
const command = path.join(directory, version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-cv');
if (Constants.PROVIDER_ARG[storageType.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[storageType.toLowerCase()]);
}
const process = new spawn(command, args, processOptions);
process.on('error', err => {
reject(err);
});
process.on('exit', code => {
resolve(code);
});
process.unref();
});
};
module.exports.createSignatureFiles = (signature, publicKey) => {
const fileName1 = RandomString.generate({
length: 12,