软件卸载后删除配置文件;删除部分无用代码
This commit is contained in:
parent
8042c21dc9
commit
70a1672a05
|
@ -532,12 +532,9 @@
|
|||
],
|
||||
"helpDocUrl":"https://gitee.com/openkylin/extensions-repo/blob/master/user-guide/%E7%9B%AE%E5%BD%95.md",
|
||||
"updateCheckUrl":"https://kylinhorn.cn/updateCheck/kylinide",
|
||||
<<<<<<< HEAD
|
||||
"gIndexUrl":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/config/g_index.json",
|
||||
=======
|
||||
"gIndexUrl":"https://gitee.com/blueskycs2c/installer_config/raw/master/test2/g_index.json",
|
||||
"deployFunc":true,
|
||||
>>>>>>> 6ab623ca... 添加部署功能开关
|
||||
|
||||
"extensionsControlManifest":{
|
||||
"malicious": [],
|
||||
"deprecated": {
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
rm -f /usr/bin/@@NAME@@
|
||||
|
||||
if [ -d /home/${SUDO_USER}/.config/Kylin-Code/installconfig ]; then
|
||||
rm -rf /home/${SUDO_USER}/.config/Kylin-Code/installconfig
|
||||
fi
|
||||
|
||||
# Update mimetype database for removed workspace mimetype
|
||||
if hash update-mime-database 2>/dev/null; then
|
||||
update-mime-database /usr/share/mime
|
||||
|
|
|
@ -132,11 +132,10 @@ export class DeployMainService implements IDeployMainService {
|
|||
this.registerListeners();
|
||||
}
|
||||
reset() {
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0 };
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] };
|
||||
this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "", osrelease: "", supportList: [] };
|
||||
this.localConfigDir = installUtils.localConfigPath();
|
||||
this.installConfig = installUtils.installConfigDirPre();//.kylin-ide/installconfig
|
||||
this.installConfig = installUtils.installConfigDirPre();//installconfig
|
||||
this.updateConfigDir = installUtils.installConfigDirPre() + "/" + installUtils.getDateDir();
|
||||
|
||||
this.logFile0 = this.installConfig + '/log/install.1.log';
|
||||
|
@ -195,8 +194,8 @@ export class DeployMainService implements IDeployMainService {
|
|||
//删除新下载但是没被使用的配置文件
|
||||
if (this.updateConfigDir) {
|
||||
// const selectdir = this.localConfigDir;
|
||||
this.logger.info("this.updateConfgDir :", this.updateConfigDir);
|
||||
this.logger.info("this.localConfigDir :", this.localConfigDir);
|
||||
this.logger.debug("this.updateConfgDir :", this.updateConfigDir);
|
||||
this.logger.debug("this.localConfigDir :", this.localConfigDir);
|
||||
if (this.updateConfigDir !== this.localConfigDir)
|
||||
if (fs.existsSync(this.updateConfigDir))
|
||||
fs.rmdirSync(this.updateConfigDir, { recursive: true });
|
||||
|
@ -562,7 +561,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
}
|
||||
}
|
||||
if (this.DeployWindow) {
|
||||
this.logger.info('配置文件信息', JSON.stringify(Data));
|
||||
// this.logger.info('配置文件信息', JSON.stringify(Data));
|
||||
return Data;
|
||||
} else {
|
||||
return void 0;
|
||||
|
@ -1271,44 +1270,6 @@ export class DeployMainService implements IDeployMainService {
|
|||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
this.sysinfo = { IDEVersion: this.productService.IDEVersion || "", localConfigFile: "", addNewPage: 0, localosinfo: "", urlosinfo: "", urlConfigFile: "" }
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: "", osinfo: "", localConfigMatch: 0 };
|
||||
this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "" };
|
||||
this.localConfigDir = installUtils.localConfigPath();
|
||||
this.installConfig = installUtils.installConfigDirPre();//.kylin-ide/installconfig
|
||||
this.updateConfigDir = installUtils.installConfigDirPre() + "/" + installUtils.getDateDir();
|
||||
this.logFile0 = this.installConfig + '/log/install.1.log';
|
||||
this.resultFile = this.installConfig + '/resultFile';
|
||||
this.extLogFile0 = this.installConfig + '/log/extInstall.1.log';
|
||||
|
||||
this.baseUrl = "";
|
||||
this.extDownloadPath = "";
|
||||
// public extensionsGalleryConfiguration!: IExtensionsGalleryConfiguration;
|
||||
// private preExtensionsGalleryConfig: IExtensionsGalleryConfiguration;
|
||||
this.extMap = {};
|
||||
this.depList = [];
|
||||
this.extList = [];
|
||||
this.lastLogPosition = 0;
|
||||
//文件监听;
|
||||
this.installFsWatcher = null;
|
||||
this.extlogFsWatcher = null;
|
||||
this.pkglogFsWatcher = null;
|
||||
//执行安装脚本的进程号;
|
||||
this.installProcessId = null;
|
||||
this.cancelFlag = false;
|
||||
this.offset = 0;
|
||||
this.resultIndex = 0;
|
||||
|
||||
this.flagPkexec = 0;
|
||||
this.lastExtLogPosition = 0;
|
||||
|
||||
this.startInstallDepWatch = 0;
|
||||
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
|
||||
println(message?: any, ...optionalParams: any[]) {
|
||||
console.log(message, ...optionalParams);
|
||||
}
|
||||
|
@ -1339,8 +1300,6 @@ export class DeployMainService implements IDeployMainService {
|
|||
FileAccess.asBrowserUri(`vs/code/electron-sandbox/deploy/deployWindow${this.environmentMainService.isBuilt ? '' : '-dev'}.html`).toString(true)
|
||||
);
|
||||
this.DeployWindow.webContents.openDevTools();
|
||||
// this.DeployWindow.setMenuBarVisibility(true);
|
||||
// // Menu.setApplicationMenu(null);
|
||||
|
||||
let initData = {
|
||||
isFirstLoad: flag,
|
||||
|
@ -1376,7 +1335,8 @@ export class DeployMainService implements IDeployMainService {
|
|||
validatedIpcMain.on('kylinide.installWizard.skipWizard', listenerSkipWizard
|
||||
);
|
||||
const listenerInit = async (event: IpcMainEvent, msg: any) => {
|
||||
console.log("main on kylinide.installWizard.init");
|
||||
this.logger.info("接收消息:kylinide.installWizard.init");
|
||||
|
||||
if (msg.type === "writeJson") {
|
||||
if (this.selectObject.updateFlag) {
|
||||
installUtils.modifyJsonProperty(this.installConfig + "/" + "selectFile.json", "selectDir", this.updateConfigDir);
|
||||
|
@ -1398,7 +1358,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
private createDeployBrowserWindow<T>(position: IWindowState, ipcObjectUrl: IIPCObjectUrl<T>, windowKind: string): BrowserWindow {
|
||||
const window = new BrowserWindow({
|
||||
fullscreen: false,
|
||||
// resizable: false,
|
||||
resizable: true,
|
||||
width: position.width,
|
||||
height: position.height,
|
||||
minWidth: 300,
|
||||
|
@ -1532,14 +1492,6 @@ export class DeployMainService implements IDeployMainService {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// private safeSend(event: IpcMainEvent, channel: string, ...args: unknown[]): void {
|
||||
// if (!event.sender.isDestroyed()) {
|
||||
// event.sender.send(channel, ...args);
|
||||
// }
|
||||
// }
|
||||
|
||||
private replaceBaseUrl(url: string, baseurl: string) {
|
||||
if (url.startsWith("base-url:")) {
|
||||
url = url.replace("base-url:", baseurl);
|
||||
|
@ -1554,7 +1506,6 @@ export class DeployMainService implements IDeployMainService {
|
|||
|
||||
private versify(dataPath: string, signature: string) {
|
||||
const crypto = require('crypto');
|
||||
// const publicKeyPath = FileAccess.asFileUri('vs/platform/issue/electron-main/installWizard/key/public.pem').fsPath;
|
||||
const publicKeyPath = path.join(FileAccess.asFileUri('').fsPath, '..', "installwizard/key/public.pem");
|
||||
this.logger.info("publicKeyPath", publicKeyPath);
|
||||
//获取数据
|
||||
|
@ -1766,7 +1717,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
if (osinfo !== 'undefined') {
|
||||
if (g_index_Object["config-file"].hasOwnProperty(`${osinfo}`)) {
|
||||
if (installUtils.compareVersions(g_index_Object['config-file'][osinfo][0]["kylin-ide-lowest-ver"], this.productService.IDEVersion) == 1) {
|
||||
this.logger.info("网上的配置文件版本与当前ide版本不兼容");
|
||||
this.logger.info("网上的配置文件版本与当前code版本不兼容");
|
||||
flag++;
|
||||
} else {
|
||||
//下载和当前操作系统关联的插件配置文件
|
||||
|
|
|
@ -78,47 +78,14 @@ export function modifyJsonProperty(filePath: string, propertyName: string, newVa
|
|||
|
||||
}
|
||||
export const compareVersions = (v1: string, v2: string) => {
|
||||
// validate input and split into segments
|
||||
const n1 = validateAndParse(v1);
|
||||
const n2 = validateAndParse(v2);
|
||||
|
||||
// pop off the patch
|
||||
const p1 = n1.pop();
|
||||
const p2 = n2.pop();
|
||||
|
||||
// validate numbers
|
||||
const r = compareSegments(n1, n2);
|
||||
if (r !== 0) return r;
|
||||
|
||||
|
||||
if (p1 && p2) {
|
||||
return compareSegments(p1.split('.'), p2.split('.'));
|
||||
} else if (p1 || p2) {
|
||||
return p1 ? -1 : 1;
|
||||
if (v1 && v2) {
|
||||
return compareSegments(v1.split('.'), v2.split('.'));
|
||||
} else if (v1 || v2) {
|
||||
return v1 ? -1 : 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const semver =
|
||||
/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
||||
|
||||
const validateAndParse = (version: string) => {
|
||||
if (typeof version !== 'string') {
|
||||
throw new TypeError('Invalid argument expected string');
|
||||
}
|
||||
const match = version.match(semver);
|
||||
if (!match) {
|
||||
throw new Error(
|
||||
`Invalid argument not valid semver ('${version}' received)`
|
||||
);
|
||||
}
|
||||
match.shift();
|
||||
return match;
|
||||
};
|
||||
|
||||
const tryParse = (v: string) => {
|
||||
const n = parseInt(v, 10);
|
||||
return isNaN(n) ? v : n;
|
||||
|
|
Loading…
Reference in New Issue