gologin 2.0.12 → 2.0.14
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/.sentry-native/b817a79a-8da1-4cac-1975-3f62c9e5bbdf.run.lock +0 -0
- package/examples/example-create-custom-profile.js +7 -7
- package/examples/example-create-profile.js +4 -4
- package/package.json +1 -1
- package/src/browser/browser-user-data-manager.js +1 -1
- package/src/cookies/cookies-manager.js +2 -2
- package/src/gologin.js +19 -5
|
File without changes
|
|
@@ -19,13 +19,13 @@ import GoLogin from '../src/gologin.js';
|
|
|
19
19
|
startUrl: 'https://testurl.com',
|
|
20
20
|
googleServicesEnabled: true,
|
|
21
21
|
lockEnabled: true,
|
|
22
|
-
proxy: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
22
|
+
// proxy: { // uncomment and check input if you need to use proxy
|
|
23
|
+
// mode: 'http', // 'socks4', 'socks5'
|
|
24
|
+
// host: '123.12.123.12',
|
|
25
|
+
// port: 1234,
|
|
26
|
+
// username: 'user',
|
|
27
|
+
// password: 'password',
|
|
28
|
+
// },
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -11,17 +11,17 @@ const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
|
11
11
|
|
|
12
12
|
const profile_id = await GL.create({
|
|
13
13
|
name: 'profile_mac',
|
|
14
|
-
os: 'mac',
|
|
14
|
+
os: 'mac', // 'win', 'lin', 'android'
|
|
15
|
+
// isM1: true, // for Mac M1
|
|
15
16
|
navigator: {
|
|
16
|
-
language: '
|
|
17
|
+
language: 'en-US,en;q=0.9',
|
|
17
18
|
userAgent: 'random', // get random user agent for selected os
|
|
18
19
|
resolution: '1024x768',
|
|
19
|
-
platform: 'mac',
|
|
20
20
|
},
|
|
21
21
|
proxyEnabled: false,
|
|
22
22
|
proxy: {
|
|
23
23
|
mode: 'none',
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
console.log('profile id=', profile_id);
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ export const downloadCookies = ({ profileId, ACCESS_TOKEN, API_BASE_URL }) =>
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
export const uploadCookies = ({ cookies = [], profileId, ACCESS_TOKEN, API_BASE_URL }) =>
|
|
43
|
-
requestretry.post(`${API_BASE_URL}/browser/${profileId}/cookies`, {
|
|
43
|
+
requestretry.post(`${API_BASE_URL}/browser/${profileId}/cookies/?encrypted=true`, {
|
|
44
44
|
headers: {
|
|
45
45
|
Authorization: `Bearer ${ACCESS_TOKEN}`,
|
|
46
46
|
'User-Agent': 'gologin-api',
|
|
@@ -117,7 +117,7 @@ export const loadCookiesFromFile = async (filePath) => {
|
|
|
117
117
|
} catch (error) {
|
|
118
118
|
console.log(error);
|
|
119
119
|
} finally {
|
|
120
|
-
|
|
120
|
+
db && await db.close();
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
return cookies;
|
|
@@ -170,4 +170,4 @@ export const chunk = (arr, chunkSize = 1, cache = []) => {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
return cache;
|
|
173
|
-
}
|
|
173
|
+
}
|
package/src/gologin.js
CHANGED
|
@@ -14,8 +14,9 @@ import { fontsCollection } from '../fonts.js';
|
|
|
14
14
|
import { getCurrentProfileBookmarks } from './bookmarks/utils.js';
|
|
15
15
|
import { updateProfileBookmarks, updateProfileProxy, updateProfileResolution, updateProfileUserAgent } from './browser/browser-api.js';
|
|
16
16
|
import BrowserChecker from './browser/browser-checker.js';
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
composeFonts, downloadCookies, setExtPathsAndRemoveDeleted, setOriginalExtPaths, uploadCookies,
|
|
19
|
+
} from './browser/browser-user-data-manager.js';
|
|
19
20
|
import { getChunckedInsertValues, getDB, loadCookiesFromFile } from './cookies/cookies-manager.js';
|
|
20
21
|
import ExtensionsManager from './extensions/extensions-manager.js';
|
|
21
22
|
import { archiveProfile } from './profile/profile-archiver.js';
|
|
@@ -1065,7 +1066,12 @@ export class GoLogin {
|
|
|
1065
1066
|
os = options.os;
|
|
1066
1067
|
}
|
|
1067
1068
|
|
|
1068
|
-
|
|
1069
|
+
let url = `${API_URL}/browser/fingerprint?os=${os}`;
|
|
1070
|
+
if (options.isM1) {
|
|
1071
|
+
url += '&isM1=true';
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const fingerprint = await requests.get(url,{
|
|
1069
1075
|
headers: {
|
|
1070
1076
|
'Authorization': `Bearer ${this.access_token}`,
|
|
1071
1077
|
'User-Agent': 'gologin-api',
|
|
@@ -1116,12 +1122,20 @@ export class GoLogin {
|
|
|
1116
1122
|
|
|
1117
1123
|
const user_agent = options.navigator?.userAgent;
|
|
1118
1124
|
const orig_user_agent = json.navigator.userAgent;
|
|
1119
|
-
Object.keys(options).
|
|
1120
|
-
json[
|
|
1125
|
+
Object.keys(options).forEach((key) => {
|
|
1126
|
+
if (typeof json[key] === 'object') {
|
|
1127
|
+
json[key] = { ...json[key], ...options[key] };
|
|
1128
|
+
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
json[key] = options[key];
|
|
1121
1133
|
});
|
|
1134
|
+
|
|
1122
1135
|
if (user_agent === 'random') {
|
|
1123
1136
|
json.navigator.userAgent = orig_user_agent;
|
|
1124
1137
|
}
|
|
1138
|
+
|
|
1125
1139
|
// console.log('profileOptions', json);
|
|
1126
1140
|
|
|
1127
1141
|
const response = await requests.post(`${API_URL}/browser`, {
|