gologin 1.0.51 → 1.0.52

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.
Files changed (2) hide show
  1. package/cookies-manager.js +14 -5
  2. package/package.json +1 -1
@@ -29,8 +29,8 @@ class CookiesManager {
29
29
  const chunckedCookiesArr = this.chunk(cookiesArr, MAX_SQLITE_VARIABLES);
30
30
 
31
31
  return chunckedCookiesArr.map((cookies) => {
32
- const queryPlaceholders = cookies.map(() => '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').join(', ');
33
- const query = `insert or replace into cookies (creation_utc, top_frame_site_key, host_key, name, value, path, expires_utc, is_secure, is_httponly, last_access_utc, is_persistent, encrypted_value, samesite, has_expires) values ${queryPlaceholders}`;
32
+ const queryPlaceholders = cookies.map(() => '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').join(', ');
33
+ const query = `insert or replace into cookies (creation_utc, host_key, top_frame_site_key, name, value, encrypted_value, path, expires_utc, is_secure, is_httponly, last_access_utc, has_expires, is_persistent, priority, samesite, source_scheme, source_port, is_same_party, last_update_utc) values ${queryPlaceholders}`;
34
34
  const queryParams = cookies.flatMap((cookie) => {
35
35
  const creationDate = cookie.creationDate ? cookie.creationDate : this.unixToLDAP(todayUnix);
36
36
  let expirationDate = cookie.session ? 0 : this.unixToLDAP(cookie.expirationDate);
@@ -38,6 +38,10 @@ class CookiesManager {
38
38
  const samesite = Object.keys(SAME_SITE).find((key) => SAME_SITE[key] === (cookie.sameSite || '-1'));
39
39
  const isSecure =
40
40
  cookie.name.startsWith('__Host-') || cookie.name.startsWith('__Secure-') ? 1 : Number(cookie.secure);
41
+
42
+ const sourceScheme = isSecure === 1 ? 2 : 1;
43
+ const sourcePort = isSecure === 1 ? 443 : 80;
44
+ // eslint-disable-next-line no-undefined
41
45
  let isPersistent = [undefined, null].includes(cookie.session)
42
46
  ? Number(expirationDate !== 0)
43
47
  : Number(!cookie.session);
@@ -49,19 +53,24 @@ class CookiesManager {
49
53
 
50
54
  return [
51
55
  creationDate,
52
- '', // top_frame_site_key
53
56
  cookie.domain,
57
+ '', // top_frame_site_key
54
58
  cookie.name,
55
59
  '', // value
60
+ encryptedValue,
56
61
  cookie.path,
57
62
  expirationDate,
58
63
  isSecure,
59
64
  Number(cookie.httpOnly),
60
65
  0, // last_access_utc
66
+ expirationDate === 0 ? 0 : 1, // has_expires
61
67
  isPersistent,
62
- encryptedValue,
68
+ 1, // default priority value (https://github.com/chromium/chromium/blob/main/net/cookies/cookie_constants.h)
63
69
  samesite,
64
- expirationDate === 0 ? 0 : 1, // has_expires
70
+ sourceScheme,
71
+ sourcePort,
72
+ 0, // is_same_party
73
+ 0, // last_update_utc
65
74
  ];
66
75
  });
67
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gologin",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "A high-level API to control Orbita browser over GoLogin API",
5
5
  "main": "./gologin.js",
6
6
  "repository": {