Update chrome.js

This commit is contained in:
Namhyeon Go 2020-12-10 10:26:33 +09:00
parent ac6c568682
commit af267cf268

View File

@ -13,6 +13,7 @@ var ChromeObject = function() {
this.profileName = "Default";
this.userDataDir = null;
this.proxyPort = 1080;
this.inPrivate = false;
this.processList = [];
this.setBinPath = function(path) {
@ -53,16 +54,35 @@ var ChromeObject = function() {
this.userDataDir = SHELL.getPathOfMyDocuments() + "\\UserData_Chrome_" + this.profileName;
}
SHELL.createDesktopIcon("Chrome Prototype (" + this.installedDir + ")", [
"cscript",
"app.js",
"shoutcut",
"chrome",
this.installedDir,
"--profile-directory=\"" + this.profileName + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
url
].join(' '), SYS.getCurrentScriptDirectory());
if (!this.inPrivate) {
SHELL.createDesktopIcon("Chrome Prototype (" + this.installedDir + ")", [
"cscript",
"app.js",
"shoutcut",
"chrome",
this.installedDir,
"--profile-directory=\"" + this.profileName + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
url
].join(' '), SYS.getCurrentScriptDirectory());
} else {
SHELL.createDesktopIcon("Chrome Prototype (" + this.installedDir + ")", [
"cscript",
"app.js",
"shoutcut",
"chrome",
this.installedDir,
"--incognito",
"--profile-directory=\"" + this.profileName + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
url
].join(' '), SYS.getCurrentScriptDirectory());
}
};
this.setInPrivate = function(flag) {
this.inPrivate = flag;
return this;
};
this.open = function(url) {
@ -118,12 +138,24 @@ var ChromeObject = function() {
var shell = SHELL.create();
shell.setWorkingDirectory(this.workingDirectory);
shell.runAs(this.binPath, [
"--profile-directory=\"" + this.profileName + "\"",
"--proxy-server=\"socks5://127.0.0.1:" + this.proxyPort + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
"\"" + url + "\""
]);
if (!this.inPrivate) {
shell.runAs(this.binPath, [
"--profile-directory=\"" + this.profileName + "\"",
"--proxy-server=\"socks5://127.0.0.1:" + this.proxyPort + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
"\"" + url + "\""
]);
} else {
shell.runAs(this.binPath, [
"--incognito",
"--profile-directory=\"" + this.profileName + "\"",
"--proxy-server=\"socks5://127.0.0.1:" + this.proxyPort + "\"",
"--user-data-dir=\"" + this.userDataDir + "\"",
"\"" + url + "\""
]);
}
sleep(3000);
shell.release();
} catch (e) {