gologin-commonjs 1.1.7 → 1.1.8
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/dist/src/gologin.js +9 -44
- package/gologin/src/gologin.js +8 -44
- package/package.json +1 -1
package/dist/src/gologin.js
CHANGED
|
@@ -40,9 +40,10 @@ var _browser = require("./utils/browser.js");
|
|
|
40
40
|
var _common = require("./utils/common.js");
|
|
41
41
|
var _constants = require("./utils/constants.js");
|
|
42
42
|
var _utils2 = require("./utils/utils.js");
|
|
43
|
-
var _timezone = require("./utils/timezone.js");
|
|
44
43
|
var _gologinApi = require("./gologin-api.js");
|
|
45
44
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
|
+
// import { tzlookup } from "./utils/timezone.js";
|
|
46
|
+
|
|
46
47
|
const {
|
|
47
48
|
access,
|
|
48
49
|
unlink,
|
|
@@ -618,55 +619,19 @@ class GoLogin {
|
|
|
618
619
|
}
|
|
619
620
|
const proxyUrl = `${proxy.mode}://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port}`;
|
|
620
621
|
debug(`getTimeZone start ${TIMEZONE_URL}`, proxyUrl);
|
|
621
|
-
|
|
622
|
+
data = await _requestretry.default.get(TIMEZONE_URL, {
|
|
622
623
|
proxy: proxyUrl,
|
|
623
|
-
timeout:
|
|
624
|
-
maxAttempts:
|
|
624
|
+
timeout: 3 * 1000,
|
|
625
|
+
maxAttempts: 3
|
|
625
626
|
});
|
|
626
|
-
const result = JSON.parse(response.body);
|
|
627
|
-
let timezone = null;
|
|
628
|
-
try {
|
|
629
|
-
timezone = (0, _timezone.tzlookup)(result.latitude, result.longitude);
|
|
630
|
-
} catch {
|
|
631
|
-
timezone = "Asia/Jakarta";
|
|
632
|
-
}
|
|
633
|
-
data = {
|
|
634
|
-
body: {
|
|
635
|
-
country: result.country_code,
|
|
636
|
-
stateProv: result.city,
|
|
637
|
-
city: result.city,
|
|
638
|
-
timezone: timezone,
|
|
639
|
-
ll: [result.latitude, result.longitude],
|
|
640
|
-
languages: "en",
|
|
641
|
-
accuracy: 100
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
627
|
} else {
|
|
645
|
-
|
|
646
|
-
timeout:
|
|
647
|
-
maxAttempts:
|
|
628
|
+
data = await _requestretry.default.get(TIMEZONE_URL, {
|
|
629
|
+
timeout: 3 * 1000,
|
|
630
|
+
maxAttempts: 3
|
|
648
631
|
});
|
|
649
|
-
const result = JSON.parse(response.body);
|
|
650
|
-
let timezone = null;
|
|
651
|
-
try {
|
|
652
|
-
timezone = (0, _timezone.tzlookup)(result.latitude, result.longitude);
|
|
653
|
-
} catch {
|
|
654
|
-
timezone = "Asia/Jakarta";
|
|
655
|
-
}
|
|
656
|
-
data = {
|
|
657
|
-
body: {
|
|
658
|
-
country: result.country_code,
|
|
659
|
-
stateProv: result.city,
|
|
660
|
-
city: result.city,
|
|
661
|
-
timezone: timezone,
|
|
662
|
-
ll: [result.latitude, result.longitude],
|
|
663
|
-
languages: "en",
|
|
664
|
-
accuracy: 100
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
632
|
}
|
|
668
633
|
debug("getTimeZone finish", data.body);
|
|
669
|
-
this._tz = data.body;
|
|
634
|
+
this._tz = JSON.parse(data.body);
|
|
670
635
|
return this._tz.timezone;
|
|
671
636
|
}
|
|
672
637
|
async getTimezoneWithSocks(params) {
|
package/gologin/src/gologin.js
CHANGED
|
@@ -38,7 +38,7 @@ import { checkAutoLang } from "./utils/browser.js";
|
|
|
38
38
|
import { API_URL, getOsAdvanced } from "./utils/common.js";
|
|
39
39
|
import { STORAGE_GATEWAY_BASE_URL } from "./utils/constants.js";
|
|
40
40
|
import { get, isPortReachable } from "./utils/utils.js";
|
|
41
|
-
import { tzlookup } from "./utils/timezone.js";
|
|
41
|
+
// import { tzlookup } from "./utils/timezone.js";
|
|
42
42
|
export { exitAll, GologinApi } from "./gologin-api.js";
|
|
43
43
|
|
|
44
44
|
const { access, unlink, writeFile, readFile } = _promises;
|
|
@@ -838,56 +838,20 @@ export class GoLogin {
|
|
|
838
838
|
|
|
839
839
|
const proxyUrl = `${proxy.mode}://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port}`;
|
|
840
840
|
debug(`getTimeZone start ${TIMEZONE_URL}`, proxyUrl);
|
|
841
|
-
|
|
841
|
+
data = await requests.get(TIMEZONE_URL, {
|
|
842
842
|
proxy: proxyUrl,
|
|
843
|
-
timeout:
|
|
844
|
-
maxAttempts:
|
|
843
|
+
timeout: 3 * 1000,
|
|
844
|
+
maxAttempts: 3,
|
|
845
845
|
});
|
|
846
|
-
const result = JSON.parse(response.body);
|
|
847
|
-
let timezone = null;
|
|
848
|
-
try {
|
|
849
|
-
timezone = tzlookup(result.latitude, result.longitude);
|
|
850
|
-
} catch {
|
|
851
|
-
timezone = "Asia/Jakarta";
|
|
852
|
-
}
|
|
853
|
-
data = {
|
|
854
|
-
body: {
|
|
855
|
-
country: result.country_code,
|
|
856
|
-
stateProv: result.city,
|
|
857
|
-
city: result.city,
|
|
858
|
-
timezone: timezone,
|
|
859
|
-
ll: [result.latitude, result.longitude],
|
|
860
|
-
languages: "en",
|
|
861
|
-
accuracy: 100,
|
|
862
|
-
},
|
|
863
|
-
};
|
|
864
846
|
} else {
|
|
865
|
-
|
|
866
|
-
timeout:
|
|
867
|
-
maxAttempts:
|
|
847
|
+
data = await requests.get(TIMEZONE_URL, {
|
|
848
|
+
timeout: 3 * 1000,
|
|
849
|
+
maxAttempts: 3,
|
|
868
850
|
});
|
|
869
|
-
const result = JSON.parse(response.body);
|
|
870
|
-
let timezone = null;
|
|
871
|
-
try {
|
|
872
|
-
timezone = tzlookup(result.latitude, result.longitude);
|
|
873
|
-
} catch {
|
|
874
|
-
timezone = "Asia/Jakarta";
|
|
875
|
-
}
|
|
876
|
-
data = {
|
|
877
|
-
body: {
|
|
878
|
-
country: result.country_code,
|
|
879
|
-
stateProv: result.city,
|
|
880
|
-
city: result.city,
|
|
881
|
-
timezone: timezone,
|
|
882
|
-
ll: [result.latitude, result.longitude],
|
|
883
|
-
languages: "en",
|
|
884
|
-
accuracy: 100,
|
|
885
|
-
},
|
|
886
|
-
};
|
|
887
851
|
}
|
|
888
852
|
|
|
889
853
|
debug("getTimeZone finish", data.body);
|
|
890
|
-
this._tz = data.body;
|
|
854
|
+
this._tz = JSON.parse(data.body);
|
|
891
855
|
|
|
892
856
|
return this._tz.timezone;
|
|
893
857
|
}
|