gologin 2.2.3 → 2.2.4
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 +7 -0
- package/package.json +1 -1
- package/src/bookmarks/utils.js +1 -0
- package/src/extensions/get-extensions.js +42 -0
- package/src/gologin.js +4 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/bookmarks/utils.js
CHANGED
|
@@ -7,6 +7,7 @@ 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
|
+
bookmarks = bookmarks.roots;
|
|
10
11
|
} catch (error) {
|
|
11
12
|
console.log(error);
|
|
12
13
|
}
|
|
@@ -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';
|
|
@@ -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) {
|