gologin 2.0.18 → 2.0.20
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/package.json
CHANGED
|
@@ -12,14 +12,16 @@ import util from 'util';
|
|
|
12
12
|
import { findLatestBrowserVersionDirectory } from '../utils/utils.js';
|
|
13
13
|
|
|
14
14
|
const exec = util.promisify(execNonPromise);
|
|
15
|
-
const { access, mkdir, readdir, rmdir, unlink, copyFile, readlink, symlink, lstat } = _promises;
|
|
15
|
+
const { access, mkdir, readdir, rmdir, unlink, copyFile, readlink, symlink, lstat, rename, writeFile } = _promises;
|
|
16
16
|
|
|
17
17
|
const PLATFORM = process.platform;
|
|
18
|
+
const ARCH = process.arch;
|
|
18
19
|
|
|
19
20
|
const VERSION_FILE = 'latest-version.txt';
|
|
20
21
|
const MAC_VERSION_FILE_URL = `https://orbita-browser-mac.gologin.com/${VERSION_FILE}`;
|
|
21
22
|
const DEB_VERSION_FILE_URL = `https://orbita-browser-linux.gologin.com/${VERSION_FILE}`;
|
|
22
23
|
const WIN_VERSION_FILE_URL = `https://orbita-browser-windows.gologin.com/${VERSION_FILE}`;
|
|
24
|
+
const MAC_ARM_VERSION_FILE_URL = `https://orbita-browser-mac-arm.gologin.com/${VERSION_FILE}`;
|
|
23
25
|
|
|
24
26
|
const WIN_FOLDERSIZE_FILE = 'foldersize.txt';
|
|
25
27
|
const WIN_FOLDERSIZE_FILE_LINK = `https://orbita-browser-windows.gologin.com/${WIN_FOLDERSIZE_FILE}`;
|
|
@@ -28,6 +30,7 @@ const BROWSER_ARCHIVE_NAME = `orbita-browser-latest.${PLATFORM === 'win32' ? 'zi
|
|
|
28
30
|
const MAC_BROWSER_LINK = `https://orbita-browser-mac.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
29
31
|
const DEB_BROWSER_LINK = `https://orbita-browser-linux.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
30
32
|
const WIN_BROWSER_LINK = `https://orbita-browser-windows.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
33
|
+
const MAC_ARM_BROWSER_LINK = `https://orbita-browser-mac-arm.gologin.com/${BROWSER_ARCHIVE_NAME}`;
|
|
31
34
|
|
|
32
35
|
const MAC_HASH_FILE = 'hashfile.mtree';
|
|
33
36
|
const DEB_HASH_FILE = 'hashfile.txt';
|
|
@@ -35,6 +38,7 @@ const WIN_HASH_FILE = DEB_HASH_FILE;
|
|
|
35
38
|
const MAC_HASHFILE_LINK = `https://orbita-browser-mac.gologin.com/${MAC_HASH_FILE}`;
|
|
36
39
|
const DEB_HASHFILE_LINK = `https://orbita-browser-linux.gologin.com/${DEB_HASH_FILE}`;
|
|
37
40
|
const WIN_HASHFILE_LINK = `https://orbita-browser-windows.gologin.com/${WIN_HASH_FILE}`;
|
|
41
|
+
const MAC_ARM_HASHFILE_LINK = `https://orbita-browser-mac-arm.gologin.com/${MAC_HASH_FILE}`;
|
|
38
42
|
|
|
39
43
|
const FAIL_SUM_MATCH_MESSAGE = 'hash_sum_not_matched';
|
|
40
44
|
const EXTRACTED_FOLDER = 'extracted-browser';
|
|
@@ -69,11 +73,12 @@ export class BrowserChecker {
|
|
|
69
73
|
async checkBrowser(autoUpdateBrowser = false) {
|
|
70
74
|
const browserFolderExists = await access(this.#executableFilePath).then(() => true).catch(() => false);
|
|
71
75
|
|
|
76
|
+
const browserLatestVersion = await this.getLatestBrowserVersion();
|
|
72
77
|
if (!browserFolderExists) {
|
|
73
|
-
return this.downloadBrowser();
|
|
78
|
+
return this.downloadBrowser(browserLatestVersion);
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
|
|
77
82
|
const currentVersionReq = await this.getCurrentVersion();
|
|
78
83
|
const currentVersion = (currentVersionReq?.stdout || '').replace(/(\r\n|\n|\r)/gm, '');
|
|
79
84
|
|
|
@@ -82,7 +87,7 @@ export class BrowserChecker {
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
if (autoUpdateBrowser) {
|
|
85
|
-
return this.downloadBrowser();
|
|
90
|
+
return this.downloadBrowser(browserLatestVersion);
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
return new Promise(resolve => {
|
|
@@ -96,7 +101,7 @@ export class BrowserChecker {
|
|
|
96
101
|
clearTimeout(timeout);
|
|
97
102
|
rl.close();
|
|
98
103
|
if (answer && answer[0].toString().toLowerCase() === 'y') {
|
|
99
|
-
return this.downloadBrowser().then(() => resolve());
|
|
104
|
+
return this.downloadBrowser(browserLatestVersion).then(() => resolve());
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
console.log(`Continue with current ${currentVersion} version.`);
|
|
@@ -105,7 +110,7 @@ export class BrowserChecker {
|
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
async downloadBrowser() {
|
|
113
|
+
async downloadBrowser(latestVersion) {
|
|
109
114
|
await this.deleteOldArchives(true);
|
|
110
115
|
await mkdir(this.#browserPath, { recursive: true });
|
|
111
116
|
|
|
@@ -115,6 +120,10 @@ export class BrowserChecker {
|
|
|
115
120
|
link = WIN_BROWSER_LINK;
|
|
116
121
|
} else if (PLATFORM === 'darwin') {
|
|
117
122
|
link = MAC_BROWSER_LINK;
|
|
123
|
+
|
|
124
|
+
if (ARCH === 'arm64') {
|
|
125
|
+
link = MAC_ARM_BROWSER_LINK;
|
|
126
|
+
}
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
await this.downloadBrowserArchive(link, pathStr);
|
|
@@ -123,10 +132,16 @@ export class BrowserChecker {
|
|
|
123
132
|
await this.checkBrowserSum();
|
|
124
133
|
console.log('Orbita hash checked successfully');
|
|
125
134
|
await this.replaceBrowser();
|
|
135
|
+
await this.addLatestVersion(latestVersion).catch(() => null);
|
|
126
136
|
await this.deleteOldArchives();
|
|
127
137
|
console.log('Orbita updated successfully');
|
|
128
138
|
}
|
|
129
139
|
|
|
140
|
+
addLatestVersion(latestVersion) {
|
|
141
|
+
return mkdir(join(this.#browserPath, 'orbita-browser', 'version'), { recursive: true })
|
|
142
|
+
.then(() => writeFile(join(this.#browserPath, 'orbita-browser', 'version', 'latest-version.txt'), latestVersion));
|
|
143
|
+
}
|
|
144
|
+
|
|
130
145
|
downloadBrowserArchive(link, pathStr) {
|
|
131
146
|
return new Promise((resolve, reject) => {
|
|
132
147
|
const writableStream = createWriteStream(pathStr);
|
|
@@ -207,6 +222,9 @@ export class BrowserChecker {
|
|
|
207
222
|
let resultPath = join(this.#browserPath, DEB_HASH_FILE);
|
|
208
223
|
if (PLATFORM === 'darwin') {
|
|
209
224
|
hashLink = MAC_HASHFILE_LINK;
|
|
225
|
+
if (ARCH === 'arm64') {
|
|
226
|
+
hashLink = MAC_ARM_HASHFILE_LINK;
|
|
227
|
+
}
|
|
210
228
|
resultPath = join(this.#browserPath, MAC_HASH_FILE);
|
|
211
229
|
}
|
|
212
230
|
|
|
@@ -279,17 +297,7 @@ export class BrowserChecker {
|
|
|
279
297
|
async replaceBrowser() {
|
|
280
298
|
console.log('Copy Orbita to target path');
|
|
281
299
|
if (PLATFORM === 'darwin') {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const files = await readdir(join(this.#browserPath, EXTRACTED_FOLDER));
|
|
285
|
-
const promises = [];
|
|
286
|
-
files.forEach((filename) => {
|
|
287
|
-
if (filename.match(/.*\.dylib$/)) {
|
|
288
|
-
promises.push(copyFile(join(this.#browserPath, EXTRACTED_FOLDER, filename), join(this.#browserPath, filename)));
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
return Promise.all(promises);
|
|
300
|
+
return rename(join(this.#browserPath, EXTRACTED_FOLDER), join(this.#browserPath, 'orbita-browser'))
|
|
293
301
|
}
|
|
294
302
|
|
|
295
303
|
const targetBrowserPath = join(this.#browserPath, 'orbita-browser');
|
|
@@ -303,7 +311,7 @@ export class BrowserChecker {
|
|
|
303
311
|
|
|
304
312
|
async deleteOldArchives(deleteCurrentBrowser = false) {
|
|
305
313
|
if (deleteCurrentBrowser) {
|
|
306
|
-
return this.deleteDir(join(this.#browserPath));
|
|
314
|
+
return this.deleteDir(join(this.#browserPath, 'orbita-browser'));
|
|
307
315
|
}
|
|
308
316
|
|
|
309
317
|
await this.deleteDir(join(this.#browserPath, EXTRACTED_FOLDER));
|
|
@@ -347,7 +355,7 @@ export class BrowserChecker {
|
|
|
347
355
|
if (PLATFORM === 'win32') {
|
|
348
356
|
command = `if exist "${join(this.#browserPath, 'orbita-browser', 'version')}" (type "${join(this.#browserPath, 'orbita-browser', 'version')}") else (echo 0.0.0)`;
|
|
349
357
|
} else if (PLATFORM === 'darwin') {
|
|
350
|
-
command = `if [ -f ${join(this.#browserPath, 'version', VERSION_FILE)} ]; then cat ${join(this.#browserPath, 'version', VERSION_FILE)}; else echo 0.0.0; fi`;
|
|
358
|
+
command = `if [ -f ${join(this.#browserPath, 'orbita-browser', 'version', VERSION_FILE)} ]; then cat ${join(this.#browserPath, 'orbita-browser', 'version', VERSION_FILE)}; else echo 0.0.0; fi`;
|
|
351
359
|
}
|
|
352
360
|
|
|
353
361
|
return exec(command);
|
|
@@ -359,6 +367,10 @@ export class BrowserChecker {
|
|
|
359
367
|
url = WIN_VERSION_FILE_URL;
|
|
360
368
|
} else if (PLATFORM === 'darwin') {
|
|
361
369
|
url = MAC_VERSION_FILE_URL;
|
|
370
|
+
|
|
371
|
+
if (ARCH === 'arm64') {
|
|
372
|
+
url = MAC_ARM_VERSION_FILE_URL;
|
|
373
|
+
}
|
|
362
374
|
}
|
|
363
375
|
|
|
364
376
|
return new Promise(resolve => get(url,
|
package/src/gologin.js
CHANGED
|
@@ -193,7 +193,7 @@ export class GoLogin {
|
|
|
193
193
|
const token = this.access_token;
|
|
194
194
|
debug('getProfileS3 token=', token, 'profile=', this.profile_id, 's3path=', s3path);
|
|
195
195
|
|
|
196
|
-
const s3url = `https://gprofiles.gologin.com/${s3path}`.replace(/\s+/mg, '+');
|
|
196
|
+
const s3url = `https://gprofiles-new.gologin.com/${s3path}`.replace(/\s+/mg, '+');
|
|
197
197
|
debug('loading profile from public s3 bucket, url=', s3url);
|
|
198
198
|
const profileResponse = await requests.get(s3url, {
|
|
199
199
|
encoding: null,
|
|
@@ -1012,9 +1012,14 @@ export class GoLogin {
|
|
|
1012
1012
|
async sanitizeProfile() {
|
|
1013
1013
|
const remove_dirs = [
|
|
1014
1014
|
`${SEPARATOR}Default${SEPARATOR}Cache`,
|
|
1015
|
-
`${SEPARATOR}Default${SEPARATOR}Service Worker
|
|
1015
|
+
`${SEPARATOR}Default${SEPARATOR}Service Worker`,
|
|
1016
1016
|
`${SEPARATOR}Default${SEPARATOR}Code Cache`,
|
|
1017
1017
|
`${SEPARATOR}Default${SEPARATOR}GPUCache`,
|
|
1018
|
+
`${SEPARATOR}Default${SEPARATOR}Extensions`,
|
|
1019
|
+
`${SEPARATOR}Default${SEPARATOR}IndexedDB`,
|
|
1020
|
+
`${SEPARATOR}Default${SEPARATOR}GPUCache`,
|
|
1021
|
+
`${SEPARATOR}Default${SEPARATOR}DawnCache`,
|
|
1022
|
+
`${SEPARATOR}Default${SEPARATOR}fonts_config`,
|
|
1018
1023
|
`${SEPARATOR}GrShaderCache`,
|
|
1019
1024
|
`${SEPARATOR}ShaderCache`,
|
|
1020
1025
|
`${SEPARATOR}biahpgbdmdkfgndcmfiipgcebobojjkp`,
|
|
@@ -1309,7 +1314,7 @@ export class GoLogin {
|
|
|
1309
1314
|
db = await getDB(this.cookiesFilePath, false);
|
|
1310
1315
|
if (resultCookies.length) {
|
|
1311
1316
|
const chunckInsertValues = getChunckedInsertValues(resultCookies);
|
|
1312
|
-
|
|
1317
|
+
|
|
1313
1318
|
for (const [query, queryParams] of chunckInsertValues) {
|
|
1314
1319
|
const insertStmt = await db.prepare(query);
|
|
1315
1320
|
await insertStmt.run(queryParams);
|
|
@@ -11,7 +11,7 @@ const DEFAULT_FOLDER_USELESS_FILE = [
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
name: 'Service Worker',
|
|
14
|
-
subs: [
|
|
14
|
+
subs: [],
|
|
15
15
|
isDirectory: true,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -19,6 +19,26 @@ const DEFAULT_FOLDER_USELESS_FILE = [
|
|
|
19
19
|
subs: [],
|
|
20
20
|
isDirectory: true,
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Extensions',
|
|
24
|
+
subs: [],
|
|
25
|
+
isDirectory: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'IndexedDB',
|
|
29
|
+
subs: [],
|
|
30
|
+
isDirectory: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'fonts_config',
|
|
34
|
+
subs: [],
|
|
35
|
+
isDirectory: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'DawnCache',
|
|
39
|
+
subs: [],
|
|
40
|
+
isDirectory: true,
|
|
41
|
+
},
|
|
22
42
|
{
|
|
23
43
|
name: 'GPUCache',
|
|
24
44
|
subs: [],
|