Merge remote-tracking branch 'origin/1.1.x_branch' into 1.2.x_branch
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
## 1.2.0
|
## 1.2.0
|
||||||
* Goobox S3 support
|
* Goobox S3 support
|
||||||
|
|
||||||
|
## 1.1.4
|
||||||
|
* \#39: Cleanup old releases and UI upgrades
|
||||||
|
|
||||||
## 1.1.3
|
## 1.1.3
|
||||||
* CentOS 8 support
|
* CentOS 8 support
|
||||||
* Support remote send and receive timeouts
|
* Support remote send and receive timeouts
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ exports.IPC_Check_Installed_Reply = 'check_installed_reply';
|
|||||||
|
|
||||||
exports.IPC_Check_Mount_Location = 'check_mount_location';
|
exports.IPC_Check_Mount_Location = 'check_mount_location';
|
||||||
|
|
||||||
|
exports.IPC_Cleanup_Releases = 'IPC_Cleanup_Releases';
|
||||||
|
|
||||||
exports.IPC_Delete_File = 'delete_file';
|
exports.IPC_Delete_File = 'delete_file';
|
||||||
|
|
||||||
exports.IPC_Detect_Mount = 'detect_mount';
|
exports.IPC_Detect_Mount = 'detect_mount';
|
||||||
|
|||||||
@@ -87,6 +87,22 @@ const _getRepertoryExec = version => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _removeDirectoryRecursively = dir => {
|
||||||
|
if (fs.existsSync(dir)) {
|
||||||
|
fs
|
||||||
|
.readdirSync(dir)
|
||||||
|
.forEach(file => {
|
||||||
|
const curPath = path.join(dir, file);
|
||||||
|
if (fs.lstatSync(curPath).isDirectory()) {
|
||||||
|
module.exports.removeDirectoryRecursively(curPath);
|
||||||
|
} else {
|
||||||
|
fs.unlinkSync(curPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fs.rmdirSync(dir);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const _resolvePath = str => {
|
const _resolvePath = str => {
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
return str.replace(/%([^%]+)%/g, (_, n) => {
|
return str.replace(/%([^%]+)%/g, (_, n) => {
|
||||||
@@ -130,6 +146,36 @@ module.exports.checkDaemonVersion = (version, provider) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.cleanupOldReleases = versionList => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
if (versionList && versionList.length > 0) {
|
||||||
|
const dataDir = _getDataDirectory();
|
||||||
|
const directoryList = fs
|
||||||
|
.readdirSync(dataDir, {withFileTypes: true})
|
||||||
|
.filter(dirent => dirent.isDirectory())
|
||||||
|
.map(dirent => dirent);
|
||||||
|
|
||||||
|
const removeList = directoryList
|
||||||
|
.filter(dirent => !versionList.includes(dirent.name))
|
||||||
|
.map(dirent => dirent.name);
|
||||||
|
|
||||||
|
for (const dir of removeList) {
|
||||||
|
try {
|
||||||
|
_removeDirectoryRecursively(path.join(dataDir, dir));
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.createSignatureFiles = (signature, publicKey) => {
|
module.exports.createSignatureFiles = (signature, publicKey) => {
|
||||||
const fileName1 = RandomString.generate({
|
const fileName1 = RandomString.generate({
|
||||||
length: 12,
|
length: 12,
|
||||||
@@ -653,21 +699,7 @@ module.exports.performWindowsUninstall = names => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.removeDirectoryRecursively = (p) => {
|
module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
|
||||||
if (fs.existsSync(p)) {
|
|
||||||
fs
|
|
||||||
.readdirSync(p)
|
|
||||||
.forEach(file => {
|
|
||||||
const curPath = path.join(p, file);
|
|
||||||
if (fs.lstatSync(curPath).isDirectory()) {
|
|
||||||
module.exports.removeDirectoryRecursively(curPath);
|
|
||||||
} else {
|
|
||||||
fs.unlinkSync(curPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fs.rmdirSync(p);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.resolvePath = _resolvePath;
|
module.exports.resolvePath = _resolvePath;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
setDismissDependencies
|
setDismissDependencies
|
||||||
} from './install_actions';
|
} from './install_actions';
|
||||||
import {unmountAll} from './mount_actions';
|
import {unmountAll} from './mount_actions';
|
||||||
|
import {getIPCRenderer} from '../../utils';
|
||||||
|
|
||||||
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
||||||
export const clearUIUpgrade = () => {
|
export const clearUIUpgrade = () => {
|
||||||
@@ -22,6 +23,17 @@ export const clearUIUpgrade = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cleanupOldReleases = versionList => {
|
||||||
|
return dispatch => {
|
||||||
|
const ipcRenderer = getIPCRenderer();
|
||||||
|
if (ipcRenderer) {
|
||||||
|
ipcRenderer.sendSync(Constants.IPC_Cleanup_Releases + '_sync', {
|
||||||
|
version_list: versionList
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const detectUIUpgrade = () => {
|
export const detectUIUpgrade = () => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
axios
|
axios
|
||||||
@@ -77,6 +89,12 @@ export const loadReleases = () => {
|
|||||||
dispatch(setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1));
|
dispatch(setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1));
|
||||||
}
|
}
|
||||||
dispatch(checkVersionInstalled());
|
dispatch(checkVersionInstalled());
|
||||||
|
|
||||||
|
let versionList = [];
|
||||||
|
for (const key of Object.keys(locationsLookup)) {
|
||||||
|
versionList.push(key);
|
||||||
|
}
|
||||||
|
dispatch(cleanupOldReleases(versionList))
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((version !== state.Version) || (release !== state.Release)) {
|
if ((version !== state.Version) || (release !== state.Release)) {
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ const addListeners = (ipcMain, standardIPCReply) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on(Constants.IPC_Cleanup_Releases + '_sync', (event, data) => {
|
||||||
|
helpers.cleanupOldReleases(data.version_list);
|
||||||
|
|
||||||
|
event.returnValue = true;
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on(Constants.IPC_Extract_Release, (event, data) => {
|
ipcMain.on(Constants.IPC_Extract_Release, (event, data) => {
|
||||||
const destination = path.join(helpers.getDataDirectory(), data.Version);
|
const destination = path.join(helpers.getDataDirectory(), data.Version);
|
||||||
helpers.removeDirectoryRecursively(destination);
|
helpers.removeDirectoryRecursively(destination);
|
||||||
@@ -84,4 +90,4 @@ const addListeners = (ipcMain, standardIPCReply) => {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
addListeners
|
addListeners
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user