gologin 1.0.56 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser-checker.js +13 -13
- package/gologin.js +16 -7
- package/package.json +1 -1
package/browser-checker.js
CHANGED
|
@@ -13,24 +13,24 @@ const readline = require('readline');
|
|
|
13
13
|
const PLATFORM = process.platform;
|
|
14
14
|
|
|
15
15
|
const VERSION_FILE = 'latest-version.txt';
|
|
16
|
-
const MAC_VERSION_FILE_URL = `https://orbita-browser-mac.gologin.com/${VERSION_FILE}`;
|
|
17
|
-
const DEB_VERSION_FILE_URL = `https://orbita-browser-linux.gologin.com/${VERSION_FILE}`;
|
|
18
|
-
const WIN_VERSION_FILE_URL = `https://orbita-browser-windows.gologin.com/${VERSION_FILE}`;
|
|
16
|
+
const MAC_VERSION_FILE_URL = `https://orbita-browser-mac-wc.gologin.com/${VERSION_FILE}`;
|
|
17
|
+
const DEB_VERSION_FILE_URL = `https://orbita-browser-linux-wc.gologin.com/${VERSION_FILE}`;
|
|
18
|
+
const WIN_VERSION_FILE_URL = `https://orbita-browser-windows-wc.gologin.com/${VERSION_FILE}`;
|
|
19
19
|
|
|
20
20
|
const WIN_FOLDERSIZE_FILE = 'foldersize.txt';
|
|
21
21
|
const WIN_FOLDERSIZE_FILE_LINK = `https://orbita-browser-windows.gologin.com/${WIN_FOLDERSIZE_FILE}`;
|
|
22
22
|
|
|
23
23
|
const BROWSER_ARCHIVE_NAME = `orbita-browser-latest.${PLATFORM === 'win32' ? 'zip' : 'tar.gz'}`;
|
|
24
|
-
const MAC_BROWSER_LINK = `https://orbita-browser-mac.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
25
|
-
const DEB_BROWSER_LINK = `https://orbita-browser-linux.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
26
|
-
const WIN_BROWSER_LINK = `https://orbita-browser-windows.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
24
|
+
const MAC_BROWSER_LINK = `https://orbita-browser-mac-wc.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
25
|
+
const DEB_BROWSER_LINK = `https://orbita-browser-linux-wc.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
26
|
+
const WIN_BROWSER_LINK = `https://orbita-browser-windows-wc.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
27
27
|
|
|
28
28
|
const MAC_HASH_FILE = 'hashfile.mtree';
|
|
29
29
|
const DEB_HASH_FILE = 'hashfile.txt';
|
|
30
30
|
const WIN_HASH_FILE = DEB_HASH_FILE;
|
|
31
|
-
const MAC_HASHFILE_LINK = `https://orbita-browser-mac.gologin.com/${MAC_HASH_FILE}`;
|
|
32
|
-
const DEB_HASHFILE_LINK = `https://orbita-browser-linux.gologin.com/${DEB_HASH_FILE}`;
|
|
33
|
-
const WIN_HASHFILE_LINK = `https://orbita-browser-windows.gologin.com/${WIN_HASH_FILE}`;
|
|
31
|
+
const MAC_HASHFILE_LINK = `https://orbita-browser-mac-wc.gologin.com/${MAC_HASH_FILE}`;
|
|
32
|
+
const DEB_HASHFILE_LINK = `https://orbita-browser-linux-wc.gologin.com/${DEB_HASH_FILE}`;
|
|
33
|
+
const WIN_HASHFILE_LINK = `https://orbita-browser-windows-wc.gologin.com/${WIN_HASH_FILE}`;
|
|
34
34
|
|
|
35
35
|
const FAIL_SUM_MATCH_MESSAGE = 'hash_sum_not_matched';
|
|
36
36
|
const EXTRACTED_FOLDER = 'extracted-browser';
|
|
@@ -55,7 +55,7 @@ class BrowserChecker {
|
|
|
55
55
|
this.#executableFilePath = executableFilePath;
|
|
56
56
|
// console.log('executableFilePath:', executableFilePath);
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
async checkBrowser(autoUpdateBrowser = false) {
|
|
60
60
|
const browserFolderExists = await access(this.#executableFilePath).then(() => true).catch(() => false);
|
|
61
61
|
|
|
@@ -106,7 +106,7 @@ class BrowserChecker {
|
|
|
106
106
|
} else if (PLATFORM === 'darwin') {
|
|
107
107
|
link = MAC_BROWSER_LINK;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
await this.downloadBrowserArchive(link, pathStr);
|
|
111
111
|
await this.checkBrowserArchive(pathStr);
|
|
112
112
|
await this.extractBrowser();
|
|
@@ -116,7 +116,7 @@ class BrowserChecker {
|
|
|
116
116
|
await this.deleteOldArchives();
|
|
117
117
|
console.log('Orbita updated successfully');
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
downloadBrowserArchive(link, pathStr) {
|
|
121
121
|
return new Promise((resolve, reject) => {
|
|
122
122
|
const writableStream = fs.createWriteStream(pathStr);
|
|
@@ -287,7 +287,7 @@ class BrowserChecker {
|
|
|
287
287
|
targetBrowserPath
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
|
|
291
291
|
async deleteOldArchives(deleteCurrentBrowser = false) {
|
|
292
292
|
if (deleteCurrentBrowser) {
|
|
293
293
|
return this.deleteDir(path.join(this.#browserPath));
|
package/gologin.js
CHANGED
|
@@ -44,6 +44,10 @@ class GoLogin {
|
|
|
44
44
|
this.is_stopping = false;
|
|
45
45
|
this.differentOs = false;
|
|
46
46
|
this.profileOs = 'lin';
|
|
47
|
+
this.waitWebsocket = true;
|
|
48
|
+
if(options.waitWebsocket === false){
|
|
49
|
+
this.waitWebsocket = false;
|
|
50
|
+
}
|
|
47
51
|
this.tmpdir = os.tmpdir();
|
|
48
52
|
this.autoUpdateBrowser = !!options.autoUpdateBrowser;
|
|
49
53
|
this.browserChecker = new BrowserChecker(options.skipOrbitaHashChecking);
|
|
@@ -848,14 +852,17 @@ class GoLogin {
|
|
|
848
852
|
debug('SPAWN CMD', ORBITA_BROWSER, params.join(" "));
|
|
849
853
|
}
|
|
850
854
|
|
|
851
|
-
debug('GETTING WS URL FROM BROWSER');
|
|
852
855
|
|
|
853
|
-
|
|
856
|
+
if(this.waitWebsocket){
|
|
857
|
+
debug('GETTING WS URL FROM BROWSER');
|
|
858
|
+
let data = await requests.get(`http://127.0.0.1:${remote_debugging_port}/json/version`, {json: true});
|
|
854
859
|
|
|
855
|
-
|
|
856
|
-
|
|
860
|
+
debug('WS IS', _.get(data, 'body.webSocketDebuggerUrl', ''))
|
|
861
|
+
this.is_active = true;
|
|
857
862
|
|
|
858
|
-
|
|
863
|
+
return _.get(data, 'body.webSocketDebuggerUrl', '');
|
|
864
|
+
}
|
|
865
|
+
return '';
|
|
859
866
|
}
|
|
860
867
|
|
|
861
868
|
async createStartupAndSpawnBrowser() {
|
|
@@ -933,6 +940,8 @@ class GoLogin {
|
|
|
933
940
|
`${SEPARATOR}oofiananboodjbbmdelgdommihjbkfag`,
|
|
934
941
|
`${SEPARATOR}SafetyTips`,
|
|
935
942
|
`${SEPARATOR}fonts`,
|
|
943
|
+
`${SEPARATOR}BrowserMetrics`,
|
|
944
|
+
`${SEPARATOR}BrowserMetrics-spare.pma`,
|
|
936
945
|
];
|
|
937
946
|
const that = this;
|
|
938
947
|
|
|
@@ -1065,11 +1074,11 @@ class GoLogin {
|
|
|
1065
1074
|
json,
|
|
1066
1075
|
});
|
|
1067
1076
|
|
|
1068
|
-
if (response.
|
|
1077
|
+
if (response.statusCode === 400) {
|
|
1069
1078
|
throw new Error(`gologin failed account creation with status code, ${response.statusCode} DATA ${JSON.stringify(response.body.message)}`);
|
|
1070
1079
|
}
|
|
1071
1080
|
|
|
1072
|
-
if (response.
|
|
1081
|
+
if (response.statusCode === 500) {
|
|
1073
1082
|
throw new Error(`gologin failed account creation with status code, ${response.statusCode}`);
|
|
1074
1083
|
}
|
|
1075
1084
|
debug(JSON.stringify(response.body));
|