gologin 2.2.3 → 2.2.5
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/bookmarks/utils.js +5 -0
- package/src/extensions/get-extensions.js +42 -0
- package/src/gologin.js +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Combined changelog for GoLogin node.js SDK
|
|
4
4
|
|
|
5
|
+
## [2.2.5] 2026-02-05
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
|
|
10
|
+
* Bookmarks reading on lower versions of orbita
|
|
11
|
+
|
|
12
|
+
## [2.2.4] 2026-02-05
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Fixes
|
|
16
|
+
|
|
17
|
+
* Improved bookmarks and extensions syncronization with db
|
|
18
|
+
|
|
5
19
|
## [2.2.3] 2026-02-02
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
package/src/bookmarks/utils.js
CHANGED
|
@@ -7,6 +7,11 @@ export const getCurrentProfileBookmarks = async (pathToBookmarks) => {
|
|
|
7
7
|
try {
|
|
8
8
|
const currentBookmarksFileData = await readFile(pathToBookmarks, { encoding: 'utf-8' });
|
|
9
9
|
bookmarks = JSON.parse(currentBookmarksFileData);
|
|
10
|
+
if (bookmarks.bookmark_bar) {
|
|
11
|
+
return bookmarks;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return bookmarks.roots || {};
|
|
10
15
|
} catch (error) {
|
|
11
16
|
console.log(error);
|
|
12
17
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
|
|
3
|
+
export const getProfileChromeExtensions = async (profilePreferencesPath) => {
|
|
4
|
+
const profileChromeExtensions = [];
|
|
5
|
+
if (!profilePreferencesPath) {
|
|
6
|
+
return profileChromeExtensions;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const fileContent = await readFile(profilePreferencesPath, 'utf-8');
|
|
10
|
+
const settings = JSON.parse(fileContent);
|
|
11
|
+
const extensionsSettingsObj = settings?.extensions || { settings: {} };
|
|
12
|
+
const extensionsSettings = extensionsSettingsObj.settings || {};
|
|
13
|
+
const extensionsEntries = Object.entries(extensionsSettings);
|
|
14
|
+
if (!extensionsEntries.length) {
|
|
15
|
+
return profileChromeExtensions;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const currentExtensions = [];
|
|
19
|
+
|
|
20
|
+
extensionsEntries.forEach((extensionObj) => {
|
|
21
|
+
const [extensionsId, extensionsContent] = extensionObj;
|
|
22
|
+
const { path: extPath = '' } = extensionsContent;
|
|
23
|
+
const formattedPath = extPath.replace(/\\|@/g, '/');
|
|
24
|
+
const regex = new RegExp(`^${extensionsId}|(?:chrome-extensions|user-extensions)/\\w+`);
|
|
25
|
+
const pathMatch = formattedPath.match(regex);
|
|
26
|
+
|
|
27
|
+
if (!pathMatch) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
currentExtensions.push(extensionsId);
|
|
32
|
+
const [matched] = pathMatch;
|
|
33
|
+
const [originalExtId] = matched.split('/').reverse();
|
|
34
|
+
if (profileChromeExtensions.includes(originalExtId)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
profileChromeExtensions.push(originalExtId);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return profileChromeExtensions;
|
|
42
|
+
};
|
package/src/gologin.js
CHANGED
|
@@ -31,6 +31,7 @@ import { API_URL, ensureDirectoryExists, FALLBACK_API_URL, getOsAdvanced } from
|
|
|
31
31
|
import { STORAGE_GATEWAY_BASE_URL } from './utils/constants.js';
|
|
32
32
|
import { get, isPortReachable } from './utils/utils.js';
|
|
33
33
|
export { exitAll, GologinApi } from './gologin-api.js';
|
|
34
|
+
import { getProfileChromeExtensions } from './extensions/get-extensions.js';
|
|
34
35
|
import { checkSocksProxy, makeRequest } from './utils/http.js';
|
|
35
36
|
import { captureGroupedSentryError } from './utils/sentry.js';
|
|
36
37
|
import { zeroProfileBookmarks } from './utils/zero-profile-bookmarks.js';
|
|
@@ -675,7 +676,7 @@ export class GoLogin {
|
|
|
675
676
|
|
|
676
677
|
const bookmarksParsedData = await getCurrentProfileBookmarks(this.bookmarksFilePath);
|
|
677
678
|
const bookmarksFromDb = profile.bookmarks?.bookmark_bar;
|
|
678
|
-
bookmarksParsedData.roots = bookmarksFromDb ? profile.bookmarks : bookmarksParsedData
|
|
679
|
+
bookmarksParsedData.roots = bookmarksFromDb ? profile.bookmarks : bookmarksParsedData;
|
|
679
680
|
await writeFile(this.bookmarksFilePath, JSON.stringify(bookmarksParsedData));
|
|
680
681
|
|
|
681
682
|
debug('Profile ready. Path: ', profilePath, 'PROXY', JSON.stringify(get(preferences, 'gologin.proxy')));
|
|
@@ -1056,10 +1057,12 @@ export class GoLogin {
|
|
|
1056
1057
|
async uploadProfileDataToServer() {
|
|
1057
1058
|
const cookies = await loadCookiesFromFile(this.cookiesFilePath, false, this.profile_id, this.tmpdir);
|
|
1058
1059
|
const bookmarks = await getCurrentProfileBookmarks(this.bookmarksFilePath);
|
|
1059
|
-
|
|
1060
|
+
const profilePreferencesPath = join(this.profilePath(), 'Default', 'Preferences');
|
|
1061
|
+
const extensions = await getProfileChromeExtensions(profilePreferencesPath).catch(() => null);
|
|
1060
1062
|
const body = {
|
|
1061
1063
|
cookies,
|
|
1062
1064
|
bookmarks,
|
|
1065
|
+
extensionsIds: extensions,
|
|
1063
1066
|
isCookiesEncrypted: true,
|
|
1064
1067
|
isStorageGateway: true,
|
|
1065
1068
|
};
|
|
@@ -1204,7 +1207,6 @@ export class GoLogin {
|
|
|
1204
1207
|
const fingerprint = await this.getRandomFingerprint(options);
|
|
1205
1208
|
debug('fingerprint=', fingerprint);
|
|
1206
1209
|
|
|
1207
|
-
|
|
1208
1210
|
const { navigator, fonts, webGLMetadata, webRTC } = fingerprint;
|
|
1209
1211
|
let deviceMemory = navigator.deviceMemory || 2;
|
|
1210
1212
|
if (deviceMemory < 1) {
|
|
@@ -1407,7 +1409,7 @@ export class GoLogin {
|
|
|
1407
1409
|
|
|
1408
1410
|
async saveBookmarksToDb() {
|
|
1409
1411
|
const bookmarksData = await getCurrentProfileBookmarks(this.bookmarksFilePath);
|
|
1410
|
-
const bookmarks = bookmarksData
|
|
1412
|
+
const bookmarks = bookmarksData || {};
|
|
1411
1413
|
await updateProfileBookmarks([this.profile_id], this.access_token, bookmarks);
|
|
1412
1414
|
}
|
|
1413
1415
|
|