steamutils 1.3.58 → 1.3.59

Sign up to get free protection for your applications and to get access to all the features.
package/SteamClient.js CHANGED
@@ -2392,11 +2392,15 @@ SteamClient.isAccountPlayable = async function isAccountPlayable({ cookie, clien
2392
2392
 
2393
2393
  if (data?.playable === true) {
2394
2394
  if (typeof onPlayable === "function") {
2395
- await onPlayable(steamClient);
2395
+ try {
2396
+ await onPlayable(steamClient);
2397
+ } catch (e) {}
2396
2398
  }
2397
2399
  } else {
2398
2400
  if (typeof onNotPlayable === "function") {
2399
- await onNotPlayable(steamClient);
2401
+ try {
2402
+ await onNotPlayable(steamClient);
2403
+ } catch (e) {}
2400
2404
  }
2401
2405
  }
2402
2406
 
@@ -1,55 +1,57 @@
1
- import SteamUser from "./index.js";
2
-
3
- (async function () {
4
- let json = ``
5
- for (const methodName of Object.getOwnPropertyNames(SteamUser.prototype)) {
6
- if (methodName === "constructor") {
7
- continue
8
- }
9
- const fnString = SteamUser.prototype[methodName].toString().trim()
10
- const async = "async";
11
- // const async = fnString.startsWith("async") ? "async" : "";
12
- let params = fnString.split('(')[1].split(')')[0];
13
- const paramsList = params.split(',')
14
- for (let i = 0; i < paramsList.length; i++) {
15
- if (paramsList[i].includes("=")) {
16
- paramsList[i] = paramsList[i].split("=")[0].trim()
17
- }
18
- }
19
- params = paramsList.join(', ').trim()
20
- if(params.startsWith("{") && !params.endsWith("}")){
21
- params = params + "}"
22
- }
23
-
24
- json += `
25
- ${async} ${methodName}(${params}){
26
- if(!RemoteSteamUser.__appIndex){
27
- RemoteSteamUser.__appIndex = 0
28
- }
29
- RemoteSteamUser.__appIndex++
30
- if(RemoteSteamUser.__appIndex >= RemoteSteamUser.__apps.length){
31
- RemoteSteamUser.__appIndex = 0
32
- }
33
-
34
- const __params = [${params}];
35
- if(__params.length === 1 && __params[0] === undefined){
36
- __params.length = 0
37
- }
38
-
39
- try {
40
- const result = (
41
- await axios.post(RemoteSteamUser.__apps[RemoteSteamUser.__appIndex], {
42
- method: "${methodName}",
43
- params: __params,
44
- cookies: this._cookies,
45
- })
46
- ).data?.result;
47
- return result
48
- } catch (e) {
49
- }
50
- }`.trim() + '\n'
51
- }
52
-
53
- console.log('')
54
-
55
- })()
1
+ import SteamUser from "./index.js";
2
+ import _ from "lodash";
3
+
4
+ (async function () {
5
+ const xx = SteamUser;
6
+
7
+ let json = "";
8
+
9
+ function doWrite(user, is_static) {
10
+ for (const methodName of Object.getOwnPropertyNames(user)) {
11
+ if (methodName === "constructor" || methodName === "length" || methodName === "name" || methodName === "prototype" || methodName === "RequestXML_TooManyRequests" || methodName === "MAX_RETRY") {
12
+ continue;
13
+ }
14
+ const fnString = user[methodName].toString().trim();
15
+ const async = "async";
16
+ // const async = fnString.startsWith("async") ? "async" : "";
17
+ let params = fnString.split("(")[1].split(")")[0];
18
+ const paramsList = params.split(",");
19
+ for (let i = 0; i < paramsList.length; i++) {
20
+ if (paramsList[i].includes("=")) {
21
+ paramsList[i] = paramsList[i].split("=")[0].trim();
22
+ }
23
+ }
24
+ params = paramsList.join(", ").trim();
25
+ if (params.startsWith("{") && !params.endsWith("}")) {
26
+ params = `${params}}`;
27
+ }
28
+
29
+ json += `${`
30
+ ${is_static ? "static " : ""} ${async} ${methodName}(${params}){
31
+ const __params = [${params}];
32
+ if(__params.length === 1 && __params[0] === undefined){
33
+ __params.length = 0
34
+ }
35
+
36
+ try {
37
+ const result = (
38
+ await axios.post(getAppURL(), {
39
+ method: "${methodName}",
40
+ params: __params,
41
+ cookies: this._cookies,
42
+ is_static: ${!!is_static}
43
+ })
44
+ ).data?.result;
45
+ return result
46
+ } catch (e) {
47
+ /* empty */
48
+ }
49
+ }`.trim()}\n`;
50
+ }
51
+ }
52
+
53
+ doWrite(SteamUser.prototype, false);
54
+ doWrite(SteamUser, true);
55
+
56
+ console.log("");
57
+ })();