steamutils 1.3.8 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +39 -4
  2. package/package.json +7 -7
package/index.js CHANGED
@@ -16,7 +16,7 @@ import axios from 'axios'
16
16
  import * as cheerio from 'cheerio'
17
17
  import fs from "fs";
18
18
  import FormData from "form-data";
19
- import {StringUtils} from "alpha-common-utils/src/index.js";
19
+ import {StringUtils} from "alpha-common-utils/index.js";
20
20
 
21
21
  const MAX_RETRY = 10
22
22
  let requestTimestamp = 0
@@ -1676,7 +1676,7 @@ class SteamUser {
1676
1676
 
1677
1677
  switch (response.status) {
1678
1678
  case 302: {
1679
- if(isRedirect){
1679
+ if (isRedirect) {
1680
1680
  redirectURL = response.headers.location
1681
1681
 
1682
1682
  if (redirectURL?.startsWith('https://steamcommunity.com/id/')) {
@@ -1731,7 +1731,7 @@ class SteamUser {
1731
1731
  }
1732
1732
  case 500: {
1733
1733
  console.log(response.status, response.statusText, config.url, response.data)
1734
- if(response.data){
1734
+ if (response.data) {
1735
1735
  return response
1736
1736
  }
1737
1737
  break
@@ -5790,7 +5790,7 @@ class SteamUser {
5790
5790
  url: `${this._myProfile}/tradeoffers/`,
5791
5791
  method: 'GET',
5792
5792
  })
5793
- if(!result?.data){
5793
+ if (!result?.data) {
5794
5794
  return
5795
5795
  }
5796
5796
  const $ = result._$()
@@ -6113,6 +6113,41 @@ class SteamUser {
6113
6113
  return {list, assets, success: true}
6114
6114
  }
6115
6115
  }
6116
+
6117
+ async getPlayerReports(token) {
6118
+ const param = {
6119
+ sessionid: this._sessionid,
6120
+ tab: "playerreports",
6121
+ ajax: 1,
6122
+ ...(!!token && {continue_token: token})
6123
+ }
6124
+ const data = (await this._httpRequestAjax({
6125
+ url: `my/gcpd/730?${Object.keys(param).map(k => `${k}=${param[k]}`).join('&')}`,
6126
+ }))?.data
6127
+ if (data.success !== true) {
6128
+ return
6129
+ }
6130
+ const {
6131
+ success,
6132
+ html,
6133
+ continue_token,
6134
+ continue_text
6135
+ } = data
6136
+ const $ = cheerio.load(StringUtils.cleanSpace(html))
6137
+ const json = table2json($, $('table'))
6138
+ if (Array.isArray(json)) {
6139
+ json.forEach(function (row) {
6140
+ row.Timestamp = moment.utc(row.Time.replace('GMT', '').trim(), 'YYYY-MM-DD HH:mm:ss', true).valueOf()
6141
+ })
6142
+ return json
6143
+ }
6144
+ /*const exampleData = [{
6145
+ "Time": "2023-11-11 19:34:42 GMT",
6146
+ Timestamp: 1699731282000,
6147
+ "Reported Player": "N1k0-",
6148
+ "Report Details": "You reported this player for: Aim HackingWall Hacking"
6149
+ }]*/
6150
+ }
6116
6151
  }
6117
6152
 
6118
6153
  function querySelectorAll($, selector, root) {
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.08",
3
+ "version": "1.3.10",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
- "alpha-common-utils": "^1.0.4",
7
- "axios": "^1.5.1",
6
+ "alpha-common-utils": "^1.0.5",
7
+ "axios": "^1.6.1",
8
8
  "cheerio": "^1.0.0-rc.12",
9
- "crypto-js": "^4.1.1",
9
+ "crypto-js": "^4.2.0",
10
10
  "csgo-friendcode": "^3.0.3",
11
11
  "form-data": "^4.0.0",
12
12
  "lodash": "^4.17.21",
13
13
  "moment": "^2.29.4",
14
14
  "moment-timezone": "^0.5.43",
15
15
  "node-bignumber": "^1.2.2",
16
- "steam-session": "^1.4.1",
17
- "steam-user": "^5.0.1",
18
- "steamcommunity": "^3.47.0",
16
+ "steam-session": "^1.7.1",
17
+ "steam-user": "^5.0.4",
18
+ "steamcommunity": "^3.47.1",
19
19
  "steamid": "^2.0.0",
20
20
  "url-parse": "^1.5.10",
21
21
  "uuid": "^9.0.1",