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